source: trunk/packages/optimizer/src/pgapack/gekco/pgapack/source/debug.c @ 5673

Last change on this file since 5673 was 5673, checked in by ldelgass, 9 years ago

Fix line endings, set eol-style to native on all C/C++ sources.

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