1 /*
2 COPYRIGHT
3
4 The following is a notice of limited availability of the code, and disclaimer
5 which must be included in the prologue of the code and in all source listings
6 of the code.
7
8 (C) COPYRIGHT 2008 University of Chicago
9
10 Permission is hereby granted to use, reproduce, prepare derivative works, and
11 to redistribute to others. This software was authored by:
12
13 D. Levine
14 Mathematics and Computer Science Division
15 Argonne National Laboratory Group
16
17 with programming assistance of participants in Argonne National
18 Laboratory's SERS program.
19
20 GOVERNMENT LICENSE
21
22 Portions of this material resulted from work developed under a
23 U.S. Government Contract and are subject to the following license: the
24 Government is granted for itself and others acting on its behalf a paid-up,
25 nonexclusive, irrevocable worldwide license in this computer software to
26 reproduce, prepare derivative works, and perform publicly and display
27 publicly.
28
29 DISCLAIMER
30
31 This computer code material was prepared, in part, as an account of work
32 sponsored by an agency of the United States Government. Neither the United
33 States, nor the University of Chicago, nor any of their employees, makes any
34 warranty express or implied, or assumes any legal liability or responsibility
35 for the accuracy, completeness, or usefulness of any information, apparatus,
36 product, or process disclosed, or represents that its use would not infringe
37 privately owned rights.
38 */
39
40 /*****************************************************************************
41 * FILE: debug.c: This file contains routines for debugging
42 *
43 * Authors: David M. Levine, Philip L. Hallstrom, David M. Noelle,
44 * Brian P. Walenz
45 ******************************************************************************/
46
47 #include "pgapack.h"
48
49 /******************************************************************************
50 We need two numbering schemes:
51
52 (1) A list of debug levels (numbers) the user types to get certain types
53 of prints
54 (2) A unique integer debug value for each routine
55
56 The way this works is that the user specified debug level, which we
57 arbitrarily restrict to be an integer between 1--100, is mapped to a
58 set of actual debug values which are in the range of 101--inf
59
60 Note that the set of debuglevels we define for the user are between 0--100,
61 and that all *real* values for a routine (each routine has a debug value
62 associated with it) are > 100 and < PGA_DEBUG_NUMFLAGS
63
64 0 Trace all debug prints
65
66 1 Reserved for the user
67 : :
68 10 Reserved for the user
69 11 Trace high-level functions
70 12 Trace all function entries
71 13 Trace all function exits
72
73 20 Trace high-level parallel functions
74 21 Trace all parallel functions
75 22 Trace all send calls (PGA_DEBUG_SEND)
76 23 Trace all receive calls (PGA_DEBUG_RECV)
77
78 30 Trace BINARY functions
79 32 Trace INTEGER functions
80 34 Trace REAL functions
81 36 Trace CHARACTER functions
82
83 40 Trace population creation functions
84 42 Trace select functions
85 44 Trace mutation functions
86 46 Trace crossover functions
87 48 Trace function evaluation functions
88 50 Trace fitness calculation functions
89 52 Trace duplicate checking functions
90 54 Trace restart functions
91 56 Trace reporting functions
92 58 Trace stopping functions
93 60 Trace sorting functions
94 62 Trace random number functions
95 64 Trace system routines
96 66 Trace utility functions
97
98 80 Trace memory allocations
99 82 Trace variable print statements
100 ******************************************************************************/
101
102 #if OPTIMIZE==0
103 typedef struct
104 {
105 char PGAFuncName[36];
106 int PGAFuncNum;
107 } PGAFuncRec;
108
109 int PGANumFcns;
110
111 PGAFuncRec PGAFuncIndex[PGA_DEBUG_MAXPGAPACKFUNCTIONS] =
112 {
113 /* Binary Routines 100 - 149 */
114 { "PGABinaryCreateString", 100 },
115 { "PGABinaryMutation", 101 },
116 { "PGABinaryOneptCrossover", 102 },
117 { "PGABinaryTwoptCrossover", 103 },
118 { "PGABinaryUniformCrossover", 104 },
119 { "PGABinaryPrintString", 105 },
120 { "PGABinaryCopyString", 106 },
121 { "PGABinaryDuplicate", 107 },
122 { "PGABinaryInitString", 108 },
123 { "PGABinaryBuildDatatype", 109 },
124 { "PGASetBinaryAllele", 110 },
125 { "PGAGetBinaryAllele", 111 },
126 { "PGABinaryHammingDistance", 120 },
127 { "PGABinaryPrint", 121 },
128 { "PGAGetBinaryInitProb", 122 },
129 { "PGASetBinaryInitProb", 123 },
130
131 /* Integer Routines 150 - 199 */
132 { "PGAIntegerCreateString", 150 },
133 { "PGAIntegerMutation", 151 },
134 { "PGAIntegerOneptCrossover", 152 },
135 { "PGAIntegerTwoptCrossover", 153 },
136 { "PGAIntegerUniformCrossover", 154 },
137 { "PGAIntegerPrintString", 155 },
138 { "PGAIntegerCopyString", 156 },
139 { "PGAIntegerDuplicate", 157 },
140 { "PGAIntegerInitString", 158 },
141 { "PGAIntegerBuildDatatype", 159 },
142 { "PGASetIntegerAllele", 160 },
143 { "PGAGetIntegerAllele", 161 },
144 { "PGASetIntegerInitPermute", 170 },
145 { "PGASetIntegerInitRange", 171 },
146 { "PGAGetIntegerInitType", 172 },
147 { "PGAGetMinIntegerInitValue", 173 },
148 { "PGAGetMaxIntegerInitValue", 174 },
149
150 /* Real Routines 200 - 249 */
151 { "PGARealCreateString", 200 },
152 { "PGARealMutation", 201 },
153 { "PGARealOneptCrossover", 202 },
154 { "PGARealTwoptCrossover", 203 },
155 { "PGARealUniformCrossover", 204 },
156 { "PGARealPrintString", 205 },
157 { "PGARealCopyString", 206 },
158 { "PGARealDuplicate", 207 },
159 { "PGARealInitString", 208 },
160 { "PGARealBuildDatatype", 209 },
161 { "PGASetRealAllele", 210 },
162 { "PGAGetRealAllele", 211 },
163 { "PGASetRealInitPercent", 220 },
164 { "PGASetRealInitRange", 221 },
165 { "PGAGetMinRealInitValue", 222 },
166 { "PGAGetMaxRealInitValue", 223 },
167
168 /* Character Routines 250 - 299 */
169 { "PGACharacterCreateString", 250 },
170 { "PGACharacterMutation", 251 },
171 { "PGACharacterOneptCrossover", 252 },
172 { "PGACharacterTwoptCrossover", 253 },
173 { "PGACharacterUniformCrossover", 254 },
174 { "PGACharacterPrintString", 255 },
175 { "PGACharacterCopyString", 256 },
176 { "PGACharacterDuplicate", 257 },
177 { "PGACharacterInitString", 258 },
178 { "PGACharacterBuildDatatype", 259 },
179 { "PGASetCharacterAllele", 260 },
180 { "PGAGetCharacterAllele", 261 },
181 { "PGASetCharacterInitType", 270 },
182
183 /* Operators Routines 300 - 499 */
184 /* create.c */
185 { "PGACreate", 300 },
186 { "PGASetUp", 301 },
187 { "PGACreatePop", 302 },
188 { "PGACreateIndividual", 303 },
189 { "PGAGetRandomInitFlag", 304 },
190 { "PGASetRandomInitFlag", 305 },
191
192 /* cross.c */
193 { "PGACrossover", 310 },
194 { "PGAGetCrossoverType", 311 },
195 { "PGAGetCrossoverProb", 312 },
196 { "PGAGetUniformCrossoverProb", 313 },
197 { "PGASetCrossoverType", 314 },
198 { "PGASetCrossoverProb", 315 },
199 { "PGASetUniformCrossoverProb", 316 },
200
201 /* pop.c */
202 { "PGASortPop", 320 },
203 { "PGAGetPopSize", 321 },
204 { "PGAGetNumReplaceValue", 322 },
205 { "PGAGetPopReplaceType", 323 },
206 { "PGAGetSortedPopIndex", 324 },
207 { "PGASetPopSize", 325 },
208 { "PGASetNumReplaceValue", 326 },
209 { "PGASetPopReplaceType", 327 },
210
211 /* mutation.c */
212 { "PGAMutate", 330 },
213 { "PGAGetMutationType", 331 },
214 { "PGAGetMutationRealValue", 332 },
215 { "PGAGetMutationIntegerValue", 333 },
216 { "PGAGetMutationProb", 334 },
217 { "PGASetMutationType", 335 },
218 { "PGASetMutationRealValue", 336 },
219 { "PGASetMutationIntegerValue", 337 },
220 { "PGASetMutationProb", 338 },
221 { "PGASetMutationBoundedFlag", 400 }, /* 400--499 */
222 { "PGAGetMutationBoundedFlag", 401 }, /* 400--499 */
223
224 /* duplcate.c */
225 { "PGADuplicate", 340 },
226 { "PGAChange", 341 },
227 { "PGASetNoDuplicatesFlag", 342 },
228 { "PGAGetNoDuplicatesFlag", 343 },
229
230 /* pga.c */
231 { "PGARunMutationAndCrossover", 350 },
232 { "PGARunMutationOrCrossover", 351 },
233 { "PGAUpdateGeneration", 352 },
234 { "PGAGetDataType", 353 },
235 { "PGAGetOptDirFlag", 354 },
236 { "PGAGetStringLength", 355 },
237 { "PGAGetGAIterValue", 356 },
238 { "PGAGetMutationOrCrossoverFlag", 357 },
239 { "PGAGetMutationAndCrossoverFlag", 358 },
240 { "PGASetMutationOrCrossoverFlag", 359 },
241 { "PGASetMutationAndCrossoverFlag", 360 },
242 { "PGARun", 361 },
243
244 /* restart.c */
245 { "PGARestart", 370 },
246 { "PGAGetRestartFlag", 371 },
247 { "PGAGetRestartFrequencyValue", 372 },
248 { "PGAGetRestartAlleleChangeProb", 373 },
249 { "PGASetRestartFlag", 374 },
250 { "PGASetRestartFrequencyValue", 375 },
251 { "PGASetRestartAlleleChangeProb", 376 },
252
253 /* select.c */
254 { "PGASelect", 380 },
255 { "PGASelectProportional", 381 },
256 { "PGASelectSUS", 382 },
257 { "PGASelectTournament", 383 },
258 { "PGASelectPTournament", 384 },
259 { "PGASelectNextIndex", 385 },
260 { "PGAGetSelectType", 386 },
261 { "PGAGetPTournamentProb", 387 },
262 { "PGASetSelectType", 388 },
263 { "PGASetPTournamentProb", 389 },
264
265 /* stop.c */
266 { "PGAGetStoppingRuleType", 390 },
267 { "PGASetStoppingRuleType", 391 },
268 { "PGAGetMaxGAIterValue", 392 },
269 { "PGASetMaxGAIterValue", 393 },
270 { "PGACheckStoppingConditions", 394 },
271 { "PGASetMaxNoChangeValue", 395 },
272 { "PGASetMaxSimilarityValue", 396 },
273 { "PGADone", 397 },
274
275 /* Fitness and Evaluation Routines 500 - 599 */
276 /* evaluate.c */
277 { "PGAGetRealFromBinary", 500 },
278 { "PGAGetRealFromGrayCode", 501 },
279 { "PGAEncodeRealAsBinary", 502 },
280 { "PGAEncodeRealAsGrayCode", 503 },
281 { "PGAMapIntegerToReal", 504 },
282 { "PGAMapRealToInteger", 505 },
283 { "PGAEncodeIntegerAsBinary", 506 },
284 { "PGAEncodeIntegerAsGrayCode", 507 },
285 { "PGAGetIntegerFromBinary", 508 },
286 { "PGAGetIntegerFromGrayCode", 509 },
287 { "PGAEvaluate", 510 },
288 { "PGAEvaluateSeq", 515 },
289 { "PGAEvaluateCoop", 516 },
290 { "PGAEvaluateSlave", 517 },
291 { "PGASetEvaluation", 511 },
292 { "PGASetEvaluationUpToDateFlag", 512 },
293 { "PGAGetEvaluation", 513 },
294 { "PGAGetEvaluationUpToDateFlag", 514 },
295
296 /* fitness.c */
297 { "PGAFitness", 520 },
298 { "PGAFitnessLinearNormal", 521 },
299 { "PGAFitnessLinearRank", 522 },
300 { "PGAFitnessMinReciprocal", 523 },
301 { "PGAFitnessMinCmax", 524 },
302 { "PGARank", 525 },
303 { "PGAGetFitness", 526 },
304 { "PGAGetFitnessType", 527 },
305 { "PGAGetFitnessMinType", 528 },
306 { "PGAGetMaxFitnessRank", 529 },
307 { "PGASetFitnessType", 530 },
308 { "PGASetFitnessMinType", 531 },
309 { "PGASetMaxFitnessRank", 532 },
310 { "PGASetFitnessCmaxValue", 533 },
311 { "PGAGetFitnessCmaxValue", 534 },
312
313 /* Parallel Routines 600 - 699 */
314 { "PGABuildDatatype", 600 },
315 { "PGASendIndividual", 601 },
316 { "PGAReceiveIndividual", 602 },
317 { "PGASendReceiveIndividual", 603 },
318 { "PGAEvaluateMS", 605 },
319 { "PGAGetRank", 607 },
320 { "PGAGetNumProcs", 608 },
321 { "PGASetCommunicator", 609 },
322 { "PGAGetCommunicator", 610 },
323 { "PGASetNumIslands", 611 },
324 { "PGAGetNumIslands", 612 },
325 { "PGASetNumDemes", 613 },
326 { "PGAGetNumDemes", 614 },
327 { "PGARunGM", 615 },
328 { "PGARunIM", 616 },
329 { "PGARunNM", 617 },
330
331 /* System and Utility 700 - 799 */
332 /* system.c */
333 { "PGAError", 700 },
334 { "PGAUsage", 702 },
335 { "PGAPrintVersionNumber", 703 },
336 { "PGAGetMaxMachineIntValue", 704 },
337 { "PGAGetMinMachineIntValue", 705 },
338 { "PGAGetMaxMachineDoubleValue", 706 },
339 { "PGAGetMinMachineDoubleValue", 707 },
340 { "PGADestroy", 708 },
341
342 /* utility.c */
343 { "PGAMean", 710 },
344 { "PGAStddev", 711 },
345 { "PGACopyIndividual", 712 },
346 { "PGARound", 713 },
347 { "PGACheckSum", 714 },
348 { "PGAGetWorstIndex", 715 },
349 { "PGAGetBestIndex", 716 },
350 { "PGAGetIndividual", 717 },
351 { "PGAUpdateAverage", 718 },
352 { "PGAUpdateOnline", 719 },
353 { "PGAUpdateOffline", 720 },
354 { "PGAComputeSimilarity", 721 },
355
356 /* cmdline.c */
357 { "PGAReadCmdLine", 730 },
358 { "PGAParseDebugArg", 731 },
359 { "PGAStripArgs", 732 },
360
361 /* debug.c */
362 { "PGADebugPrint", 740 },
363 { "PGAGetDebugFlag", 741 },
364 { "PGAPrintDebugOptions", 743 },
365 { "PGASetDebugLevel", 744 },
366
367 /* random.c */
368 { "PGARandomFlip", 750 },
369 { "PGARandomInterval", 751 },
370 { "PGARandom01", 752 },
371 { "PGARandomUniform", 753 },
372 { "PGARandomGaussian", 754 },
373 { "PGAGetRandomSeed", 755 },
374 { "PGASetRandomSeed", 756 },
375
376 /* Miscellaneous Routines 800 - 899 */
377 /* hamming.c */
378 { "PGAHammingDistance", 800 },
379
380 /* heap.c */
381 { "PGADblHeapSort", 810 },
382 { "PGADblHeapify", 811 },
383 { "PGADblAdjustHeap", 812 },
384 { "PGAIntHeapSort", 813 },
385 { "PGAIntHeapify", 814 },
386 { "PGAIntAdjustHeap", 815 },
387
388 /* report.c */
389 { "PGAPrintPopulation", 820 },
390 { "PGAPrintIndividual", 821 },
391 { "PGAPrintReport", 822 },
392 { "PGAPrintContextVariable", 823 },
393 { "PGAPrintString", 824 },
394 { "PGAGetPrintFrequencyValue", 825 },
395 { "PGASetPrintFrequencyValue", 826 },
396 { "PGASetPrintOptions", 827 },
397
398 /* user.c */
399 { "PGASetUserFunction", 830 }
400 };
401
402
403 /*I****************************************************************************
404 PGASortDebugIndex - Sort the index of function names alphabetically.
405
406 Inputs:
407
408 Output:
409
410 Example:
411
412 ****************************************************************************I*/
PGASortFuncNameIndex(PGAContext * ctx)413 void PGASortFuncNameIndex(PGAContext *ctx)
414 {
415
416 /* See how many functions are in the index */
417 for (PGANumFcns=0; PGAFuncIndex[PGANumFcns].PGAFuncName[0]; PGANumFcns++) ;
418
419 qsort(PGAFuncIndex, PGANumFcns, sizeof(PGAFuncRec),
420 (int (*) (const void *, const void *)) &strcmp);
421 }
422
423
424 /*U****************************************************************************
425 PGADebugPrint - Write debugging information
426
427 Category: Debugging
428
429 Inputs:
430 ctx - context variable
431 level - a symbolic constant that maps to the type of print requested
432 (e.g., an entry or exit print). Valid values are
433 PGA_DEBUG_ENTERED, PGA_DEBUG_EXIT, PGA_DEBUG_MALLOC,
434 PGA_DEBUG_PRINTVAR, PGA_DEBUG_SEND, and PGA_DEBUG_RECV.
435 funcname - the name of the function that called this routine
436 msg - message to print
437 datatype - a symbolic constant that maps to the data type of the
438 parameter data. Valid choices are PGA_INT, PGA_DOUBLE,
439 PGA_CHAR and PGA_VOID (no data).
440 data - a pointer, whose contents will be interpreted based upon the
441 datatype parameter (or NULL, if PGA_VOID).
442
443 Outputs:
444 The debugging information is printed to stderr.
445
446 Example:
447 If the debugging level includes printing variables (level 82), print the
448 value of the integer variable num as a debugging tool in the routine
449 Add2Nums
450
451 PGAContext *ctx;
452 int num;
453 :
454 PGADebugPrint(ctx, PGA_DEBUG_PRINTVAR, "Add2Nums", "num = ", PGA_INT,
455 (void *) &num);
456
457 ****************************************************************************U*/
PGADebugPrint(PGAContext * ctx,int level,char * funcname,char * msg,int datatype,void * data)458 void PGADebugPrint( PGAContext *ctx, int level, char *funcname,
459 char *msg, int datatype, void *data )
460 {
461 int rank;
462
463 /* Added check if level > 10 so that PGAGetDebugFlag is only called
464 * if it is _not_ a user debug level.
465 */
466
467 if (ctx->debug.PGADebugFlags[0] ||
468 ctx->debug.PGADebugFlags[level] ||
469 ((level > 10) && PGAGetDebugFlag (ctx, funcname)))
470 {
471 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
472 switch (datatype)
473 {
474 case PGA_VOID:
475 fprintf(stdout, "%4d: %-32s: %s\n", rank, funcname, msg);
476 break;
477 case PGA_INT:
478 switch (*(int *) data)
479 {
480 case PGA_TEMP1:
481 fprintf(stdout, "%4d: %-32s: %s PGA_TEMP1\n", rank,
482 funcname, msg);
483 break;
484 case PGA_TEMP2:
485 fprintf(stdout, "%4d: %-32s: %s PGA_TEMP2\n", rank,
486 funcname, msg);
487 break;
488 case PGA_OLDPOP:
489 fprintf(stdout, "%4d: %-32s: %s PGA_OLDPOP\n", rank,
490 funcname, msg);
491 break;
492 case PGA_NEWPOP:
493 fprintf(stdout, "%4d: %-32s: %s PGA_NEWPOP\n", rank,
494 funcname, msg);
495 break;
496 default:
497 fprintf(stdout, "%4d: %-32s: %s %d\n", rank, funcname, msg,
498 *(int *) data);
499 break;
500 }
501 break;
502 case PGA_DOUBLE:
503 fprintf(stdout, "%4d: %-32s: %s %e\n", rank,
504 funcname, msg, *(double *) data);
505 break;
506 case PGA_CHAR:
507 fprintf(stdout, "%4d: %-32s: %s %s\n", rank,
508 funcname, msg, (char *) data);
509 break;
510 default:
511 fprintf(stderr, "PGADebugPrint: Invalid value of datatype: %d",
512 datatype);
513 exit(-1);
514 break;
515 }
516 }
517 }
518
519 /*U****************************************************************************
520 PGASetDebugLevel - Turn on a debug level. Only valid if PGAPack
521 was compiled to include debugging calls. See the user guide for details.
522
523 Category: Debugging
524
525 Inputs:
526 ctx - context variable
527 level - the debug level to set to PGA_TRUE.
528
529 Outputs:
530 None
531
532 Example:
533 PGAContext *ctx;
534 :
535 PGASetDebugLevel(ctx, 70)
536
537 ****************************************************************************U*/
PGASetDebugLevel(PGAContext * ctx,int level)538 void PGASetDebugLevel(PGAContext *ctx, int level)
539 {
540 if ((level < 11) || (level > 100)) {
541 ctx->debug.PGADebugFlags[level] = PGA_TRUE;
542 } else {
543 /* Call the appropriate routine to clear the set of levels. */
544 switch (level) {
545 case 11: PGASetDebugFlag11(ctx, PGA_TRUE); break;
546 case 20: PGASetDebugFlag20(ctx, PGA_TRUE); break;
547 case 21: PGASetDebugFlag21(ctx, PGA_TRUE); break;
548 case 30: PGASetDebugFlag30(ctx, PGA_TRUE); break;
549 case 32: PGASetDebugFlag32(ctx, PGA_TRUE); break;
550 case 34: PGASetDebugFlag34(ctx, PGA_TRUE); break;
551 case 36: PGASetDebugFlag36(ctx, PGA_TRUE); break;
552 case 40: PGASetDebugFlag40(ctx, PGA_TRUE); break;
553 case 42: PGASetDebugFlag42(ctx, PGA_TRUE); break;
554 case 44: PGASetDebugFlag44(ctx, PGA_TRUE); break;
555 case 46: PGASetDebugFlag46(ctx, PGA_TRUE); break;
556 case 48: PGASetDebugFlag48(ctx, PGA_TRUE); break;
557 case 50: PGASetDebugFlag50(ctx, PGA_TRUE); break;
558 case 52: PGASetDebugFlag52(ctx, PGA_TRUE); break;
559 case 54: PGASetDebugFlag54(ctx, PGA_TRUE); break;
560 case 56: PGASetDebugFlag56(ctx, PGA_TRUE); break;
561 case 58: PGASetDebugFlag58(ctx, PGA_TRUE); break;
562 case 60: PGASetDebugFlag60(ctx, PGA_TRUE); break;
563 case 62: PGASetDebugFlag62(ctx, PGA_TRUE); break;
564 case 64: PGASetDebugFlag64(ctx, PGA_TRUE); break;
565 case 66: PGASetDebugFlag66(ctx, PGA_TRUE); break;
566 }
567 }
568 }
569
570 /*U****************************************************************************
571 PGAClearDebugLevel - Turn off a debul level. Only valid if PGAPack
572 was compiled to include debugging calls. See the user guide for details.
573
574 Category: Debugging
575
576 Inputs:
577 ctx - context variable
578 level - the debug level to set to PGA_FALSE.
579
580 Outputs:
581 None
582
583 Example:
584 PGAContext *ctx;
585 :
586 PGAClearDebugLevel(ctx, 70)
587
588 ****************************************************************************U*/
PGAClearDebugLevel(PGAContext * ctx,int level)589 void PGAClearDebugLevel(PGAContext *ctx, int level)
590 {
591 if ((level < 11) || (level > 100)) {
592 ctx->debug.PGADebugFlags[level] = PGA_FALSE;
593 } else {
594 /* Call the appropriate routine to clear the set of levels. */
595 switch (level) {
596 case 11: PGASetDebugFlag11(ctx, PGA_FALSE); break;
597 case 20: PGASetDebugFlag20(ctx, PGA_FALSE); break;
598 case 21: PGASetDebugFlag21(ctx, PGA_FALSE); break;
599 case 30: PGASetDebugFlag30(ctx, PGA_FALSE); break;
600 case 32: PGASetDebugFlag32(ctx, PGA_FALSE); break;
601 case 34: PGASetDebugFlag34(ctx, PGA_FALSE); break;
602 case 36: PGASetDebugFlag36(ctx, PGA_FALSE); break;
603 case 40: PGASetDebugFlag40(ctx, PGA_FALSE); break;
604 case 42: PGASetDebugFlag42(ctx, PGA_FALSE); break;
605 case 44: PGASetDebugFlag44(ctx, PGA_FALSE); break;
606 case 46: PGASetDebugFlag46(ctx, PGA_FALSE); break;
607 case 48: PGASetDebugFlag48(ctx, PGA_FALSE); break;
608 case 50: PGASetDebugFlag50(ctx, PGA_FALSE); break;
609 case 52: PGASetDebugFlag52(ctx, PGA_FALSE); break;
610 case 54: PGASetDebugFlag54(ctx, PGA_FALSE); break;
611 case 56: PGASetDebugFlag56(ctx, PGA_FALSE); break;
612 case 58: PGASetDebugFlag58(ctx, PGA_FALSE); break;
613 case 60: PGASetDebugFlag60(ctx, PGA_FALSE); break;
614 case 62: PGASetDebugFlag62(ctx, PGA_FALSE); break;
615 case 64: PGASetDebugFlag64(ctx, PGA_FALSE); break;
616 case 66: PGASetDebugFlag66(ctx, PGA_FALSE); break;
617 }
618 }
619 }
620
621 /*U****************************************************************************
622 PGASetDebugLevelByName - Turn on debugging of the named function.
623
624 Category: Debugging
625
626 Inputs:
627 ctx - context variable
628 funcname - name of the function to turn on debugging output
629
630 Outputs:
631
632 Example:
633 PGAContext *ctx;
634 :
635 PGASetDebugLevelByName(ctx, "PGAGetBinaryAllele");
636
637 ****************************************************************************U*/
PGASetDebugLevelByName(PGAContext * ctx,char * funcname)638 void PGASetDebugLevelByName(PGAContext *ctx, char *funcname)
639 {
640 int level;
641
642 level = PGAGetDebugLevelOfName(ctx, funcname);
643 ctx->debug.PGADebugFlags[level] = PGA_TRUE;
644 }
645
646 /*U****************************************************************************
647 PGAClearDebugLevelByName - Turn off debugging of the named function.
648
649 Category: Debugging
650
651 Inputs:
652 ctx - context variable
653 funcname - name of the function to turn on debugging output
654
655 Outputs:
656
657 Example:
658 PGAContext *ctx;
659 :
660 PGAClearDebugLevelByName(ctx, "PGAGetBinaryAllele");
661
662 ****************************************************************************U*/
PGAClearDebugLevelByName(PGAContext * ctx,char * funcname)663 void PGAClearDebugLevelByName(PGAContext *ctx, char *funcname)
664 {
665 int level;
666
667 level = PGAGetDebugLevelOfName(ctx, funcname);
668 ctx->debug.PGADebugFlags[level] = PGA_FALSE;
669 }
670
671
672 /*I****************************************************************************
673 PGAGetDebugLevelOfName - returns the debug level of the named function
674 Internally, it performs a binary search on the run-time sorted list of
675 fucntions in PGAFuncIndex.
676
677 Inputs:
678 ctx - context variable
679 funcname - the name of the function
680
681 Outputs:
682 The debug level value of the function. That is, PGAFuncNum associated
683 with funcname in PGAFuncIndex.
684
685 Example:
686
687
688 ****************************************************************************I*/
PGAGetDebugLevelOfName(PGAContext * ctx,char * funcname)689 int PGAGetDebugLevelOfName(PGAContext *ctx, char *funcname)
690 {
691 int l, h;
692 int m, missing;
693
694 /* Binary Search */
695 l = 0;
696 h = PGANumFcns-1;
697 while (l <= h) {
698 m = (l+h)/2 + (l+h)%2; /* Actually, floor((l+h)/2) */
699 missing = strcmp(funcname, PGAFuncIndex[m].PGAFuncName);
700
701 if (missing == 0) {
702 break;
703 } else {
704 if (missing < 0) {
705 h = m - 1;
706 } else {
707 l = m + 1;
708 }
709 }
710 }
711
712 if (missing) {
713 fprintf(stderr, "PGAGetDebugFlag: Function missing from "
714 "PGAFuncIndex: '%s'\n", funcname);
715 PGADestroy(ctx);
716 exit(-1);
717 }
718
719 return(PGAFuncIndex[m].PGAFuncNum);
720 }
721
722 /*I****************************************************************************
723 PGAGetDebugFlag - checks whether the flag to do a debug print in routine
724 funcname has been set. Returns PGA_TRUE if so, otherwise PGA_FALSE.
725 If the name is not in the function name database, an error message is
726 printed and the program terminates.
727
728 Inputs:
729 ctx - context variable
730 funcname - name of the function in question
731
732 Outputs:
733
734 Example:
735 PGAContext *ctx;
736 int IsItSet;
737
738 IsItSet = PGAGetDebugFlag(ctx, "PGAGetDebugFlags");
739
740 ****************************************************************************I*/
PGAGetDebugFlag(PGAContext * ctx,char * funcname)741 int PGAGetDebugFlag(PGAContext *ctx, char *funcname)
742 {
743 int level;
744
745 level = PGAGetDebugLevelOfName(ctx, funcname);
746 return ctx->debug.PGADebugFlags[level];
747 }
748
749
750 /*I****************************************************************************
751 PGASetDebugFlag11 - Set the debug flags for all functions at debug level 11
752
753 Inputs:
754 ctx - Context variable
755 Flag - PGA_TRUE to enable or PGA_FALSE to disable
756
757 Outputs:
758
759 Example:
760
761 ****************************************************************************I*/
PGASetDebugFlag11(PGAContext * ctx,int Flag)762 void PGASetDebugFlag11(PGAContext *ctx, int Flag)
763 {
764 ctx->debug.PGADebugFlags[300] = Flag; /*PGACreate*/
765 ctx->debug.PGADebugFlags[301] = Flag; /*PGASetUp*/
766 ctx->debug.PGADebugFlags[304] = Flag; /*PGAGetRandomInitFlag*/
767 ctx->debug.PGADebugFlags[305] = Flag; /*PGASetRandomInitFlag*/
768
769 ctx->debug.PGADebugFlags[310] = Flag; /*PGACrossover*/
770 ctx->debug.PGADebugFlags[311] = Flag; /*PGAGetCrossoverType*/
771 ctx->debug.PGADebugFlags[312] = Flag; /*PGAGetCrossoverProb*/
772 ctx->debug.PGADebugFlags[313] = Flag; /*PGAGetUniformCrossoverProb*/
773 ctx->debug.PGADebugFlags[314] = Flag; /*PGASetCrossoverType*/
774 ctx->debug.PGADebugFlags[315] = Flag; /*PGASetCrossoverProb*/
775 ctx->debug.PGADebugFlags[316] = Flag; /*PGASetUniformCrossoverProb*/
776
777 ctx->debug.PGADebugFlags[320] = Flag; /*PGASort*/
778 ctx->debug.PGADebugFlags[321] = Flag; /*PGAGetPopSize*/
779 ctx->debug.PGADebugFlags[322] = Flag; /*PGAGetNumReplaceValue*/
780 ctx->debug.PGADebugFlags[323] = Flag; /*PGAGetPopReplaceType*/
781 ctx->debug.PGADebugFlags[325] = Flag; /*PGASetPopSize*/
782 ctx->debug.PGADebugFlags[326] = Flag; /*PGASetNumReplaceValue*/
783 ctx->debug.PGADebugFlags[327] = Flag; /*PGASetPopReplaceType*/
784
785 ctx->debug.PGADebugFlags[330] = Flag; /*PGAMutate*/
786 ctx->debug.PGADebugFlags[331] = Flag; /*PGAGetMutationType*/
787 ctx->debug.PGADebugFlags[332] = Flag; /*PGAGetMutationRealValue*/
788 ctx->debug.PGADebugFlags[333] = Flag; /*PGAGetMutationIntegerValue*/
789 ctx->debug.PGADebugFlags[334] = Flag; /*PGAGetMutationProb*/
790 ctx->debug.PGADebugFlags[335] = Flag; /*PGASetMutationType*/
791 ctx->debug.PGADebugFlags[336] = Flag; /*PGASetMutationRealValue*/
792 ctx->debug.PGADebugFlags[337] = Flag; /*PGASetMutationIntegerValue*/
793 ctx->debug.PGADebugFlags[338] = Flag; /*PGASetMutationProb*/
794 ctx->debug.PGADebugFlags[400] = Flag; /*PGASetMutationBoundedFlag*/
795 ctx->debug.PGADebugFlags[401] = Flag; /*PGAGetMutationBoundedFlag*/
796
797 ctx->debug.PGADebugFlags[340] = Flag; /*PGADuplicate*/
798 ctx->debug.PGADebugFlags[341] = Flag; /*PGAChange*/
799 ctx->debug.PGADebugFlags[342] = Flag; /*PGASetNoDuplicatesFlag*/
800 ctx->debug.PGADebugFlags[343] = Flag; /*PGAGetNoDuplicatesFlag*/
801
802 ctx->debug.PGADebugFlags[350] = Flag; /*PGARunMutationAndCrossover*/
803 ctx->debug.PGADebugFlags[351] = Flag; /*PGARunMutationOrCrossover*/
804 ctx->debug.PGADebugFlags[352] = Flag; /*PGAUpdateGeneration*/
805 ctx->debug.PGADebugFlags[353] = Flag; /*PGAGetDataType*/
806 ctx->debug.PGADebugFlags[354] = Flag; /*PGAGetOptDirFlag*/
807 ctx->debug.PGADebugFlags[355] = Flag; /*PGAGetStringLength*/
808 ctx->debug.PGADebugFlags[356] = Flag; /*PGAGetGAIterValue*/
809 ctx->debug.PGADebugFlags[357] = Flag; /*PGAGetMutationOrCrossoverFlag*/
810 ctx->debug.PGADebugFlags[358] = Flag; /*PGAGetMutationAndCrossoverFlag*/
811 ctx->debug.PGADebugFlags[359] = Flag; /*PGASetMutationOrCrossoverFlag*/
812 ctx->debug.PGADebugFlags[360] = Flag; /*PGASetMutationAndCrossoverFlag*/
813 ctx->debug.PGADebugFlags[361] = Flag; /*PGARun*/
814
815 ctx->debug.PGADebugFlags[370] = Flag; /*PGARestart*/
816 ctx->debug.PGADebugFlags[371] = Flag; /*PGAGetRestartFlag*/
817 ctx->debug.PGADebugFlags[372] = Flag; /*PGAGetRestartFrequencyValue*/
818 ctx->debug.PGADebugFlags[373] = Flag; /*PGAGetRestartAlleleChangeProb*/
819 ctx->debug.PGADebugFlags[374] = Flag; /*PGASetRestartFlag*/
820 ctx->debug.PGADebugFlags[375] = Flag; /*PGASetRestartFrequencyValue*/
821 ctx->debug.PGADebugFlags[376] = Flag; /*PGASetRestartAlleleChangeProb*/
822
823 ctx->debug.PGADebugFlags[380] = Flag; /*PGASelect*/
824 ctx->debug.PGADebugFlags[386] = Flag; /*PGAGetSelectType*/
825 ctx->debug.PGADebugFlags[387] = Flag; /*PGAGetPTournamentProb*/
826 ctx->debug.PGADebugFlags[388] = Flag; /*PGASetSelectType*/
827 ctx->debug.PGADebugFlags[389] = Flag; /*PGASetPTournamentProb*/
828
829 ctx->debug.PGADebugFlags[390] = Flag; /*PGAGetStoppingRuleType*/
830 ctx->debug.PGADebugFlags[391] = Flag; /*PGASetStoppingRuleType*/
831 ctx->debug.PGADebugFlags[392] = Flag; /*PGAGetMaxGAIterValue*/
832 ctx->debug.PGADebugFlags[393] = Flag; /*PGASetMaxGAIterValue*/
833 ctx->debug.PGADebugFlags[394] = Flag; /*PGACheckStoppingConditions*/
834 ctx->debug.PGADebugFlags[395] = Flag; /*PGASetMaxNoChangeValue*/
835 ctx->debug.PGADebugFlags[396] = Flag; /*PGASetMaxSimilarityValue*/
836 ctx->debug.PGADebugFlags[397] = Flag; /*PGADone*/
837
838 ctx->debug.PGADebugFlags[510] = Flag; /*PGAEvaluate*/
839
840 ctx->debug.PGADebugFlags[520] = Flag; /*PGAFitness*/
841 ctx->debug.PGADebugFlags[527] = Flag; /*PGAGetFitnessType*/
842 ctx->debug.PGADebugFlags[528] = Flag; /*PGAGetFitnessMinType*/
843 ctx->debug.PGADebugFlags[529] = Flag; /*PGAGetMaxFitnessRank*/
844 ctx->debug.PGADebugFlags[530] = Flag; /*PGASetFitnessType*/
845 ctx->debug.PGADebugFlags[531] = Flag; /*PGASetFitnessMinType*/
846 ctx->debug.PGADebugFlags[532] = Flag; /*PGASetMaxFitnessRank*/
847 ctx->debug.PGADebugFlags[533] = Flag; /*PGASetFitnessCmaxValue*/
848 ctx->debug.PGADebugFlags[534] = Flag; /*PGAGetFitnessCmaxValue*/
849
850 ctx->debug.PGADebugFlags[604] = Flag; /*PGARunMS*/
851 ctx->debug.PGADebugFlags[605] = Flag; /*PGAEvaluateMS*/
852 ctx->debug.PGADebugFlags[606] = Flag; /*PGAEvaluateDoneMS*/
853 ctx->debug.PGADebugFlags[607] = Flag; /*PGAGetRank*/
854 ctx->debug.PGADebugFlags[608] = Flag; /*PGAGetNumProcs*/
855 ctx->debug.PGADebugFlags[609] = Flag; /*PGASetCommunicator*/
856 ctx->debug.PGADebugFlags[610] = Flag; /*PGAGetCommunicator*/
857 ctx->debug.PGADebugFlags[611] = Flag; /*PGASetNumIslands*/
858 ctx->debug.PGADebugFlags[612] = Flag; /*PGAGetNumIslands*/
859 ctx->debug.PGADebugFlags[613] = Flag; /*PGASetNumDemes*/
860 ctx->debug.PGADebugFlags[614] = Flag; /*PGAGetNumDemes*/
861 ctx->debug.PGADebugFlags[615] = Flag; /*PGARunSeq*/
862 ctx->debug.PGADebugFlags[616] = Flag; /*PGARunIM*/
863 ctx->debug.PGADebugFlags[617] = Flag; /*PGARunNM*/
864
865 ctx->debug.PGADebugFlags[700] = Flag; /*PGAError*/
866 ctx->debug.PGADebugFlags[702] = Flag; /*PGAUsage*/
867 ctx->debug.PGADebugFlags[703] = Flag; /*PGAPrintVersionNumber*/
868 ctx->debug.PGADebugFlags[704] = Flag; /*PGAGetMaxMachineIntValue*/
869 ctx->debug.PGADebugFlags[705] = Flag; /*PGAGetMinMachineIntValue*/
870 ctx->debug.PGADebugFlags[706] = Flag; /*PGAGetMaxMachineRealValue*/
871 ctx->debug.PGADebugFlags[707] = Flag; /*PGAGetMinMachineRealValue*/
872 ctx->debug.PGADebugFlags[708] = Flag; /*PGADestroy*/
873
874 ctx->debug.PGADebugFlags[741] = Flag; /*PGAGetDebugFlag*/
875 ctx->debug.PGADebugFlags[742] = Flag; /*PGASetDebugFlag*/
876 ctx->debug.PGADebugFlags[743] = Flag; /*PGAPrintDebugOptions*/
877
878 ctx->debug.PGADebugFlags[800] = Flag; /*PGAHammingDistance*/
879
880 ctx->debug.PGADebugFlags[820] = Flag; /*PGAPrintPopulation*/
881 ctx->debug.PGADebugFlags[822] = Flag; /*PGAPrintReport*/
882 ctx->debug.PGADebugFlags[823] = Flag; /*PGAContextVariable*/
883 ctx->debug.PGADebugFlags[825] = Flag; /*PGAGetPrintFrequencyValue*/
884 ctx->debug.PGADebugFlags[826] = Flag; /*PGASetPrintFrequencyValue*/
885 ctx->debug.PGADebugFlags[827] = Flag; /*PGASetPrintOptions*/
886
887 ctx->debug.PGADebugFlags[830] = Flag; /*PGASetUserFunction*/
888 }
889
890 /*I****************************************************************************
891 PGASetDebugFlag20 - Set the debug flags for all functions at debug level 20
892
893 Inputs:
894 ctx - Context variable
895 Flag - PGA_TRUE to enable or PGA_FALSE to disable
896
897 Outputs:
898
899 Example:
900
901 ****************************************************************************I*/
PGASetDebugFlag20(PGAContext * ctx,int Flag)902 void PGASetDebugFlag20(PGAContext *ctx, int Flag)
903 {
904 ctx->debug.PGADebugFlags[604] = Flag; /*PGARunMS*/
905 ctx->debug.PGADebugFlags[605] = Flag; /*PGAEvaluateMS*/
906 ctx->debug.PGADebugFlags[606] = Flag; /*PGAEvaluateDoneMS*/
907 ctx->debug.PGADebugFlags[607] = Flag; /*PGAGetRank*/
908 ctx->debug.PGADebugFlags[608] = Flag; /*PGAGetNumProcs*/
909 ctx->debug.PGADebugFlags[609] = Flag; /*PGASetCommunicator*/
910 ctx->debug.PGADebugFlags[610] = Flag; /*PGAGetCommunicator*/
911 ctx->debug.PGADebugFlags[611] = Flag; /*PGASetNumIslands*/
912 ctx->debug.PGADebugFlags[612] = Flag; /*PGAGetNumIslands*/
913 ctx->debug.PGADebugFlags[613] = Flag; /*PGASetNumDemes*/
914 ctx->debug.PGADebugFlags[614] = Flag; /*PGAGetNumDemes*/
915 ctx->debug.PGADebugFlags[616] = Flag; /*PGARunIM*/
916 ctx->debug.PGADebugFlags[617] = Flag; /*PGARunNM*/
917 }
918
919 /*I****************************************************************************
920 PGASetDebugFlag21 - Set the debug flags for all functions at debug level 21
921
922 Inputs:
923 ctx - Context variable
924 Flag - PGA_TRUE to enable or PGA_FALSE to disable
925
926 Outputs:
927
928 Example:
929
930 ****************************************************************************I*/
PGASetDebugFlag21(PGAContext * ctx,int Flag)931 void PGASetDebugFlag21(PGAContext *ctx, int Flag)
932 {
933 ctx->debug.PGADebugFlags[600] = Flag; /*PGABuildDataType*/
934 ctx->debug.PGADebugFlags[601] = Flag; /*PGASendIndividual*/
935 ctx->debug.PGADebugFlags[602] = Flag; /*PGAReceiveIndividual*/
936 ctx->debug.PGADebugFlags[603] = Flag; /*PGASendReceiveIndividual*/
937 ctx->debug.PGADebugFlags[604] = Flag; /*PGARunMS*/
938 ctx->debug.PGADebugFlags[605] = Flag; /*PGAEvaluateMS*/
939 ctx->debug.PGADebugFlags[606] = Flag; /*PGAEvaluateDoneMS*/
940 ctx->debug.PGADebugFlags[607] = Flag; /*PGAGetRank*/
941 ctx->debug.PGADebugFlags[608] = Flag; /*PGAGetNumProcs*/
942 ctx->debug.PGADebugFlags[609] = Flag; /*PGASetCommunicator*/
943 ctx->debug.PGADebugFlags[610] = Flag; /*PGAGetCommunicator*/
944 ctx->debug.PGADebugFlags[611] = Flag; /*PGASetNumIslands*/
945 ctx->debug.PGADebugFlags[612] = Flag; /*PGAGetNumIslands*/
946 ctx->debug.PGADebugFlags[613] = Flag; /*PGASetNumDemes*/
947 ctx->debug.PGADebugFlags[614] = Flag; /*PGAGetNumDemes*/
948 ctx->debug.PGADebugFlags[616] = Flag; /*PGARunIM*/
949 ctx->debug.PGADebugFlags[617] = Flag; /*PGARunNM*/
950 ctx->debug.PGADebugFlags[714] = Flag; /*PGACheckSum*/
951 }
952
953 /*I****************************************************************************
954 PGASetDebugFlag30 - Set the debug flags for all functions at debug level 30
955
956 Inputs:
957 ctx - Context variable
958 Flag - PGA_TRUE to enable or PGA_FALSE to disable
959
960 Outputs:
961
962 Example:
963
964 ****************************************************************************I*/
PGASetDebugFlag30(PGAContext * ctx,int Flag)965 void PGASetDebugFlag30(PGAContext *ctx, int Flag)
966 {
967 ctx->debug.PGADebugFlags[100] = Flag; /*PGABinaryCreateString*/
968 ctx->debug.PGADebugFlags[101] = Flag; /*PGABinaryMutation*/
969 ctx->debug.PGADebugFlags[102] = Flag; /*PGABinaryOneptCrossover*/
970 ctx->debug.PGADebugFlags[103] = Flag; /*PGABinaryTwoptCrossover*/
971 ctx->debug.PGADebugFlags[104] = Flag; /*PGABinaryUniformCrossover*/
972 ctx->debug.PGADebugFlags[105] = Flag; /*PGABinaryPrintString*/
973 ctx->debug.PGADebugFlags[106] = Flag; /*PGABinaryCopyString*/
974 ctx->debug.PGADebugFlags[107] = Flag; /*PGABinaryDuplicate*/
975 ctx->debug.PGADebugFlags[108] = Flag; /*PGABinaryInitString*/
976 ctx->debug.PGADebugFlags[109] = Flag; /*PGABinaryBuildDatatype*/
977 ctx->debug.PGADebugFlags[110] = Flag; /*PGASetBinaryAllele*/
978 ctx->debug.PGADebugFlags[111] = Flag; /*PGAGetBinaryAllele*/
979 ctx->debug.PGADebugFlags[120] = Flag; /*PGABinaryHammingDistance*/
980 ctx->debug.PGADebugFlags[121] = Flag; /*PGABinaryPrint*/
981 ctx->debug.PGADebugFlags[122] = Flag; /*PGAGetBinaryInitProb*/
982 ctx->debug.PGADebugFlags[123] = Flag; /*PGASetBinaryInitProb*/
983 }
984
985 /*I****************************************************************************
986 PGASetDebugFlag32 - Set the debug flags for all functions at debug level 32
987
988 Inputs:
989 ctx - Context variable
990 Flag - PGA_TRUE to enable or PGA_FALSE to disable
991
992 Outputs:
993
994 Example:
995
996 ****************************************************************************I*/
PGASetDebugFlag32(PGAContext * ctx,int Flag)997 void PGASetDebugFlag32(PGAContext *ctx, int Flag)
998 {
999 ctx->debug.PGADebugFlags[150] = Flag; /*PGAIntegerCreateString*/
1000 ctx->debug.PGADebugFlags[151] = Flag; /*PGAIntegerMutation*/
1001 ctx->debug.PGADebugFlags[152] = Flag; /*PGAIntegerOneptCrossover*/
1002 ctx->debug.PGADebugFlags[153] = Flag; /*PGAIntegerTwoptCrossover*/
1003 ctx->debug.PGADebugFlags[154] = Flag; /*PGAIntegerUniformCrossover*/
1004 ctx->debug.PGADebugFlags[155] = Flag; /*PGAIntegerPrintString*/
1005 ctx->debug.PGADebugFlags[156] = Flag; /*PGAIntegerCopyString*/
1006 ctx->debug.PGADebugFlags[157] = Flag; /*PGAIntegerDuplicate*/
1007 ctx->debug.PGADebugFlags[158] = Flag; /*PGAIntegerInitString*/
1008 ctx->debug.PGADebugFlags[159] = Flag; /*PGAIntegerBuildDatatype*/
1009 ctx->debug.PGADebugFlags[160] = Flag; /*PGASetIntegerAllele*/
1010 ctx->debug.PGADebugFlags[161] = Flag; /*PGAGetIntegerAllele*/
1011 ctx->debug.PGADebugFlags[170] = Flag; /*PGASetIntegerInitPermute*/
1012 ctx->debug.PGADebugFlags[171] = Flag; /*PGASetIntegerInitRange*/
1013 ctx->debug.PGADebugFlags[172] = Flag; /*PGAGetIntegerInitType*/
1014 ctx->debug.PGADebugFlags[173] = Flag; /*PGAGetMinIntegerInitValue*/
1015 ctx->debug.PGADebugFlags[174] = Flag; /*PGAGetMaxIntegerInitValue*/
1016 ctx->debug.PGADebugFlags[400] = Flag; /*PGASetMutationBoundedFlag*/
1017 ctx->debug.PGADebugFlags[401] = Flag; /*PGAGetMutationBoundedFlag*/
1018 }
1019
1020 /*I****************************************************************************
1021 PGASetDebugFlag34 - Set the debug flags for all functions at debug level 34
1022
1023 Inputs:
1024 ctx - Context variable
1025 Flag - PGA_TRUE to enable or PGA_FALSE to disable
1026
1027 Outputs:
1028
1029 Example:
1030
1031 ****************************************************************************I*/
PGASetDebugFlag34(PGAContext * ctx,int Flag)1032 void PGASetDebugFlag34(PGAContext *ctx, int Flag)
1033 {
1034 ctx->debug.PGADebugFlags[200] = Flag; /*PGARealCreateString*/
1035 ctx->debug.PGADebugFlags[201] = Flag; /*PGARealMutation*/
1036 ctx->debug.PGADebugFlags[202] = Flag; /*PGARealOneptCrossover*/
1037 ctx->debug.PGADebugFlags[203] = Flag; /*PGARealTwoptCrossover*/
1038 ctx->debug.PGADebugFlags[204] = Flag; /*PGARealUniformCrossover*/
1039 ctx->debug.PGADebugFlags[205] = Flag; /*PGARealPrintString*/
1040 ctx->debug.PGADebugFlags[206] = Flag; /*PGARealCopyString*/
1041 ctx->debug.PGADebugFlags[207] = Flag; /*PGARealDuplicate*/
1042 ctx->debug.PGADebugFlags[208] = Flag; /*PGARealInitString*/
1043 ctx->debug.PGADebugFlags[209] = Flag; /*PGARealBuildDatatype*/
1044 ctx->debug.PGADebugFlags[210] = Flag; /*PGASetRealAllele*/
1045 ctx->debug.PGADebugFlags[211] = Flag; /*PGAGetRealAllele*/
1046 ctx->debug.PGADebugFlags[220] = Flag; /*PGASetRealInitPercent*/
1047 ctx->debug.PGADebugFlags[221] = Flag; /*PGASetRealInitRange*/
1048 ctx->debug.PGADebugFlags[222] = Flag; /*PGAGetMinRealInitValue*/
1049 ctx->debug.PGADebugFlags[223] = Flag; /*PGAGetMaxRealInitValue*/
1050 }
1051
1052 /*I****************************************************************************
1053 PGASetDebugFlag36 - Set the debug flags for all functions at debug level 36
1054
1055 Inputs:
1056 ctx - Context variable
1057 Flag - PGA_TRUE to enable or PGA_FALSE to disable
1058
1059 Outputs:
1060
1061 Example:
1062
1063 ****************************************************************************I*/
PGASetDebugFlag36(PGAContext * ctx,int Flag)1064 void PGASetDebugFlag36(PGAContext *ctx, int Flag)
1065 {
1066 ctx->debug.PGADebugFlags[250] = Flag; /*PGACharacterCreateString*/
1067 ctx->debug.PGADebugFlags[251] = Flag; /*PGACharacterMutation*/
1068 ctx->debug.PGADebugFlags[252] = Flag; /*PGACharacterOneptCrossover*/
1069 ctx->debug.PGADebugFlags[253] = Flag; /*PGACharacterTwoptCrossover*/
1070 ctx->debug.PGADebugFlags[254] = Flag; /*PGACharacterUniformCrossover*/
1071 ctx->debug.PGADebugFlags[255] = Flag; /*PGACharacterPrintString*/
1072 ctx->debug.PGADebugFlags[256] = Flag; /*PGACharacterCopyString*/
1073 ctx->debug.PGADebugFlags[257] = Flag; /*PGACharacterDuplicate*/
1074 ctx->debug.PGADebugFlags[258] = Flag; /*PGACharacterInitString*/
1075 ctx->debug.PGADebugFlags[259] = Flag; /*PGACharacterBuildDatatype*/
1076 ctx->debug.PGADebugFlags[260] = Flag; /*PGASetCharacterAllele*/
1077 ctx->debug.PGADebugFlags[261] = Flag; /*PGAGetCharacterAllele*/
1078 ctx->debug.PGADebugFlags[270] = Flag; /*PGASetCharacterInitType*/
1079 }
1080
1081 /*I****************************************************************************
1082 PGASetDebugFlag40 - Set the debug flags for all functions at debug level 40
1083
1084 Inputs:
1085 ctx - Context variable
1086 Flag - PGA_TRUE to enable or PGA_FALSE to disable
1087
1088 Outputs:
1089
1090 Example:
1091
1092 ****************************************************************************I*/
PGASetDebugFlag40(PGAContext * ctx,int Flag)1093 void PGASetDebugFlag40(PGAContext *ctx, int Flag)
1094 {
1095 ctx->debug.PGADebugFlags[100] = Flag; /*PGABinaryCreateString*/
1096 ctx->debug.PGADebugFlags[108] = Flag; /*PGABinaryInitString*/
1097 ctx->debug.PGADebugFlags[122] = Flag; /*PGAGetBinaryInitProb*/
1098 ctx->debug.PGADebugFlags[123] = Flag; /*PGASetBinaryInitProb*/
1099 ctx->debug.PGADebugFlags[250] = Flag; /*PGACharacterCreateString*/
1100 ctx->debug.PGADebugFlags[258] = Flag; /*PGACharacterInitString*/
1101 ctx->debug.PGADebugFlags[270] = Flag; /*PGASetCharacterInitType*/
1102 ctx->debug.PGADebugFlags[300] = Flag; /*PGACreate*/
1103 ctx->debug.PGADebugFlags[301] = Flag; /*PGASetUp*/
1104 ctx->debug.PGADebugFlags[302] = Flag; /*PGACreatePop*/
1105 ctx->debug.PGADebugFlags[303] = Flag; /*PGACreateIndividual*/
1106 ctx->debug.PGADebugFlags[304] = Flag; /*PGAGetRandomInitFlag*/
1107 ctx->debug.PGADebugFlags[305] = Flag; /*PGASetRandomInitFlag*/
1108 ctx->debug.PGADebugFlags[150] = Flag; /*PGAIntegerCreateString*/
1109 ctx->debug.PGADebugFlags[158] = Flag; /*PGAIntegerInitString*/
1110 ctx->debug.PGADebugFlags[170] = Flag; /*PGASetIntegerInitPermute*/
1111 ctx->debug.PGADebugFlags[171] = Flag; /*PGASetIntegerInitRange*/
1112 ctx->debug.PGADebugFlags[172] = Flag; /*PGAGetIntegerInitType*/
1113 ctx->debug.PGADebugFlags[173] = Flag; /*PGAGetMinIntegerInitValue*/
1114 ctx->debug.PGADebugFlags[174] = Flag; /*PGAGetMaxIntegerInitValue*/
1115 ctx->debug.PGADebugFlags[200] = Flag; /*PGARealCreateString*/
1116 ctx->debug.PGADebugFlags[208] = Flag; /*PGARealInitString*/
1117 ctx->debug.PGADebugFlags[220] = Flag; /*PGASetRealInitPercent*/
1118 ctx->debug.PGADebugFlags[221] = Flag; /*PGASetRealInitRange*/
1119 ctx->debug.PGADebugFlags[222] = Flag; /*PGAGetMinRealInitValue*/
1120 ctx->debug.PGADebugFlags[223] = Flag; /*PGAGetMaxRealInitValue*/
1121 }
1122
1123 /*I****************************************************************************
1124 PGASetDebugFlag42 - Set the debug flags for all functions at debug level 42
1125
1126 Inputs:
1127 ctx - Context variable
1128 Flag - PGA_TRUE to enable or PGA_FALSE to disable
1129
1130 Outputs:
1131
1132 Example:
1133
1134 ****************************************************************************I*/
PGASetDebugFlag42(PGAContext * ctx,int Flag)1135 void PGASetDebugFlag42(PGAContext *ctx, int Flag)
1136 {
1137 ctx->debug.PGADebugFlags[380] = Flag; /*PGASelect*/
1138 ctx->debug.PGADebugFlags[381] = Flag; /*PGASelectProportional*/
1139 ctx->debug.PGADebugFlags[382] = Flag; /*PGASelectSUS*/
1140 ctx->debug.PGADebugFlags[383] = Flag; /*PGASelectTournament*/
1141 ctx->debug.PGADebugFlags[384] = Flag; /*PGASelectPTournament*/
1142 ctx->debug.PGADebugFlags[385] = Flag; /*PGASelectNextIndex*/
1143 ctx->debug.PGADebugFlags[386] = Flag; /*PGAGetSelectType*/
1144 ctx->debug.PGADebugFlags[387] = Flag; /*PGAGetPTournamentProb*/
1145 ctx->debug.PGADebugFlags[388] = Flag; /*PGASetSelectType*/
1146 ctx->debug.PGADebugFlags[389] = Flag; /*PGASetPTournamentProb*/
1147 }
1148
1149 /*I****************************************************************************
1150 PGASetDebugFlag44 - Set the debug flags for all functions at debug level 44
1151
1152 Inputs:
1153 ctx - Context variable
1154 Flag - PGA_TRUE to enable or PGA_FALSE to disable
1155
1156 Outputs:
1157
1158 Example:
1159
1160 ****************************************************************************I*/
PGASetDebugFlag44(PGAContext * ctx,int Flag)1161 void PGASetDebugFlag44(PGAContext *ctx, int Flag)
1162 {
1163 ctx->debug.PGADebugFlags[101] = Flag; /*PGABinaryMutation*/
1164 ctx->debug.PGADebugFlags[151] = Flag; /*PGAIntegerMutation*/
1165 ctx->debug.PGADebugFlags[201] = Flag; /*PGARealMutation*/
1166 ctx->debug.PGADebugFlags[251] = Flag; /*PGACharacterMutation*/
1167 ctx->debug.PGADebugFlags[330] = Flag; /*PGAMutate*/
1168 ctx->debug.PGADebugFlags[331] = Flag; /*PGAGetMutationType*/
1169 ctx->debug.PGADebugFlags[332] = Flag; /*PGAGetMutationRealValue*/
1170 ctx->debug.PGADebugFlags[333] = Flag; /*PGAGetMutationIntegerValue*/
1171 ctx->debug.PGADebugFlags[334] = Flag; /*PGAGetMutationProb*/
1172 ctx->debug.PGADebugFlags[335] = Flag; /*PGASetMutationType*/
1173 ctx->debug.PGADebugFlags[336] = Flag; /*PGASetMutationRealValue*/
1174 ctx->debug.PGADebugFlags[337] = Flag; /*PGASetMutationIntegerValue*/
1175 ctx->debug.PGADebugFlags[338] = Flag; /*PGASetMutationProb*/
1176 ctx->debug.PGADebugFlags[400] = Flag; /*PGASetMutationBoundedFlag*/
1177 ctx->debug.PGADebugFlags[401] = Flag; /*PGAGetMutationBoundedFlag*/
1178 }
1179
1180 /*I****************************************************************************
1181 PGASetDebugFlag46 - Set the debug flags for all functions at debug level 46
1182
1183 Inputs:
1184 ctx - Context variable
1185 Flag - PGA_TRUE to enable or PGA_FALSE to disable
1186
1187 Outputs:
1188
1189 Example:
1190
1191 ****************************************************************************I*/
PGASetDebugFlag46(PGAContext * ctx,int Flag)1192 void PGASetDebugFlag46(PGAContext *ctx, int Flag)
1193 {
1194 ctx->debug.PGADebugFlags[102] = Flag; /*PGABinaryOneptCrossover*/
1195 ctx->debug.PGADebugFlags[103] = Flag; /*PGABinaryTwoptCrossover*/
1196 ctx->debug.PGADebugFlags[104] = Flag; /*PGABinaryUniformCrossover*/
1197 ctx->debug.PGADebugFlags[152] = Flag; /*PGAIntegerOneptCrossover*/
1198 ctx->debug.PGADebugFlags[153] = Flag; /*PGAIntegerTwoptCrossover*/
1199 ctx->debug.PGADebugFlags[154] = Flag; /*PGAIntegerUniformCrossover*/
1200 ctx->debug.PGADebugFlags[202] = Flag; /*PGARealOneptCrossover*/
1201 ctx->debug.PGADebugFlags[203] = Flag; /*PGARealTwoptCrossover*/
1202 ctx->debug.PGADebugFlags[204] = Flag; /*PGARealUniformCrossover*/
1203 ctx->debug.PGADebugFlags[252] = Flag; /*PGACharacterOneptCrossover*/
1204 ctx->debug.PGADebugFlags[253] = Flag; /*PGACharacterTwoptCrossover*/
1205 ctx->debug.PGADebugFlags[254] = Flag; /*PGACharacterUniformCrossover*/
1206 ctx->debug.PGADebugFlags[310] = Flag; /*PGACrossover*/
1207 ctx->debug.PGADebugFlags[311] = Flag; /*PGAGetCrossoverType*/
1208 ctx->debug.PGADebugFlags[312] = Flag; /*PGAGetCrossoverProb*/
1209 ctx->debug.PGADebugFlags[313] = Flag; /*PGAGetUniformCrossoverProb*/
1210 ctx->debug.PGADebugFlags[314] = Flag; /*PGASetCrossoverType*/
1211 ctx->debug.PGADebugFlags[315] = Flag; /*PGASetCrossoverProb*/
1212 ctx->debug.PGADebugFlags[316] = Flag; /*PGASetUniformCrossoverProb*/
1213 }
1214
1215 /*I****************************************************************************
1216 PGASetDebugFlag48 - Set the debug flags for all functions at debug level 48
1217
1218 Inputs:
1219 ctx - Context variable
1220 Flag - PGA_TRUE to enable or PGA_FALSE to disable
1221
1222 Outputs:
1223
1224 Example:
1225
1226 ****************************************************************************I*/
PGASetDebugFlag48(PGAContext * ctx,int Flag)1227 void PGASetDebugFlag48(PGAContext *ctx, int Flag)
1228 {
1229 ctx->debug.PGADebugFlags[110] = Flag; /*PGASetBinaryAllele*/
1230 ctx->debug.PGADebugFlags[111] = Flag; /*PGAGetBinaryAllele*/
1231 ctx->debug.PGADebugFlags[160] = Flag; /*PGASetIntegerAllele*/
1232 ctx->debug.PGADebugFlags[161] = Flag; /*PGAGetIntegerAllele*/
1233 ctx->debug.PGADebugFlags[210] = Flag; /*PGASetRealAllele*/
1234 ctx->debug.PGADebugFlags[211] = Flag; /*PGAGetRealAllele*/
1235 ctx->debug.PGADebugFlags[260] = Flag; /*PGASetCharacterAllele*/
1236 ctx->debug.PGADebugFlags[261] = Flag; /*PGAGetCharacterAllele*/
1237 ctx->debug.PGADebugFlags[500] = Flag; /*PGAGetRealFromBinary*/
1238 ctx->debug.PGADebugFlags[501] = Flag; /*PGAGetRealFromGrayCode*/
1239 ctx->debug.PGADebugFlags[502] = Flag; /*PGAEncodeRealAsBinary*/
1240 ctx->debug.PGADebugFlags[503] = Flag; /*PGAEncodeRealAsGrayCode*/
1241 ctx->debug.PGADebugFlags[504] = Flag; /*PGAMapIntegerToReal*/
1242 ctx->debug.PGADebugFlags[505] = Flag; /*PGAMapRealToInteger*/
1243 ctx->debug.PGADebugFlags[506] = Flag; /*PGAEncodeIntegerAsBinary*/
1244 ctx->debug.PGADebugFlags[507] = Flag; /*PGAEncodeIntegerAsGrayCode*/
1245 ctx->debug.PGADebugFlags[508] = Flag; /*PGAGetIntegerFromBinary*/
1246 ctx->debug.PGADebugFlags[509] = Flag; /*PGAGetIntegerFromGrayCode*/
1247 ctx->debug.PGADebugFlags[510] = Flag; /*PGAEvaluate*/
1248 ctx->debug.PGADebugFlags[511] = Flag; /*PGASetEvaluation*/
1249 ctx->debug.PGADebugFlags[512] = Flag; /*PGASetEvaluationUpToDateFlag*/
1250 ctx->debug.PGADebugFlags[513] = Flag; /*PGAGetEvaluation*/
1251 ctx->debug.PGADebugFlags[514] = Flag; /*PGAGetEvaluationUpToDateFlag*/
1252 ctx->debug.PGADebugFlags[605] = Flag; /*PGAEvaluateMS*/
1253 ctx->debug.PGADebugFlags[715] = Flag; /*PGAGetWorstIndex*/
1254 ctx->debug.PGADebugFlags[716] = Flag; /*PGAGetBestIndex*/
1255 }
1256
1257 /*I****************************************************************************
1258 PGASetDebugFlag50 - Set the debug flags for all functions at debug level 50
1259
1260 Inputs:
1261 ctx - Context variable
1262 Flag - PGA_TRUE to enable or PGA_FALSE to disable
1263
1264 Outputs:
1265
1266 Example:
1267
1268 ****************************************************************************I*/
PGASetDebugFlag50(PGAContext * ctx,int Flag)1269 void PGASetDebugFlag50(PGAContext *ctx, int Flag)
1270 {
1271 ctx->debug.PGADebugFlags[520] = Flag; /*PGAFitness*/
1272 ctx->debug.PGADebugFlags[521] = Flag; /*PGAFitnessLinearNormal*/
1273 ctx->debug.PGADebugFlags[522] = Flag; /*PGAFitnessLinearRank*/
1274 ctx->debug.PGADebugFlags[523] = Flag; /*PGAFitnessMinReciprocal*/
1275 ctx->debug.PGADebugFlags[524] = Flag; /*PGAFitnessMinCmax*/
1276 ctx->debug.PGADebugFlags[525] = Flag; /*PGARank*/
1277 ctx->debug.PGADebugFlags[526] = Flag; /*PGAGetFitness*/
1278 ctx->debug.PGADebugFlags[527] = Flag; /*PGAGetFitnessType*/
1279 ctx->debug.PGADebugFlags[528] = Flag; /*PGAGetFitnessMinType*/
1280 ctx->debug.PGADebugFlags[529] = Flag; /*PGAGetMaxFitnessRank*/
1281 ctx->debug.PGADebugFlags[530] = Flag; /*PGASetFitnessType*/
1282 ctx->debug.PGADebugFlags[531] = Flag; /*PGASetFitnessMinType*/
1283 ctx->debug.PGADebugFlags[532] = Flag; /*PGASetMaxFitnessRank*/
1284 ctx->debug.PGADebugFlags[533] = Flag; /*PGASetFitnessCmaxValue*/
1285 ctx->debug.PGADebugFlags[534] = Flag; /*PGAGetFitnessCmaxValue*/
1286 }
1287
1288 /*I****************************************************************************
1289 PGASetDebugFlag52 - Set the debug flags for all functions at debug level 52
1290
1291 Inputs:
1292 ctx - Context variable
1293 Flag - PGA_TRUE to enable or PGA_FALSE to disable
1294
1295 Outputs:
1296
1297 Example:
1298
1299 ****************************************************************************I*/
PGASetDebugFlag52(PGAContext * ctx,int Flag)1300 void PGASetDebugFlag52(PGAContext *ctx, int Flag)
1301 {
1302 ctx->debug.PGADebugFlags[107] = Flag; /*PGABinaryDuplicate*/
1303 ctx->debug.PGADebugFlags[157] = Flag; /*PGAIntegerDuplicate*/
1304 ctx->debug.PGADebugFlags[207] = Flag; /*PGARealDuplicate*/
1305 ctx->debug.PGADebugFlags[257] = Flag; /*PGACharacterDuplicate*/
1306 ctx->debug.PGADebugFlags[340] = Flag; /*PGADuplicate*/
1307 ctx->debug.PGADebugFlags[341] = Flag; /*PGAChange*/
1308 ctx->debug.PGADebugFlags[342] = Flag; /*PGASetNoDuplicatesFlag*/
1309 ctx->debug.PGADebugFlags[343] = Flag; /*PGAGetNoDuplicatesFlag*/
1310 }
1311
1312 /*I****************************************************************************
1313 PGASetDebugFlag54 - Set the debug flags for all functions at debug level 54
1314
1315 Inputs:
1316 ctx - Context variable
1317 Flag - PGA_TRUE to enable or PGA_FALSE to disable
1318
1319 Outputs:
1320
1321 Example:
1322
1323 ****************************************************************************I*/
PGASetDebugFlag54(PGAContext * ctx,int Flag)1324 void PGASetDebugFlag54(PGAContext *ctx, int Flag)
1325 {
1326 ctx->debug.PGADebugFlags[370] = Flag; /*PGARestart*/
1327 ctx->debug.PGADebugFlags[371] = Flag; /*PGAGetRestartFlag*/
1328 ctx->debug.PGADebugFlags[372] = Flag; /*PGAGetRestartFrequencyValue*/
1329 ctx->debug.PGADebugFlags[373] = Flag; /*PGAGetRestartAlleleChangeProb*/
1330 ctx->debug.PGADebugFlags[374] = Flag; /*PGASetRestartFlag*/
1331 ctx->debug.PGADebugFlags[375] = Flag; /*PGASetRestartFrequencyValue*/
1332 ctx->debug.PGADebugFlags[376] = Flag; /*PGASetRestartAlleleChangeProb*/
1333 }
1334
1335 /*I****************************************************************************
1336 PGASetDebugFlag56 - Set the debug flags for all functions at debug level 56
1337
1338 Inputs:
1339 ctx - Context variable
1340 Flag - PGA_TRUE to enable or PGA_FALSE to disable
1341
1342 Outputs:
1343
1344 Example:
1345
1346 ****************************************************************************I*/
PGASetDebugFlag56(PGAContext * ctx,int Flag)1347 void PGASetDebugFlag56(PGAContext *ctx, int Flag)
1348 {
1349 ctx->debug.PGADebugFlags[105] = Flag; /*PGABinaryPrintString*/
1350 ctx->debug.PGADebugFlags[121] = Flag; /*PGABinaryPrint*/
1351 ctx->debug.PGADebugFlags[155] = Flag; /*PGAIntegerPrintString*/
1352 ctx->debug.PGADebugFlags[205] = Flag; /*PGARealPrintString*/
1353 ctx->debug.PGADebugFlags[255] = Flag; /*PGACharacterPrintString*/
1354 ctx->debug.PGADebugFlags[820] = Flag; /*PGAPrintPopulation*/
1355 ctx->debug.PGADebugFlags[821] = Flag; /*PGAPrintIndividual*/
1356 ctx->debug.PGADebugFlags[822] = Flag; /*PGAPrintReport*/
1357 ctx->debug.PGADebugFlags[823] = Flag; /*PGAPrintContextVariable*/
1358 ctx->debug.PGADebugFlags[824] = Flag; /*PGAPrintString*/
1359 ctx->debug.PGADebugFlags[825] = Flag; /*PGAGetPrintFrequencyValue*/
1360 ctx->debug.PGADebugFlags[826] = Flag; /*PGASetPrintFrequencyValue*/
1361 ctx->debug.PGADebugFlags[827] = Flag; /*PGASetPrintOptions*/
1362 }
1363
1364 /*I****************************************************************************
1365 PGASetDebugFlag58 - Set the debug flags for all functions at debug level 58
1366
1367 Inputs:
1368 ctx - Context variable
1369 Flag - PGA_TRUE to enable or PGA_FALSE to disable
1370
1371 Outputs:
1372
1373 Example:
1374
1375 ****************************************************************************I*/
PGASetDebugFlag58(PGAContext * ctx,int Flag)1376 void PGASetDebugFlag58(PGAContext *ctx, int Flag)
1377 {
1378 ctx->debug.PGADebugFlags[390] = Flag; /*PGAGetStoppingRuleType*/
1379 ctx->debug.PGADebugFlags[391] = Flag; /*PGASetStoppingRuleType*/
1380 ctx->debug.PGADebugFlags[392] = Flag; /*PGAGetMaxGAIterValue*/
1381 ctx->debug.PGADebugFlags[393] = Flag; /*PGASetMaxGAIterValue*/
1382 ctx->debug.PGADebugFlags[394] = Flag; /*PGACheckStoppingConditions*/
1383 ctx->debug.PGADebugFlags[395] = Flag; /*PGASetMaxNoChangeValue*/
1384 ctx->debug.PGADebugFlags[396] = Flag; /*PGASetMaxSimilarityValue*/
1385 ctx->debug.PGADebugFlags[397] = Flag; /*PGADone*/
1386 }
1387
1388 /*I****************************************************************************
1389 PGASetDebugFlag60 - Set the debug flags for all functions at debug level 60
1390
1391 Inputs:
1392 ctx - Context variable
1393 Flag - PGA_TRUE to enable or PGA_FALSE to disable
1394
1395 Outputs:
1396
1397 Example:
1398
1399 ****************************************************************************I*/
PGASetDebugFlag60(PGAContext * ctx,int Flag)1400 void PGASetDebugFlag60(PGAContext *ctx, int Flag)
1401 {
1402 ctx->debug.PGADebugFlags[320] = Flag; /*PGASortPop*/
1403 ctx->debug.PGADebugFlags[324] = Flag; /*PGAGetSortedPopIndex*/
1404 ctx->debug.PGADebugFlags[810] = Flag; /*PGADblHeapSort*/
1405 ctx->debug.PGADebugFlags[811] = Flag; /*PGADblHeapify*/
1406 ctx->debug.PGADebugFlags[812] = Flag; /*PGADblAdjustHeap*/
1407 ctx->debug.PGADebugFlags[813] = Flag; /*PGAIntHeapSort*/
1408 ctx->debug.PGADebugFlags[814] = Flag; /*PGAIntHeapify*/
1409 ctx->debug.PGADebugFlags[815] = Flag; /*PGAIntAdjustHeap*/
1410 }
1411
1412 /*I****************************************************************************
1413 PGASetDebugFlag62 - Set the debug flags for all functions at debug level 62
1414
1415 Inputs:
1416 ctx - Context variable
1417 Flag - PGA_TRUE to enable or PGA_FALSE to disable
1418
1419 Outputs:
1420
1421 Example:
1422
1423 ****************************************************************************I*/
PGASetDebugFlag62(PGAContext * ctx,int Flag)1424 void PGASetDebugFlag62(PGAContext *ctx, int Flag)
1425 {
1426 ctx->debug.PGADebugFlags[750] = Flag; /*PGARandomFlip*/
1427 ctx->debug.PGADebugFlags[751] = Flag; /*PGARandomInterval*/
1428 ctx->debug.PGADebugFlags[752] = Flag; /*PGARandom01*/
1429 ctx->debug.PGADebugFlags[753] = Flag; /*PGARandomUniform*/
1430 ctx->debug.PGADebugFlags[754] = Flag; /*PGARandomGaussian*/
1431 ctx->debug.PGADebugFlags[755] = Flag; /*PGAGetRandomSeed*/
1432 ctx->debug.PGADebugFlags[756] = Flag; /*PGASetRandomSeed*/
1433 }
1434
1435 /*I****************************************************************************
1436 PGASetDebugFlag64 - Set the debug flags for all functions at debug level 64
1437
1438 Inputs:
1439 ctx - Context variable
1440 Flag - PGA_TRUE to enable or PGA_FALSE to disable
1441
1442 Outputs:
1443
1444 Example:
1445
1446 ****************************************************************************I*/
PGASetDebugFlag64(PGAContext * ctx,int Flag)1447 void PGASetDebugFlag64(PGAContext *ctx, int Flag)
1448 {
1449 ctx->debug.PGADebugFlags[700] = Flag; /*PGAError*/
1450 ctx->debug.PGADebugFlags[702] = Flag; /*PGAUsage*/
1451 ctx->debug.PGADebugFlags[703] = Flag; /*PGAPrintVersionNumber*/
1452 ctx->debug.PGADebugFlags[704] = Flag; /*PGAGetMaxMachineIntValue*/
1453 ctx->debug.PGADebugFlags[705] = Flag; /*PGAGetMinMachineIntValue*/
1454 ctx->debug.PGADebugFlags[706] = Flag; /*PGAGetMaxMachineDoubleValue*/
1455 ctx->debug.PGADebugFlags[707] = Flag; /*PGAGetMinMachineDoubleValue*/
1456 ctx->debug.PGADebugFlags[708] = Flag; /*PGADestroy*/
1457 ctx->debug.PGADebugFlags[730] = Flag; /*PGAReadCmdLine*/
1458 ctx->debug.PGADebugFlags[731] = Flag; /*PGAParseDebugArg*/
1459 ctx->debug.PGADebugFlags[732] = Flag; /*PGAStripArgs*/
1460 }
1461
1462 /*I****************************************************************************
1463 PGASetDebugFlag66 - Set the debug flags for all functions at debug level 66
1464
1465 Inputs:
1466 ctx - Context variable
1467 Flag - PGA_TRUE to enable or PGA_FALSE to disable
1468
1469 Outputs:
1470
1471 Example:
1472
1473 ****************************************************************************I*/
PGASetDebugFlag66(PGAContext * ctx,int Flag)1474 void PGASetDebugFlag66(PGAContext *ctx, int Flag)
1475 {
1476 ctx->debug.PGADebugFlags[710] = Flag; /*PGAMean*/
1477 ctx->debug.PGADebugFlags[711] = Flag; /*PGAStddev*/
1478 ctx->debug.PGADebugFlags[712] = Flag; /*PGACopyIndividual*/
1479 ctx->debug.PGADebugFlags[713] = Flag; /*PGARound*/
1480 ctx->debug.PGADebugFlags[714] = Flag; /*PGACheckSum*/
1481 ctx->debug.PGADebugFlags[715] = Flag; /*PGAGetWorstIndex*/
1482 ctx->debug.PGADebugFlags[716] = Flag; /*PGAGetBestIndex*/
1483 ctx->debug.PGADebugFlags[717] = Flag; /*PGAGetIndividual*/
1484 ctx->debug.PGADebugFlags[718] = Flag; /*PGAUpdateAverage*/
1485 ctx->debug.PGADebugFlags[719] = Flag; /*PGAUpdateOnline*/
1486 ctx->debug.PGADebugFlags[720] = Flag; /*PGAUpdateOffline*/
1487 ctx->debug.PGADebugFlags[721] = Flag; /*PGAComputeSimilarity*/
1488 }
1489 #endif
1490
1491 /*I****************************************************************************
1492 PGAPrintDebugOptions - prints the list of available debug options
1493
1494 Inputs:
1495 ctx - context variable
1496
1497 Outputs:
1498 list of available debug options
1499
1500 Example:
1501 PGAContext ctx;
1502 :
1503 PGAPrintDebugOptions(ctx);
1504
1505 ****************************************************************************I*/
PGAPrintDebugOptions(PGAContext * ctx)1506 void PGAPrintDebugOptions(PGAContext *ctx)
1507 {
1508 PGADebugEntered("PGAPrintDebugOptions");
1509
1510 #if OPTIMIZE==0
1511 fprintf(stderr, " 0 Trace all debug prints\n");
1512 fprintf(stderr, "\n");
1513 fprintf(stderr, " 1 Reserved for the user\n");
1514 fprintf(stderr, " : :\n");
1515 fprintf(stderr, " 10 Reserved for the user\n");
1516 fprintf(stderr, " 11 Trace high-level functions\n");
1517 fprintf(stderr, "\n");
1518 fprintf(stderr, " 20 Trace high-level parallel functions\n");
1519 fprintf(stderr, " 21 Trace all parallel functions\n");
1520 fprintf(stderr, "\n");
1521 fprintf(stderr, " 30 Trace BINARY functions\n");
1522 fprintf(stderr, " 32 Trace INTEGER functions\n");
1523 fprintf(stderr, " 34 Trace REAL functions\n");
1524 fprintf(stderr, " 36 Trace CHARACTER functions\n");
1525 fprintf(stderr, "\n");
1526 fprintf(stderr, " 40 Trace population creation functions\n");
1527 fprintf(stderr, " 42 Trace select functions\n");
1528 fprintf(stderr, " 44 Trace mutation functions\n");
1529 fprintf(stderr, " 46 Trace crossover functions\n");
1530 fprintf(stderr, " 48 Trace function evaluation functions\n");
1531 fprintf(stderr, " 50 Trace fitness calculation functions\n");
1532 fprintf(stderr, " 52 Trace duplicate checking functions\n");
1533 fprintf(stderr, " 54 Trace restart functions\n");
1534 fprintf(stderr, " 56 Trace reporting functions\n");
1535 fprintf(stderr, " 58 Trace stopping functions\n");
1536 fprintf(stderr, " 60 Trace sorting functions\n");
1537 fprintf(stderr, " 62 Trace random number functions\n");
1538 fprintf(stderr, " 64 Trace system routines\n");
1539 fprintf(stderr, " 66 Trace utility functions\n");
1540 fprintf(stderr, "\n");
1541 fprintf(stderr, " 80 Trace memory allocations\n");
1542 fprintf(stderr, " 82 Trace variable print statements\n");
1543 #else
1544 fprintf(stderr, " Optimized version; no debug options.\n");
1545 #endif
1546 PGADestroy(ctx);
1547 exit(0);
1548 }
1549
1550