1 | /* |
---|
2 | * |
---|
3 | * ********************************************************************* |
---|
4 | * (C) COPYRIGHT 1995 UNIVERSITY OF CHICAGO |
---|
5 | * ********************************************************************* |
---|
6 | * |
---|
7 | * This software was authored by |
---|
8 | * |
---|
9 | * D. Levine |
---|
10 | * Mathematics and Computer Science Division Argonne National Laboratory |
---|
11 | * Argonne IL 60439 |
---|
12 | * levine@mcs.anl.gov |
---|
13 | * (708) 252-6735 |
---|
14 | * (708) 252-5986 (FAX) |
---|
15 | * |
---|
16 | * with programming assistance of participants in Argonne National |
---|
17 | * Laboratory's SERS program. |
---|
18 | * |
---|
19 | * This program contains material protectable under copyright laws of the |
---|
20 | * United States. Permission is hereby granted to use it, reproduce it, |
---|
21 | * to translate it into another language, and to redistribute it to |
---|
22 | * others at no charge except a fee for transferring a copy, provided |
---|
23 | * that you conspicuously and appropriately publish on each copy the |
---|
24 | * University of Chicago's copyright notice, and the disclaimer of |
---|
25 | * warranty and Government license included below. Further, permission |
---|
26 | * is hereby granted, subject to the same provisions, to modify a copy or |
---|
27 | * copies or any portion of it, and to distribute to others at no charge |
---|
28 | * materials containing or derived from the material. |
---|
29 | * |
---|
30 | * The developers of the software ask that you acknowledge its use in any |
---|
31 | * document referencing work based on the program, such as published |
---|
32 | * research. Also, they ask that you supply to Argonne National |
---|
33 | * Laboratory a copy of any published research referencing work based on |
---|
34 | * the software. |
---|
35 | * |
---|
36 | * Any entity desiring permission for further use must contact: |
---|
37 | * |
---|
38 | * J. Gleeson |
---|
39 | * Industrial Technology Development Center Argonne National Laboratory |
---|
40 | * Argonne IL 60439 |
---|
41 | * gleesonj@smtplink.eid.anl.gov |
---|
42 | * (708) 252-6055 |
---|
43 | * |
---|
44 | * ******************************************************************** |
---|
45 | * DISCLAIMER |
---|
46 | * |
---|
47 | * THIS PROGRAM WAS PREPARED AS AN ACCOUNT OF WORK SPONSORED BY AN AGENCY |
---|
48 | * OF THE UNITED STATES GOVERNMENT. NEITHER THE UNIVERSITY OF CHICAGO, |
---|
49 | * THE UNITED STATES GOVERNMENT NOR ANY OF THEIR EMPLOYEES MAKE ANY |
---|
50 | * WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR |
---|
51 | * RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY |
---|
52 | * INFORMATION OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT |
---|
53 | * INFRINGE PRIVATELY OWNED RIGHTS. |
---|
54 | * |
---|
55 | * ********************************************************************** |
---|
56 | * GOVERNMENT LICENSE |
---|
57 | * |
---|
58 | * The Government is granted for itself and others acting on its behalf a |
---|
59 | * paid-up, non-exclusive, irrevocable worldwide license in this computer |
---|
60 | * software to reproduce, prepare derivative works, and perform publicly |
---|
61 | * and display publicly. |
---|
62 | */ |
---|
63 | |
---|
64 | /****************************************************************************** |
---|
65 | * FILE: report.c: This file contains functions for reporting on GA |
---|
66 | * parameters, and execution. |
---|
67 | * |
---|
68 | * Authors: David M. Levine, Philip L. Hallstrom, David M. Noelle |
---|
69 | * Brian P. Walenz |
---|
70 | ******************************************************************************/ |
---|
71 | |
---|
72 | #include "pgapack.h" |
---|
73 | |
---|
74 | /*U**************************************************************************** |
---|
75 | PGAPrintReport - prints genetic algorithm statistics. The statistics |
---|
76 | that are printed are determined by PGASetPrintOptions(). |
---|
77 | |
---|
78 | Category: Reporting |
---|
79 | |
---|
80 | Inputs: |
---|
81 | ctx - context variable |
---|
82 | fp - file pointer to print the output to |
---|
83 | pop - symbolic constant of the population whose statistics are printed |
---|
84 | |
---|
85 | Outputs: |
---|
86 | genetic algorithm statistics are printed to fp |
---|
87 | |
---|
88 | Example: |
---|
89 | PGAContext *ctx; |
---|
90 | int p; |
---|
91 | : |
---|
92 | PGAPrintReport(ctx, stdout, PGA_NEWPOP); |
---|
93 | |
---|
94 | ****************************************************************************U*/ |
---|
95 | void PGAPrintReport(PGAContext *ctx, FILE *fp, int pop) |
---|
96 | { |
---|
97 | int p, best_p; |
---|
98 | double e, best_e; |
---|
99 | |
---|
100 | PGADebugEntered("PGAPrintReport"); |
---|
101 | |
---|
102 | if (ctx->ga.iter == 1) |
---|
103 | /* fprintf (fp, "Iter # Field Value Time\n"); */ |
---|
104 | fprintf (fp, "Iter # Field Value\n"); |
---|
105 | |
---|
106 | best_p = PGAGetBestIndex(ctx, pop); |
---|
107 | best_e = PGAGetEvaluation(ctx, best_p, pop); |
---|
108 | if (!(ctx->ga.iter % ctx->rep.PrintFreq) || ctx->ga.iter == 1) |
---|
109 | { |
---|
110 | fprintf(fp, "%-11dBest %e\n", PGAGetGAIterValue(ctx), best_e); |
---|
111 | /* fprintf(fp, " %ld\n", time(NULL) - ctx->rep.starttime); */ |
---|
112 | if ((ctx->rep.PrintOptions & PGA_REPORT_WORST) == PGA_REPORT_WORST) |
---|
113 | { |
---|
114 | p = PGAGetWorstIndex(ctx, pop); |
---|
115 | e = PGAGetEvaluation(ctx, p, pop); |
---|
116 | fprintf(fp, " Worst %e\n", e); |
---|
117 | } |
---|
118 | |
---|
119 | if ((ctx->rep.PrintOptions & PGA_REPORT_AVERAGE) == PGA_REPORT_AVERAGE) |
---|
120 | fprintf(fp, " Average %e\n", ctx->rep.Average); |
---|
121 | |
---|
122 | if ((ctx->rep.PrintOptions & PGA_REPORT_OFFLINE) |
---|
123 | == PGA_REPORT_OFFLINE) |
---|
124 | fprintf(fp, " Offline %e\n", ctx->rep.Offline); |
---|
125 | |
---|
126 | if ((ctx->rep.PrintOptions & PGA_REPORT_ONLINE) == PGA_REPORT_ONLINE) |
---|
127 | fprintf(fp, " Online %e\n", ctx->rep.Online); |
---|
128 | |
---|
129 | if((ctx->rep.PrintOptions & PGA_REPORT_HAMMING) |
---|
130 | == PGA_REPORT_HAMMING) |
---|
131 | fprintf(fp, " Hamming %e\n", |
---|
132 | PGAHammingDistance(ctx, pop)); |
---|
133 | if ((ctx->rep.PrintOptions & PGA_REPORT_STRING) == PGA_REPORT_STRING) |
---|
134 | PGAPrintString(ctx, fp, best_p, pop); |
---|
135 | } |
---|
136 | fflush(fp); |
---|
137 | |
---|
138 | PGADebugExited("PGAPrintReport"); |
---|
139 | } |
---|
140 | |
---|
141 | /*U**************************************************************************** |
---|
142 | PGASetPrintOptions - set flags to indicate what GA statistics should be |
---|
143 | printed whenever output is printed. May be called more than once to |
---|
144 | specify different report options. Valid choices are PGA_REPORT_AVERAGE, |
---|
145 | PGA_REPORT_OFFLINE, PGA_REPORT_ONLINE, PGA_REPORT_WORST, PGA_REPORT_HAMMING, |
---|
146 | and PGA_REPORT_STRING to specify offline analysis, online analysis, the |
---|
147 | worst string in the population, the Hamming distance of the population, and |
---|
148 | the actual allele values of the best string. The best string is always |
---|
149 | printed. |
---|
150 | |
---|
151 | Category: Reporting |
---|
152 | |
---|
153 | Inputs: |
---|
154 | ctx - context variable |
---|
155 | option - symbolic constant to specify a print option |
---|
156 | |
---|
157 | Outputs: |
---|
158 | None |
---|
159 | |
---|
160 | Example: |
---|
161 | PGAContext *ctx; |
---|
162 | : |
---|
163 | PGASetPrintOptions(ctx, PGA_REPORT_WORST); |
---|
164 | |
---|
165 | ****************************************************************************U*/ |
---|
166 | void PGASetPrintOptions (PGAContext *ctx, int option) |
---|
167 | { |
---|
168 | PGADebugEntered("PGASetPrintOptions"); |
---|
169 | |
---|
170 | switch (option) { |
---|
171 | case PGA_REPORT_AVERAGE: |
---|
172 | case PGA_REPORT_OFFLINE: |
---|
173 | case PGA_REPORT_ONLINE: |
---|
174 | case PGA_REPORT_WORST: |
---|
175 | case PGA_REPORT_HAMMING: |
---|
176 | case PGA_REPORT_STRING: |
---|
177 | ctx->rep.PrintOptions |= option; |
---|
178 | break; |
---|
179 | default: |
---|
180 | PGAError (ctx, "PGASetPrintOption: Invalid value of option:", |
---|
181 | PGA_FATAL, PGA_INT, (void *) &option); |
---|
182 | break; |
---|
183 | } |
---|
184 | |
---|
185 | PGADebugExited("PGASetPrintOptions"); |
---|
186 | } |
---|
187 | |
---|
188 | /*U**************************************************************************** |
---|
189 | PGASetPrintFrequencyValue - Specifies the frequency with which genetic |
---|
190 | algorithm statistics are reported. The default is every 10 GA iterations. |
---|
191 | Used only if PGARun() is used to run the GA. |
---|
192 | |
---|
193 | Category: Reporting |
---|
194 | |
---|
195 | Inputs: |
---|
196 | ctx - context variable |
---|
197 | print_freq - the genetic algorithm population size to use |
---|
198 | |
---|
199 | Outputs: |
---|
200 | None |
---|
201 | |
---|
202 | Example: |
---|
203 | PGAContext *ctx; |
---|
204 | : |
---|
205 | PGASetPrintFrequencyValue(ctx,1); |
---|
206 | |
---|
207 | ****************************************************************************U*/ |
---|
208 | void PGASetPrintFrequencyValue( PGAContext *ctx, int print_freq) |
---|
209 | { |
---|
210 | PGADebugEntered("PGASetPrintFrequencyValue"); |
---|
211 | |
---|
212 | if (print_freq < 0) |
---|
213 | PGAError ( ctx, |
---|
214 | "PGASetPrintFrequencyValue: Invalid value of print_freq:", |
---|
215 | PGA_FATAL, |
---|
216 | PGA_INT, |
---|
217 | (void *) &print_freq); |
---|
218 | else |
---|
219 | ctx->rep.PrintFreq = print_freq; |
---|
220 | |
---|
221 | PGADebugExited("PGASetPrintFrequencyValue"); |
---|
222 | } |
---|
223 | |
---|
224 | /*U*************************************************************************** |
---|
225 | PGAGetPrintFrequencyValue - returns how often to print statistics reports |
---|
226 | |
---|
227 | Category: Reporting |
---|
228 | |
---|
229 | Inputs: |
---|
230 | ctx - context variable |
---|
231 | |
---|
232 | Outputs: |
---|
233 | The frequency of printing output |
---|
234 | |
---|
235 | Example: |
---|
236 | PGAContext *ctx; |
---|
237 | int freq; |
---|
238 | : |
---|
239 | freq = PGAGetPrintFrequencyValue(ctx); |
---|
240 | |
---|
241 | ***************************************************************************U*/ |
---|
242 | int PGAGetPrintFrequencyValue (PGAContext *ctx) |
---|
243 | { |
---|
244 | PGADebugEntered("PGAGetPrintFrequencyValue"); |
---|
245 | PGAFailIfNotSetUp("PGAGetPrintFrequencyValue"); |
---|
246 | |
---|
247 | PGADebugExited("PGAGetPrintFrequencyValue"); |
---|
248 | |
---|
249 | return(ctx->rep.PrintFreq); |
---|
250 | } |
---|
251 | |
---|
252 | /*U**************************************************************************** |
---|
253 | PGAPrintPopulation - Calls PGAPrintIndividual to print each member of a |
---|
254 | population |
---|
255 | |
---|
256 | Category: Reporting |
---|
257 | |
---|
258 | Inputs: |
---|
259 | ctx - context variable |
---|
260 | fp - file pointer to print the output to |
---|
261 | pop - symbolic constant of the population to be printed |
---|
262 | |
---|
263 | Outputs: |
---|
264 | The strings and associated fields that make up a population member are |
---|
265 | printed to fp. |
---|
266 | |
---|
267 | Example: |
---|
268 | PGAContext *ctx; |
---|
269 | : |
---|
270 | PGAPrintPopulation(ctx, stdout, PGA_NEWPOP); |
---|
271 | |
---|
272 | ****************************************************************************U*/ |
---|
273 | void PGAPrintPopulation ( PGAContext *ctx, FILE *fp, int pop ) |
---|
274 | { |
---|
275 | int i; |
---|
276 | |
---|
277 | |
---|
278 | PGADebugEntered("PGAPrintPopulation"); |
---|
279 | |
---|
280 | for ( i=0; i < ctx->ga.PopSize; i++ ) |
---|
281 | PGAPrintIndividual ( ctx, fp, i, pop ); |
---|
282 | fprintf(fp,"\n"); |
---|
283 | |
---|
284 | PGADebugExited("PGAPrintPopulation"); |
---|
285 | } |
---|
286 | |
---|
287 | /*U**************************************************************************** |
---|
288 | PGAPrintIndividual - prints the allele values of a string and associated |
---|
289 | fields (evaluation, fitness, etc.) of a string |
---|
290 | |
---|
291 | Category: Reporting |
---|
292 | |
---|
293 | Inputs: |
---|
294 | ctx - context variable |
---|
295 | fp - file pointer to print the output to |
---|
296 | p - string index |
---|
297 | pop - symbolic constant of the population string p is in |
---|
298 | |
---|
299 | Outputs: |
---|
300 | The allele values of string p and associated fields are printed to fp |
---|
301 | |
---|
302 | Example: |
---|
303 | PGAContext *ctx; |
---|
304 | int p; |
---|
305 | : |
---|
306 | PGAPrintIndividual(ctx, stdout, p, PGA_NEWPOP); |
---|
307 | |
---|
308 | ****************************************************************************U*/ |
---|
309 | void PGAPrintIndividual ( PGAContext *ctx, FILE *fp, int p, int pop ) |
---|
310 | { |
---|
311 | PGAIndividual *ind; |
---|
312 | |
---|
313 | PGADebugEntered("PGAPrintIndividual"); |
---|
314 | |
---|
315 | ind = PGAGetIndividual ( ctx, p, pop ); |
---|
316 | |
---|
317 | fprintf( fp,"%d %e %e ", p, ind->evalfunc, ind->fitness); |
---|
318 | if ( ind->evaluptodate ) |
---|
319 | fprintf( fp, "T\n" ); |
---|
320 | else |
---|
321 | fprintf( fp, "F\n" ); |
---|
322 | PGAPrintString ( ctx, fp, p, pop ); |
---|
323 | |
---|
324 | PGADebugExited("PGAPrintIndividual"); |
---|
325 | } |
---|
326 | |
---|
327 | /*U**************************************************************************** |
---|
328 | PGAPrintString - write the allele values in a string to a file |
---|
329 | |
---|
330 | Category: Reporting |
---|
331 | |
---|
332 | Inputs: |
---|
333 | ctx - context variable |
---|
334 | fp - pointer to file to write the string to |
---|
335 | p - index of the string to write out |
---|
336 | pop - symbolic constant of the population string p is in |
---|
337 | |
---|
338 | Outputs: |
---|
339 | None |
---|
340 | |
---|
341 | Example: |
---|
342 | PGAContext *ctx; |
---|
343 | int p; |
---|
344 | : |
---|
345 | PGAPrintString(ctx, stdout, p, PGA_OLDPOP); |
---|
346 | |
---|
347 | ****************************************************************************U*/ |
---|
348 | void PGAPrintString ( PGAContext *ctx, FILE *file, int p, int pop ) |
---|
349 | { |
---|
350 | int fp; |
---|
351 | |
---|
352 | PGADebugEntered("PGAPrintString"); |
---|
353 | PGADebugPrint( ctx, PGA_DEBUG_PRINTVAR,"PGAPrintString", |
---|
354 | "p = ", PGA_INT, (void *) &p ); |
---|
355 | PGADebugPrint( ctx, PGA_DEBUG_PRINTVAR,"PGAPrintString", |
---|
356 | "pop = ", PGA_INT, (void *) &pop ); |
---|
357 | |
---|
358 | if (ctx->fops.PrintString) { |
---|
359 | fp = ((p == PGA_TEMP1) || (p == PGA_TEMP2)) ? p : p+1; |
---|
360 | (*ctx->fops.PrintString)(&ctx, NULL, &fp, &pop); |
---|
361 | } else { |
---|
362 | (*ctx->cops.PrintString)(ctx, file, p, pop); |
---|
363 | } |
---|
364 | fprintf(file,"\n"); |
---|
365 | |
---|
366 | PGADebugExited("PGAPrintString"); |
---|
367 | } |
---|
368 | |
---|
369 | /*U**************************************************************************** |
---|
370 | PGAPrintContextVariable - prints the value of all the fields in the context |
---|
371 | variable. |
---|
372 | |
---|
373 | Category: Reporting |
---|
374 | |
---|
375 | Inputs: |
---|
376 | ctx - context variable |
---|
377 | fp - file pointer to print the output to |
---|
378 | |
---|
379 | Outputs: |
---|
380 | The value of all the fields in the context variable are printed to fp. |
---|
381 | |
---|
382 | Example: |
---|
383 | PGAContext *ctx; |
---|
384 | : |
---|
385 | PGAPrintContextVariable(ctx, stdout); |
---|
386 | |
---|
387 | ****************************************************************************U*/ |
---|
388 | void PGAPrintContextVariable ( PGAContext *ctx, FILE *fp ) |
---|
389 | { |
---|
390 | PGADebugEntered("PGAPrintContextVariable"); |
---|
391 | |
---|
392 | fprintf( fp,"Algorithm Parameters (Static)\n"); |
---|
393 | |
---|
394 | fprintf( fp," Data type : "); |
---|
395 | switch(ctx->ga.datatype) |
---|
396 | { |
---|
397 | case PGA_DATATYPE_BINARY: |
---|
398 | fprintf( fp,"Binary\n"); |
---|
399 | /*fprintf( fp," Bit Type Total Words : "); |
---|
400 | switch(ctx->ga.tw) |
---|
401 | { |
---|
402 | case PGA_UNINITIALIZED_INT: |
---|
403 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
404 | break; |
---|
405 | default: |
---|
406 | fprintf( fp,"%d\n",ctx->ga.tw); |
---|
407 | break; |
---|
408 | }; |
---|
409 | fprintf( fp," Bit Type Full Words : "); |
---|
410 | switch(ctx->ga.fw) |
---|
411 | { |
---|
412 | case PGA_UNINITIALIZED_INT: |
---|
413 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
414 | break; |
---|
415 | default: |
---|
416 | fprintf( fp,"%d\n",ctx->ga.fw); |
---|
417 | break; |
---|
418 | }; |
---|
419 | fprintf( fp," Bit Type Extra Bits : "); |
---|
420 | switch(ctx->ga.eb) |
---|
421 | { |
---|
422 | case PGA_UNINITIALIZED_INT: |
---|
423 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
424 | break; |
---|
425 | default: |
---|
426 | fprintf( fp,"%d\n",ctx->ga.eb); |
---|
427 | break; |
---|
428 | };*/ |
---|
429 | break; |
---|
430 | case PGA_DATATYPE_INTEGER: |
---|
431 | fprintf( fp,"Integer\n"); |
---|
432 | break; |
---|
433 | case PGA_DATATYPE_REAL: |
---|
434 | fprintf( fp,"Real\n"); |
---|
435 | break; |
---|
436 | case PGA_DATATYPE_CHARACTER: |
---|
437 | fprintf( fp,"Character\n"); |
---|
438 | break; |
---|
439 | case PGA_DATATYPE_USER: |
---|
440 | fprintf( fp,"User Defined\n"); |
---|
441 | break; |
---|
442 | case PGA_UNINITIALIZED_INT: |
---|
443 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
444 | break; |
---|
445 | default: |
---|
446 | fprintf( fp,"!ERROR! =(%d)?\n", ctx->ga.datatype); |
---|
447 | break; |
---|
448 | }; |
---|
449 | |
---|
450 | fprintf( fp," Optimization Direction : "); |
---|
451 | switch(ctx->ga.optdir) |
---|
452 | { |
---|
453 | case PGA_MAXIMIZE: |
---|
454 | fprintf( fp,"Maximize\n"); |
---|
455 | break; |
---|
456 | case PGA_MINIMIZE: |
---|
457 | fprintf( fp,"Minimize\n"); |
---|
458 | break; |
---|
459 | case PGA_UNINITIALIZED_INT: |
---|
460 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
461 | break; |
---|
462 | default: |
---|
463 | fprintf( fp,"!ERROR! =(%d)?\n", ctx->ga.optdir); |
---|
464 | break; |
---|
465 | }; |
---|
466 | |
---|
467 | fprintf( fp," Population Size : "); |
---|
468 | switch(ctx->ga.PopSize) |
---|
469 | { |
---|
470 | case PGA_UNINITIALIZED_INT: |
---|
471 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
472 | break; |
---|
473 | default: |
---|
474 | fprintf( fp,"%d\n",ctx->ga.PopSize); |
---|
475 | break; |
---|
476 | }; |
---|
477 | |
---|
478 | fprintf( fp," String Length : "); |
---|
479 | switch(ctx->ga.StringLen) |
---|
480 | { |
---|
481 | case PGA_UNINITIALIZED_INT: |
---|
482 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
483 | break; |
---|
484 | default: |
---|
485 | fprintf( fp,"%d\n",ctx->ga.StringLen); |
---|
486 | break; |
---|
487 | }; |
---|
488 | |
---|
489 | |
---|
490 | fprintf( fp," Copy to Next Population : "); |
---|
491 | switch(ctx->ga.PopReplace) |
---|
492 | { |
---|
493 | case PGA_POPREPL_BEST: |
---|
494 | fprintf( fp,"Best\n"); |
---|
495 | break; |
---|
496 | case PGA_POPREPL_RANDOM_NOREP: |
---|
497 | fprintf( fp,"Random without replacement\n"); |
---|
498 | break; |
---|
499 | case PGA_POPREPL_RANDOM_REP: |
---|
500 | fprintf( fp,"Random with replacement\n"); |
---|
501 | break; |
---|
502 | case PGA_UNINITIALIZED_INT: |
---|
503 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
504 | break; |
---|
505 | default: |
---|
506 | fprintf( fp,"!ERROR! =(%d)?\n", ctx->ga.PopReplace); |
---|
507 | break; |
---|
508 | }; |
---|
509 | |
---|
510 | |
---|
511 | /*fprintf( fp," Stopping Rule (s) :\n"); |
---|
512 | if ((ctx->ga.StoppingRule & PGA_STOP_MAXITER) == PGA_STOP_MAXITER) |
---|
513 | fprintf(fp, "%50s", "Maximum iterations\n"); |
---|
514 | if ((ctx->ga.StoppingRule & PGA_STOP_NOCHANGE) == PGA_STOP_NOCHANGE) |
---|
515 | fprintf(fp, "%49s", "No change in best\n"); |
---|
516 | if ((ctx->ga.StoppingRule & PGA_STOP_TOOSIMILAR) == PGA_STOP_TOOSIMILAR) |
---|
517 | fprintf(fp, "%54s", "Population Homogeneity\n"); |
---|
518 | if (ctx->ga.StoppingRule == PGA_UNINITIALIZED_INT) |
---|
519 | fprintf(fp, "%47s", "*UNINITIALIZED*\n");*/ |
---|
520 | |
---|
521 | fprintf( fp," Stop: Maximum Iterations : "); |
---|
522 | if ((ctx->ga.StoppingRule & PGA_STOP_MAXITER) == PGA_STOP_MAXITER) |
---|
523 | fprintf( fp,"On\n"); |
---|
524 | else |
---|
525 | fprintf( fp,"Off\n"); |
---|
526 | |
---|
527 | |
---|
528 | fprintf( fp," Maximum Iterations : "); |
---|
529 | switch(ctx->ga.MaxIter) |
---|
530 | { |
---|
531 | case PGA_UNINITIALIZED_INT: |
---|
532 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
533 | break; |
---|
534 | default: |
---|
535 | fprintf( fp,"%d\n",ctx->ga.MaxIter); |
---|
536 | break; |
---|
537 | }; |
---|
538 | |
---|
539 | |
---|
540 | fprintf( fp," Stop: No Change : "); |
---|
541 | if ((ctx->ga.StoppingRule & PGA_STOP_NOCHANGE) == PGA_STOP_NOCHANGE) |
---|
542 | fprintf( fp,"On\n"); |
---|
543 | else |
---|
544 | fprintf( fp,"Off\n"); |
---|
545 | |
---|
546 | |
---|
547 | fprintf(fp, " Max No Change Iterations : "); |
---|
548 | switch(ctx->ga.MaxNoChange) |
---|
549 | { |
---|
550 | case PGA_UNINITIALIZED_INT: |
---|
551 | fprintf(fp, "*UNINITIALIZED*\n"); |
---|
552 | break; |
---|
553 | default: |
---|
554 | fprintf(fp, "%d\n", ctx->ga.MaxNoChange); |
---|
555 | break; |
---|
556 | } |
---|
557 | |
---|
558 | fprintf( fp," Stop: Too Similar : "); |
---|
559 | if ((ctx->ga.StoppingRule & PGA_STOP_TOOSIMILAR) == PGA_STOP_TOOSIMILAR) |
---|
560 | fprintf( fp,"On\n"); |
---|
561 | else |
---|
562 | fprintf( fp,"Off\n"); |
---|
563 | |
---|
564 | fprintf(fp, " Stop: Average Fitness : "); |
---|
565 | if ((ctx->ga.StoppingRule & PGA_STOP_AV_FITNESS) == PGA_STOP_AV_FITNESS){ |
---|
566 | fprintf(fp,"On\n"); |
---|
567 | fprintf(fp,"The target average fitness is %lf and tolerance is %lf\n", ctx->ga.TgtFitnessVal, ctx->ga.FitnessTol); |
---|
568 | }else{ |
---|
569 | fprintf(fp,"Off\n"); |
---|
570 | } |
---|
571 | |
---|
572 | fprintf(fp, " Stop: Best Fitness : "); |
---|
573 | if ((ctx->ga.StoppingRule & PGA_STOP_BEST_FITNESS) == PGA_STOP_BEST_FITNESS){ |
---|
574 | fprintf(fp,"On\n"); |
---|
575 | fprintf(fp,"The target best fitness is %lf and tolerance is %lf\n", ctx->ga.TgtFitnessVal, ctx->ga.FitnessTol); |
---|
576 | }else{ |
---|
577 | fprintf(fp,"Off\n"); |
---|
578 | } |
---|
579 | |
---|
580 | fprintf(fp, " Stop: Fitness Variance : "); |
---|
581 | if ((ctx->ga.StoppingRule & PGA_STOP_VARIANCE) == PGA_STOP_VARIANCE){ |
---|
582 | fprintf(fp,"On\n"); |
---|
583 | fprintf(fp,"The target variance is %lf and tolerance is %lf\n", ctx->ga.TgtFitnessVar, ctx->ga.VarTol); |
---|
584 | }else{ |
---|
585 | fprintf(fp,"Off\n"); |
---|
586 | } |
---|
587 | |
---|
588 | fprintf(fp, " Stop: Time Elapsed : "); |
---|
589 | if ((ctx->ga.StoppingRule & PGA_STOP_TIMEELAPSED) == PGA_STOP_TIMEELAPSED){ |
---|
590 | fprintf(fp,"On\n"); |
---|
591 | fprintf(fp,"The max time for execution is %lf minutes\n", ctx->ga.TgtElapsedTime); |
---|
592 | }else{ |
---|
593 | fprintf(fp,"Off\n"); |
---|
594 | } |
---|
595 | |
---|
596 | fprintf(fp, " Percent Similarity : "); |
---|
597 | switch(ctx->ga.MaxSimilarity) |
---|
598 | { |
---|
599 | case PGA_UNINITIALIZED_INT: |
---|
600 | fprintf(fp, "*UNINITIALIZED*\n"); |
---|
601 | break; |
---|
602 | default: |
---|
603 | fprintf(fp, "%d\n", ctx->ga.MaxSimilarity); |
---|
604 | break; |
---|
605 | } |
---|
606 | |
---|
607 | fprintf( fp," No. Strings Replaced per Iter : "); |
---|
608 | switch(ctx->ga.NumReplace) |
---|
609 | { |
---|
610 | case PGA_UNINITIALIZED_INT: |
---|
611 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
612 | break; |
---|
613 | default: |
---|
614 | fprintf( fp,"%d\n",ctx->ga.NumReplace); |
---|
615 | break; |
---|
616 | }; |
---|
617 | |
---|
618 | |
---|
619 | fprintf( fp," Mutate [And,Or] Crossover : "); |
---|
620 | switch(ctx->ga.MutateOnlyNoCross) |
---|
621 | { |
---|
622 | case PGA_TRUE: |
---|
623 | fprintf( fp,"Or\n"); |
---|
624 | break; |
---|
625 | case PGA_FALSE: |
---|
626 | fprintf( fp,"And\n"); |
---|
627 | break; |
---|
628 | case PGA_UNINITIALIZED_INT: |
---|
629 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
630 | break; |
---|
631 | default: |
---|
632 | fprintf( fp,"!ERROR! =(%d)?\n", ctx->ga.MutateOnlyNoCross); |
---|
633 | break; |
---|
634 | }; |
---|
635 | |
---|
636 | |
---|
637 | fprintf( fp," Crossover Type : "); |
---|
638 | switch(ctx->ga.CrossoverType) |
---|
639 | { |
---|
640 | case PGA_CROSSOVER_ONEPT: |
---|
641 | fprintf( fp,"One Point\n"); |
---|
642 | break; |
---|
643 | case PGA_CROSSOVER_TWOPT: |
---|
644 | fprintf( fp,"Two Point\n"); |
---|
645 | break; |
---|
646 | case PGA_CROSSOVER_UNIFORM: |
---|
647 | fprintf( fp,"Uniform\n"); |
---|
648 | break; |
---|
649 | case PGA_UNINITIALIZED_INT: |
---|
650 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
651 | break; |
---|
652 | default: |
---|
653 | fprintf( fp,"!ERROR! =(%d)?\n", ctx->ga.CrossoverType); |
---|
654 | break; |
---|
655 | }; |
---|
656 | |
---|
657 | |
---|
658 | fprintf( fp," Crossover Probability : "); |
---|
659 | if (ctx->ga.CrossoverProb == PGA_UNINITIALIZED_DOUBLE) |
---|
660 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
661 | else |
---|
662 | fprintf( fp,"%f\n",ctx->ga.CrossoverProb); |
---|
663 | |
---|
664 | |
---|
665 | fprintf( fp," Uniform Crossover Prob. : "); |
---|
666 | if (ctx->ga.UniformCrossProb == PGA_UNINITIALIZED_DOUBLE) |
---|
667 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
668 | else |
---|
669 | fprintf( fp,"%f\n",ctx->ga.UniformCrossProb); |
---|
670 | |
---|
671 | |
---|
672 | fprintf( fp," Mutation Type : "); |
---|
673 | switch(ctx->ga.datatype) |
---|
674 | { |
---|
675 | case PGA_DATATYPE_BINARY: |
---|
676 | fprintf( fp,"Binary\n"); |
---|
677 | break; |
---|
678 | case PGA_DATATYPE_CHARACTER: |
---|
679 | fprintf( fp,"Character\n"); |
---|
680 | break; |
---|
681 | case PGA_DATATYPE_REAL: |
---|
682 | case PGA_DATATYPE_INTEGER: |
---|
683 | switch(ctx->ga.MutationType) |
---|
684 | { |
---|
685 | case PGA_MUTATION_CONSTANT: |
---|
686 | fprintf( fp,"Constant\n"); |
---|
687 | break; |
---|
688 | case PGA_MUTATION_RANGE: |
---|
689 | fprintf( fp,"Range\n"); |
---|
690 | break; |
---|
691 | case PGA_MUTATION_UNIFORM: |
---|
692 | fprintf( fp,"Uniform\n"); |
---|
693 | break; |
---|
694 | case PGA_MUTATION_GAUSSIAN: |
---|
695 | fprintf( fp,"Gaussian\n"); |
---|
696 | break; |
---|
697 | case PGA_MUTATION_PERMUTE: |
---|
698 | fprintf( fp,"Permutation\n"); |
---|
699 | break; |
---|
700 | case PGA_UNINITIALIZED_INT: |
---|
701 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
702 | break; |
---|
703 | default: |
---|
704 | fprintf( fp,"!ERROR! =(%d)?\n", ctx->ga.MutationType); |
---|
705 | break; |
---|
706 | }; |
---|
707 | default: |
---|
708 | break; |
---|
709 | }; |
---|
710 | |
---|
711 | |
---|
712 | fprintf( fp," Mutation Probability : "); |
---|
713 | if (ctx->ga.MutationProb == PGA_UNINITIALIZED_DOUBLE) |
---|
714 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
715 | else |
---|
716 | fprintf( fp,"%f\n",ctx->ga.MutationProb); |
---|
717 | |
---|
718 | |
---|
719 | fprintf( fp," Real Mutation Constant : "); |
---|
720 | if (ctx->ga.MutationProb == PGA_UNINITIALIZED_DOUBLE) |
---|
721 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
722 | else |
---|
723 | fprintf( fp,"%f\n",ctx->ga.MutateRealValue); |
---|
724 | |
---|
725 | |
---|
726 | fprintf(fp, " Integer Mutation Constant : "); |
---|
727 | switch(ctx->ga.MutateIntegerValue) |
---|
728 | { |
---|
729 | case PGA_UNINITIALIZED_INT: |
---|
730 | fprintf(fp, "*UNINITIALIZED*\n"); |
---|
731 | break; |
---|
732 | default: |
---|
733 | fprintf(fp, "%d\n", ctx->ga.MutateIntegerValue); |
---|
734 | break; |
---|
735 | } |
---|
736 | |
---|
737 | |
---|
738 | fprintf( fp," Mutation Range Bounded : "); |
---|
739 | switch(ctx->ga.MutateBoundedFlag) |
---|
740 | { |
---|
741 | case PGA_TRUE: |
---|
742 | fprintf( fp,"On\n"); |
---|
743 | break; |
---|
744 | case PGA_FALSE: |
---|
745 | fprintf( fp,"Off\n"); |
---|
746 | break; |
---|
747 | case PGA_UNINITIALIZED_INT: |
---|
748 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
749 | break; |
---|
750 | default: |
---|
751 | fprintf( fp,"!ERROR! =(%d)?\n", ctx->ga.MutateBoundedFlag); |
---|
752 | break; |
---|
753 | }; |
---|
754 | |
---|
755 | |
---|
756 | fprintf( fp," Selection Type : "); |
---|
757 | switch(ctx->ga.SelectType) |
---|
758 | { |
---|
759 | case PGA_SELECT_PROPORTIONAL: |
---|
760 | fprintf( fp,"Proportional\n"); |
---|
761 | break; |
---|
762 | case PGA_SELECT_SUS: |
---|
763 | fprintf( fp,"Stochastic Universal\n"); |
---|
764 | break; |
---|
765 | case PGA_SELECT_TOURNAMENT: |
---|
766 | fprintf( fp,"Binary Tournament\n"); |
---|
767 | break; |
---|
768 | case PGA_SELECT_PTOURNAMENT: |
---|
769 | fprintf( fp,"Probabilistic Binary Tournament\n"); |
---|
770 | break; |
---|
771 | case PGA_UNINITIALIZED_INT: |
---|
772 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
773 | break; |
---|
774 | default: |
---|
775 | fprintf( fp,"!ERROR! =(%d)?\n", ctx->ga.SelectType); |
---|
776 | break; |
---|
777 | }; |
---|
778 | |
---|
779 | |
---|
780 | fprintf( fp," Tournament Selection Param : "); |
---|
781 | if (ctx->ga.PTournamentProb == PGA_UNINITIALIZED_DOUBLE) |
---|
782 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
783 | else |
---|
784 | fprintf( fp,"%f\n",ctx->ga.PTournamentProb); |
---|
785 | |
---|
786 | |
---|
787 | |
---|
788 | fprintf( fp," Restart Operator : "); |
---|
789 | switch(ctx->ga.restart) |
---|
790 | { |
---|
791 | case PGA_TRUE: |
---|
792 | fprintf( fp,"On\n"); |
---|
793 | break; |
---|
794 | case PGA_FALSE: |
---|
795 | fprintf( fp,"Off\n"); |
---|
796 | break; |
---|
797 | case PGA_UNINITIALIZED_INT: |
---|
798 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
799 | break; |
---|
800 | default: |
---|
801 | fprintf( fp,"!ERROR! =(%d)?\n", ctx->ga.restart); |
---|
802 | break; |
---|
803 | }; |
---|
804 | |
---|
805 | fprintf( fp," Restart Frequency : "); |
---|
806 | switch(ctx->ga.restartFreq) |
---|
807 | { |
---|
808 | case PGA_UNINITIALIZED_INT: |
---|
809 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
810 | break; |
---|
811 | default: |
---|
812 | fprintf( fp,"%d\n",ctx->ga.restartFreq); |
---|
813 | break; |
---|
814 | }; |
---|
815 | |
---|
816 | fprintf( fp," Restart Allele Change Prob : "); |
---|
817 | if (ctx->ga.restartAlleleProb == PGA_UNINITIALIZED_DOUBLE) |
---|
818 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
819 | else |
---|
820 | fprintf( fp,"%f\n",ctx->ga.restartAlleleProb); |
---|
821 | |
---|
822 | |
---|
823 | fprintf( fp," Allow Duplicates : "); |
---|
824 | switch(ctx->ga.NoDuplicates) |
---|
825 | { |
---|
826 | case PGA_TRUE: |
---|
827 | fprintf( fp,"No\n"); |
---|
828 | break; |
---|
829 | case PGA_FALSE: |
---|
830 | fprintf( fp,"Yes\n"); |
---|
831 | break; |
---|
832 | case PGA_UNINITIALIZED_INT: |
---|
833 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
834 | break; |
---|
835 | default: |
---|
836 | fprintf( fp,"!ERROR! =(%d)?\n", ctx->ga.NoDuplicates); |
---|
837 | break; |
---|
838 | }; |
---|
839 | |
---|
840 | |
---|
841 | fprintf( fp," Fitness Type : "); |
---|
842 | switch(ctx->ga.FitnessType) |
---|
843 | { |
---|
844 | case PGA_FITNESS_RAW: |
---|
845 | fprintf( fp,"Raw\n"); |
---|
846 | break; |
---|
847 | case PGA_FITNESS_NORMAL: |
---|
848 | fprintf( fp,"Linear Normalization\n"); |
---|
849 | break; |
---|
850 | case PGA_FITNESS_RANKING: |
---|
851 | fprintf( fp,"Linear Ranking\n"); |
---|
852 | break; |
---|
853 | case PGA_UNINITIALIZED_INT: |
---|
854 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
855 | break; |
---|
856 | default: |
---|
857 | fprintf( fp,"!ERROR! =(%d)?\n", ctx->ga.FitnessType); |
---|
858 | break; |
---|
859 | }; |
---|
860 | |
---|
861 | |
---|
862 | if ( ctx->ga.optdir == PGA_MINIMIZE ) |
---|
863 | { |
---|
864 | fprintf( fp," Fitness Type(Minimization) : "); |
---|
865 | switch(ctx->ga.FitnessMinType) { |
---|
866 | case PGA_FITNESSMIN_RECIPROCAL: |
---|
867 | fprintf( fp,"Reciprocal\n"); |
---|
868 | break; |
---|
869 | case PGA_FITNESSMIN_CMAX: |
---|
870 | fprintf( fp,"CMax\n"); |
---|
871 | break; |
---|
872 | case PGA_UNINITIALIZED_INT: |
---|
873 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
874 | break; |
---|
875 | default: |
---|
876 | fprintf( fp,"!ERROR! =(%d)?\n", ctx->ga.FitnessMinType); |
---|
877 | break; |
---|
878 | }; |
---|
879 | } |
---|
880 | |
---|
881 | |
---|
882 | fprintf( fp," Fitness Ranking Parameter : "); |
---|
883 | if (ctx->ga.FitnessRankMax == PGA_UNINITIALIZED_DOUBLE) |
---|
884 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
885 | else |
---|
886 | fprintf( fp,"%f\n",ctx->ga.FitnessRankMax); |
---|
887 | |
---|
888 | |
---|
889 | fprintf( fp," Fitness CMAX Parameter : "); |
---|
890 | if (ctx->ga.FitnessCmaxValue == PGA_UNINITIALIZED_DOUBLE) |
---|
891 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
892 | else |
---|
893 | fprintf( fp,"%f\n",ctx->ga.FitnessCmaxValue); |
---|
894 | |
---|
895 | |
---|
896 | fprintf( fp,"Algorithm Parameters (Dynamic)\n"); |
---|
897 | |
---|
898 | |
---|
899 | fprintf( fp," Current Generation : "); |
---|
900 | switch(ctx->ga.iter) |
---|
901 | { |
---|
902 | case PGA_UNINITIALIZED_INT: |
---|
903 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
904 | break; |
---|
905 | default: |
---|
906 | fprintf( fp,"%d\n",ctx->ga.iter); |
---|
907 | break; |
---|
908 | }; |
---|
909 | |
---|
910 | fprintf(fp, " Num Iters With No Change : "); |
---|
911 | switch(ctx->ga.ItersOfSame) |
---|
912 | { |
---|
913 | case PGA_UNINITIALIZED_INT: |
---|
914 | fprintf(fp, "*UNINITIALIZED*\n"); |
---|
915 | break; |
---|
916 | default: |
---|
917 | fprintf(fp, "%d\n", ctx->ga.ItersOfSame); |
---|
918 | break; |
---|
919 | } |
---|
920 | |
---|
921 | fprintf(fp, " Percent Similarity In Pop : "); |
---|
922 | switch(ctx->ga.PercentSame) |
---|
923 | { |
---|
924 | case PGA_UNINITIALIZED_INT: |
---|
925 | fprintf(fp, "?UNINITIALZED?\n"); |
---|
926 | break; |
---|
927 | default: |
---|
928 | fprintf(fp, "%d\n", ctx->ga.PercentSame); |
---|
929 | break; |
---|
930 | } |
---|
931 | |
---|
932 | fprintf( fp," Selection Index : "); |
---|
933 | switch(ctx->ga.SelectIndex) |
---|
934 | { |
---|
935 | case PGA_UNINITIALIZED_INT: |
---|
936 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
937 | break; |
---|
938 | default: |
---|
939 | fprintf( fp,"%d\n",ctx->ga.SelectIndex); |
---|
940 | break; |
---|
941 | }; |
---|
942 | |
---|
943 | |
---|
944 | /* initialization */ |
---|
945 | fprintf( fp,"Initialization\n"); |
---|
946 | |
---|
947 | fprintf( fp," Random Initialization : "); |
---|
948 | switch(ctx->init.RandomInit) |
---|
949 | { |
---|
950 | case PGA_TRUE: |
---|
951 | fprintf( fp,"On\n"); |
---|
952 | break; |
---|
953 | case PGA_FALSE: |
---|
954 | fprintf( fp,"Off\n"); |
---|
955 | break; |
---|
956 | case PGA_UNINITIALIZED_INT: |
---|
957 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
958 | break; |
---|
959 | default: |
---|
960 | fprintf( fp,"!ERROR! =(%d)?\n", ctx->init.RandomInit); |
---|
961 | break; |
---|
962 | }; |
---|
963 | |
---|
964 | fprintf( fp," Initialization Binary Prob : "); |
---|
965 | if (ctx->init.BinaryProbability == PGA_UNINITIALIZED_DOUBLE) |
---|
966 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
967 | else |
---|
968 | fprintf( fp,"%f\n",ctx->init.BinaryProbability); |
---|
969 | |
---|
970 | |
---|
971 | fprintf( fp," Initialization Real : "); |
---|
972 | switch(ctx->init.RealType) |
---|
973 | { |
---|
974 | case PGA_RINIT_RANGE: |
---|
975 | fprintf( fp,"Range\n"); |
---|
976 | break; |
---|
977 | case PGA_RINIT_PERCENT: |
---|
978 | fprintf( fp,"Percent Offset\n"); |
---|
979 | break; |
---|
980 | case PGA_UNINITIALIZED_INT: |
---|
981 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
982 | break; |
---|
983 | default: |
---|
984 | fprintf( fp,"!ERROR! =(%d)?\n", ctx->init.RealType); |
---|
985 | break; |
---|
986 | }; |
---|
987 | |
---|
988 | fprintf( fp," Initialization Integer : "); |
---|
989 | switch(ctx->init.IntegerType) |
---|
990 | { |
---|
991 | case PGA_IINIT_RANGE: |
---|
992 | fprintf( fp,"Range\n"); |
---|
993 | break; |
---|
994 | case PGA_IINIT_PERMUTE: |
---|
995 | fprintf( fp,"Permutation\n"); |
---|
996 | break; |
---|
997 | case PGA_UNINITIALIZED_INT: |
---|
998 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
999 | break; |
---|
1000 | default: |
---|
1001 | fprintf( fp,"!ERROR! =(%d)?\n", ctx->init.IntegerType); |
---|
1002 | break; |
---|
1003 | }; |
---|
1004 | |
---|
1005 | fprintf( fp," Initialization Character : "); |
---|
1006 | switch(ctx->init.CharacterType) |
---|
1007 | { |
---|
1008 | case PGA_CINIT_LOWER: |
---|
1009 | fprintf( fp,"Lower Case\n"); |
---|
1010 | break; |
---|
1011 | case PGA_CINIT_UPPER: |
---|
1012 | fprintf( fp,"Upper Case\n"); |
---|
1013 | break; |
---|
1014 | case PGA_CINIT_MIXED: |
---|
1015 | fprintf( fp,"Mixed Case\n"); |
---|
1016 | break; |
---|
1017 | case PGA_UNINITIALIZED_INT: |
---|
1018 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
1019 | break; |
---|
1020 | default: |
---|
1021 | fprintf( fp,"!ERROR! =(%d)?\n", ctx->init.CharacterType); |
---|
1022 | break; |
---|
1023 | }; |
---|
1024 | |
---|
1025 | fprintf( fp," Random Number Seed : "); |
---|
1026 | switch(ctx->init.RandomSeed) |
---|
1027 | { |
---|
1028 | case PGA_UNINITIALIZED_INT: |
---|
1029 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
1030 | break; |
---|
1031 | default: |
---|
1032 | fprintf( fp,"%d\n", ctx->init.RandomSeed); |
---|
1033 | break; |
---|
1034 | }; |
---|
1035 | |
---|
1036 | PGADebugExited("PGAPrintContextVariable"); |
---|
1037 | |
---|
1038 | |
---|
1039 | /* par */ |
---|
1040 | fprintf( fp,"Parallel\n"); |
---|
1041 | |
---|
1042 | fprintf( fp," MPI Library Used : "); |
---|
1043 | switch(ctx->par.MPIStubLibrary) |
---|
1044 | { |
---|
1045 | case PGA_TRUE: |
---|
1046 | fprintf( fp,"Sequential\n"); |
---|
1047 | break; |
---|
1048 | case PGA_FALSE: |
---|
1049 | fprintf( fp,"Parallel\n"); |
---|
1050 | break; |
---|
1051 | default: |
---|
1052 | fprintf( fp,"!ERROR! =(%d)?\n", ctx->par.MPIStubLibrary); |
---|
1053 | break; |
---|
1054 | }; |
---|
1055 | |
---|
1056 | |
---|
1057 | fprintf( fp," MPI Initialized by PGAPack : "); |
---|
1058 | switch(ctx->par.MPIAlreadyInit) |
---|
1059 | { |
---|
1060 | case PGA_TRUE: |
---|
1061 | fprintf( fp,"Yes\n"); |
---|
1062 | break; |
---|
1063 | case PGA_FALSE: |
---|
1064 | fprintf( fp,"No\n"); |
---|
1065 | break; |
---|
1066 | case PGA_UNINITIALIZED_INT: |
---|
1067 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
1068 | break; |
---|
1069 | default: |
---|
1070 | fprintf( fp,"!ERROR! =(%d)?\n", ctx->par.MPIAlreadyInit); |
---|
1071 | break; |
---|
1072 | }; |
---|
1073 | |
---|
1074 | /*fprintf(fp, " Number Islands : "); |
---|
1075 | switch(ctx->par.NumIslands) |
---|
1076 | { |
---|
1077 | case PGA_UNINITIALIZED_INT: |
---|
1078 | fprintf(fp, "*UNINITIALIZED*\n"); |
---|
1079 | break; |
---|
1080 | default: |
---|
1081 | fprintf(fp, "%d\n", ctx->par.NumIslands); |
---|
1082 | break; |
---|
1083 | } |
---|
1084 | |
---|
1085 | fprintf(fp, " Number Demes : "); |
---|
1086 | switch(ctx->par.NumDemes) |
---|
1087 | { |
---|
1088 | case PGA_UNINITIALIZED_INT: |
---|
1089 | fprintf(fp, "*UNINITIALIZED*\n"); |
---|
1090 | break; |
---|
1091 | default: |
---|
1092 | fprintf(fp, "%d\n", ctx->par.NumDemes); |
---|
1093 | break; |
---|
1094 | }*/ |
---|
1095 | |
---|
1096 | fprintf(fp, " Default Communicator : "); |
---|
1097 | if (ctx->par.DefaultComm == NULL) |
---|
1098 | fprintf(fp, "NULL\n"); |
---|
1099 | else if (ctx->par.DefaultComm == MPI_COMM_WORLD) |
---|
1100 | fprintf(fp, "MPI_COMM_WORLD\n"); |
---|
1101 | else |
---|
1102 | fprintf(fp, "User Defined\n"); |
---|
1103 | |
---|
1104 | |
---|
1105 | |
---|
1106 | /* report */ |
---|
1107 | fprintf( fp,"Report\n"); |
---|
1108 | |
---|
1109 | fprintf( fp," Print Frequency : "); |
---|
1110 | switch(ctx->rep.PrintFreq) |
---|
1111 | { |
---|
1112 | case PGA_UNINITIALIZED_INT: |
---|
1113 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
1114 | break; |
---|
1115 | default: |
---|
1116 | fprintf( fp,"%d\n",ctx->rep.PrintFreq); |
---|
1117 | break; |
---|
1118 | }; |
---|
1119 | |
---|
1120 | fprintf( fp," Print Worst Evaluation : "); |
---|
1121 | if ((ctx->rep.PrintOptions & PGA_REPORT_WORST) == PGA_REPORT_WORST) |
---|
1122 | fprintf( fp,"On\n"); |
---|
1123 | else |
---|
1124 | fprintf( fp,"Off\n"); |
---|
1125 | |
---|
1126 | fprintf( fp," Print Average Evaluation : "); |
---|
1127 | if ((ctx->rep.PrintOptions & PGA_REPORT_AVERAGE) == PGA_REPORT_AVERAGE) |
---|
1128 | fprintf( fp,"On\n"); |
---|
1129 | else |
---|
1130 | fprintf( fp,"Off\n"); |
---|
1131 | |
---|
1132 | fprintf( fp," Print Offline Statistics : "); |
---|
1133 | if ((ctx->rep.PrintOptions & PGA_REPORT_OFFLINE) == PGA_REPORT_OFFLINE) |
---|
1134 | fprintf( fp,"On\n"); |
---|
1135 | else |
---|
1136 | fprintf( fp,"Off\n"); |
---|
1137 | |
---|
1138 | fprintf( fp," Print Online Statistics : "); |
---|
1139 | if ((ctx->rep.PrintOptions & PGA_REPORT_ONLINE) == PGA_REPORT_ONLINE) |
---|
1140 | fprintf( fp,"On\n"); |
---|
1141 | else |
---|
1142 | fprintf( fp,"Off\n"); |
---|
1143 | |
---|
1144 | fprintf( fp," Print Hamming Distance : "); |
---|
1145 | if ((ctx->rep.PrintOptions & PGA_REPORT_HAMMING) == PGA_REPORT_HAMMING) |
---|
1146 | fprintf( fp,"On\n"); |
---|
1147 | else |
---|
1148 | fprintf( fp,"Off\n"); |
---|
1149 | |
---|
1150 | /* system */ |
---|
1151 | fprintf( fp,"System\n"); |
---|
1152 | |
---|
1153 | fprintf( fp," Maximum Integer : "); |
---|
1154 | switch(ctx->sys.PGAMaxInt) |
---|
1155 | { |
---|
1156 | case PGA_UNINITIALIZED_INT: |
---|
1157 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
1158 | break; |
---|
1159 | default: |
---|
1160 | fprintf( fp,"%d\n",ctx->sys.PGAMaxInt); |
---|
1161 | break; |
---|
1162 | }; |
---|
1163 | |
---|
1164 | fprintf( fp," Minimum Integer : "); |
---|
1165 | switch(ctx->sys.PGAMinInt) |
---|
1166 | { |
---|
1167 | case PGA_UNINITIALIZED_INT: |
---|
1168 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
1169 | break; |
---|
1170 | default: |
---|
1171 | fprintf( fp,"%d\n",ctx->sys.PGAMinInt); |
---|
1172 | break; |
---|
1173 | }; |
---|
1174 | |
---|
1175 | fprintf( fp," Maximum Double : "); |
---|
1176 | if (ctx->sys.PGAMaxDouble == PGA_UNINITIALIZED_DOUBLE) |
---|
1177 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
1178 | else |
---|
1179 | fprintf( fp,"%e\n",ctx->sys.PGAMaxDouble); |
---|
1180 | |
---|
1181 | fprintf( fp," Minimum Double : "); |
---|
1182 | if (ctx->sys.PGAMinDouble == PGA_UNINITIALIZED_DOUBLE) |
---|
1183 | fprintf( fp,"*UNINITIALIZED*\n"); |
---|
1184 | else |
---|
1185 | fprintf( fp,"%e\n",ctx->sys.PGAMinDouble); |
---|
1186 | |
---|
1187 | |
---|
1188 | |
---|
1189 | /* ops */ |
---|
1190 | fprintf( fp,"Operations\n"); |
---|
1191 | |
---|
1192 | fprintf( fp," CreateString function : "); |
---|
1193 | if (ctx->cops.CreateString == NULL) |
---|
1194 | fprintf( fp,"NULL\n"); |
---|
1195 | else if (ctx->cops.CreateString == PGABinaryCreateString) |
---|
1196 | fprintf( fp,"PGABinaryCreateString\n"); |
---|
1197 | else if (ctx->cops.CreateString == PGAIntegerCreateString) |
---|
1198 | fprintf( fp,"PGAIntegerCreateString\n"); |
---|
1199 | else if (ctx->cops.CreateString == PGARealCreateString) |
---|
1200 | fprintf( fp,"PGARealCreateString\n"); |
---|
1201 | else if (ctx->cops.CreateString == PGACharacterCreateString) |
---|
1202 | fprintf( fp,"PGACharacterCreateString\n"); |
---|
1203 | else |
---|
1204 | fprintf( fp,"C User Defined: %p\n",ctx->cops.CreateString); |
---|
1205 | |
---|
1206 | |
---|
1207 | fprintf( fp," InitString function : "); |
---|
1208 | if (ctx->cops.InitString) { |
---|
1209 | if (ctx->cops.InitString == PGABinaryInitString) |
---|
1210 | fprintf( fp,"PGABinaryInitString\n"); |
---|
1211 | else if (ctx->cops.InitString == PGAIntegerInitString) |
---|
1212 | fprintf( fp,"PGAIntegerInitString\n"); |
---|
1213 | else if (ctx->cops.InitString == PGARealInitString) |
---|
1214 | fprintf( fp,"PGARealInitString\n"); |
---|
1215 | else if (ctx->cops.InitString == PGACharacterInitString) |
---|
1216 | fprintf( fp,"PGACharacterInitString\n"); |
---|
1217 | else |
---|
1218 | fprintf( fp,"C User Defined: %p\n",ctx->cops.InitString); |
---|
1219 | } else { |
---|
1220 | if (ctx->fops.InitString) |
---|
1221 | fprintf( fp,"Fortran User Defined: %p\n",ctx->fops.InitString); |
---|
1222 | else |
---|
1223 | fprintf( fp,"NULL\n"); |
---|
1224 | } |
---|
1225 | |
---|
1226 | |
---|
1227 | fprintf( fp," BuildDatatype function : "); |
---|
1228 | if (ctx->cops.BuildDatatype == NULL) |
---|
1229 | fprintf( fp,"NULL\n"); |
---|
1230 | else if (ctx->cops.BuildDatatype == PGABinaryBuildDatatype) |
---|
1231 | fprintf( fp,"PGABinaryBuildDatatype\n"); |
---|
1232 | else if (ctx->cops.BuildDatatype == PGAIntegerBuildDatatype) |
---|
1233 | fprintf( fp,"PGAIntegerBuildDatatype\n"); |
---|
1234 | else if (ctx->cops.BuildDatatype == PGARealBuildDatatype) |
---|
1235 | fprintf( fp,"PGARealBuildDatatype\n"); |
---|
1236 | else if (ctx->cops.BuildDatatype == PGACharacterBuildDatatype) |
---|
1237 | fprintf( fp,"PGACharacterBuildDatatype\n"); |
---|
1238 | else |
---|
1239 | fprintf( fp,"C User Defined: %p\n",ctx->cops.BuildDatatype); |
---|
1240 | |
---|
1241 | |
---|
1242 | fprintf( fp," Mutation function : "); |
---|
1243 | if (ctx->cops.Mutation) { |
---|
1244 | if (ctx->cops.Mutation == PGABinaryMutation) |
---|
1245 | fprintf( fp,"PGABinaryMutation\n"); |
---|
1246 | else if (ctx->cops.Mutation == PGAIntegerMutation) |
---|
1247 | fprintf( fp,"PGAIntegerMutation\n"); |
---|
1248 | else if (ctx->cops.Mutation == PGARealMutation) |
---|
1249 | fprintf( fp,"PGARealMutation\n"); |
---|
1250 | else if (ctx->cops.Mutation == PGACharacterMutation) |
---|
1251 | fprintf( fp,"PGACharacterMutation\n"); |
---|
1252 | else |
---|
1253 | fprintf( fp,"C User Defined: %p\n",ctx->cops.Mutation); |
---|
1254 | } else { |
---|
1255 | if (ctx->fops.Mutation) |
---|
1256 | fprintf( fp,"Fortran User Defined: %p\n",ctx->fops.Mutation); |
---|
1257 | else |
---|
1258 | fprintf( fp,"NULL\n"); |
---|
1259 | } |
---|
1260 | |
---|
1261 | |
---|
1262 | fprintf( fp," Crossover function : "); |
---|
1263 | if (ctx->cops.Crossover) { |
---|
1264 | if (ctx->cops.Crossover == PGABinaryOneptCrossover) |
---|
1265 | fprintf( fp,"PGABinaryOneptCrossover\n"); |
---|
1266 | else if (ctx->cops.Crossover == PGAIntegerOneptCrossover) |
---|
1267 | fprintf( fp,"PGAIntegerOneptCrossover\n"); |
---|
1268 | else if (ctx->cops.Crossover == PGARealOneptCrossover) |
---|
1269 | fprintf( fp,"PGARealOneptCrossover\n"); |
---|
1270 | else if (ctx->cops.Crossover == PGACharacterOneptCrossover) |
---|
1271 | fprintf( fp,"PGACharacterOneptCrossover\n"); |
---|
1272 | else if (ctx->cops.Crossover == PGABinaryTwoptCrossover) |
---|
1273 | fprintf( fp,"PGABinaryTwoptCrossover\n"); |
---|
1274 | else if (ctx->cops.Crossover == PGAIntegerTwoptCrossover) |
---|
1275 | fprintf( fp,"PGAIntegerTwoptCrossover\n"); |
---|
1276 | else if (ctx->cops.Crossover == PGARealTwoptCrossover) |
---|
1277 | fprintf( fp,"PGARealTwoptCrossover\n"); |
---|
1278 | else if (ctx->cops.Crossover == PGACharacterTwoptCrossover) |
---|
1279 | fprintf( fp,"PGACharacterTwoptCrossover\n"); |
---|
1280 | else if (ctx->cops.Crossover == PGABinaryUniformCrossover) |
---|
1281 | fprintf( fp,"PGABinarytUniformCrossover\n"); |
---|
1282 | else if (ctx->cops.Crossover == PGAIntegerUniformCrossover) |
---|
1283 | fprintf( fp,"PGAIntegerUniformCrossover\n"); |
---|
1284 | else if (ctx->cops.Crossover == PGARealUniformCrossover) |
---|
1285 | fprintf( fp,"PGARealUniformCrossover\n"); |
---|
1286 | else if (ctx->cops.Crossover == PGACharacterUniformCrossover) |
---|
1287 | fprintf( fp,"PGACharacterUniformCrossover\n"); |
---|
1288 | else |
---|
1289 | fprintf( fp,"C User Defined: %p\n",ctx->cops.Crossover); |
---|
1290 | } else { |
---|
1291 | if (ctx->fops.Crossover) |
---|
1292 | fprintf( fp,"Fortran User Defined: %p\n",ctx->fops.Crossover); |
---|
1293 | else |
---|
1294 | fprintf( fp,"NULL\n"); |
---|
1295 | } |
---|
1296 | |
---|
1297 | |
---|
1298 | fprintf( fp," PrintString function : "); |
---|
1299 | if (ctx->cops.PrintString) { |
---|
1300 | if (ctx->cops.PrintString == PGABinaryPrintString) |
---|
1301 | fprintf( fp,"PGABinaryPrintString\n"); |
---|
1302 | else if (ctx->cops.PrintString == PGAIntegerPrintString) |
---|
1303 | fprintf( fp,"PGAIntegerPrintString\n"); |
---|
1304 | else if (ctx->cops.PrintString == PGARealPrintString) |
---|
1305 | fprintf( fp,"PGARealPrintString\n"); |
---|
1306 | else if (ctx->cops.PrintString == PGACharacterPrintString) |
---|
1307 | fprintf( fp,"PGACharacterPrintString\n"); |
---|
1308 | else |
---|
1309 | fprintf( fp,"C User Defined: %p\n",ctx->cops.PrintString); |
---|
1310 | } else { |
---|
1311 | if (ctx->fops.PrintString) |
---|
1312 | fprintf( fp,"Fortran User Defined: %p\n",ctx->fops.PrintString); |
---|
1313 | else |
---|
1314 | fprintf( fp,"NULL\n"); |
---|
1315 | } |
---|
1316 | |
---|
1317 | |
---|
1318 | fprintf( fp," CopyString function : "); |
---|
1319 | if (ctx->cops.CopyString) { |
---|
1320 | if (ctx->cops.CopyString == PGABinaryCopyString) |
---|
1321 | fprintf( fp,"PGABinaryCopyString\n"); |
---|
1322 | else if (ctx->cops.CopyString == PGAIntegerCopyString) |
---|
1323 | fprintf( fp,"PGAIntegerCopyString\n"); |
---|
1324 | else if (ctx->cops.CopyString == PGARealCopyString) |
---|
1325 | fprintf( fp,"PGARealCopyString\n"); |
---|
1326 | else if (ctx->cops.CopyString == PGACharacterCopyString) |
---|
1327 | fprintf( fp,"PGACharacterCopyString\n"); |
---|
1328 | else |
---|
1329 | fprintf( fp,"C User Defined: %p\n",ctx->cops.CopyString); |
---|
1330 | } else { |
---|
1331 | if (ctx->cops.CopyString) |
---|
1332 | fprintf( fp,"Fortran User Defined: %p\n",ctx->fops.CopyString); |
---|
1333 | else |
---|
1334 | fprintf( fp,"NULL\n"); |
---|
1335 | } |
---|
1336 | |
---|
1337 | |
---|
1338 | fprintf( fp," Duplicate function : "); |
---|
1339 | if (ctx->cops.Duplicate) { |
---|
1340 | if (ctx->cops.Duplicate == PGABinaryDuplicate) |
---|
1341 | fprintf( fp,"PGABinaryDuplicate\n"); |
---|
1342 | else if (ctx->cops.Duplicate == PGAIntegerDuplicate) |
---|
1343 | fprintf( fp,"PGAIntegerDuplicate\n"); |
---|
1344 | else if (ctx->cops.Duplicate == PGARealDuplicate) |
---|
1345 | fprintf( fp,"PGARealDuplicate\n"); |
---|
1346 | else if (ctx->cops.Duplicate == PGACharacterDuplicate) |
---|
1347 | fprintf( fp,"PGACharacterDuplicate\n"); |
---|
1348 | else |
---|
1349 | fprintf( fp,"C User Defined: %p\n",ctx->cops.Duplicate); |
---|
1350 | } else { |
---|
1351 | if (ctx->fops.Duplicate) |
---|
1352 | fprintf( fp,"Fortran User Defined: %p\n",ctx->fops.Duplicate); |
---|
1353 | else |
---|
1354 | fprintf( fp,"NULL\n"); |
---|
1355 | } |
---|
1356 | |
---|
1357 | |
---|
1358 | fprintf( fp," Stopping function : "); |
---|
1359 | if (ctx->cops.StopCond) |
---|
1360 | fprintf( fp,"C User Defined: %p\n",ctx->cops.StopCond); |
---|
1361 | else |
---|
1362 | if (ctx->fops.StopCond) |
---|
1363 | fprintf( fp,"Fortran User Defined: %p\n",ctx->fops.StopCond); |
---|
1364 | else |
---|
1365 | fprintf( fp,"PGACheckStoppingConditions\n"); |
---|
1366 | |
---|
1367 | |
---|
1368 | fprintf( fp," End of Generation function : "); |
---|
1369 | if (ctx->cops.EndOfGen) |
---|
1370 | fprintf( fp,"C User Defined: %p\n",ctx->cops.EndOfGen); |
---|
1371 | else |
---|
1372 | if (ctx->cops.EndOfGen) |
---|
1373 | fprintf( fp,"Fortran User Defined: %p\n",ctx->fops.EndOfGen); |
---|
1374 | else |
---|
1375 | fprintf( fp,"NULL\n"); |
---|
1376 | |
---|
1377 | |
---|
1378 | } |
---|