/*****************************************************************************
*     FILE: debug.c: This file contains routines for debugging
*
*     Authors: David M. Levine, Philip L. Hallstrom, David M. Noelle
******************************************************************************/
#include "pgapack.h"

typedef struct
{
	char PGAFuncName[30];
	int PGAFuncNum;
} PGAFuncRec;

PGAFuncRec PGAFuncIndex[PGADEBUG_MAXPROCS] =
{
        { "PGAChange", 101 },
	{ "PGAEvaluate", 103 },
	{ "PGACreate", 104 },
	{ "PGASetUp", 105 },
	{ "PGACreatePop", 106 },
	{ "PGACreateIndividual", 107 },
	{ "PGARun", 108 },
	{ "PGARunMutateAndCross", 109 },
	{ "PGARunMutateOrCross", 110 },
	{ "PGAGetIndividual", 111 },
	{ "PGACopyIndividual", 112 },
	{ "PGASelect", 113 },
	{ "PGASelectNext", 114 },
	{ "PGASelectProportional", 115 },
	{ "PGASelectSUS", 116 },
	{ "PGASelectTournament", 117 },
	{ "PGASelectPTournament", 118 },
	{ "PGACrossover", 119 },
	{ "PGAUpdateGeneration", 120 },
	{ "PGADestroy", 121 },
	{ "PGADuplicate", 122 },
	{ "PGAMutate", 123 },
	{ "PGAFitness", 124 },
	{ "PGAFitnessLinNor", 125 },
	{ "PGAFitnessLinRank", 126 },
	{ "PGAFitnessMinRecprl", 127 },
	{ "PGAFitnessMinCmax", 128 },
	{ "PGARank", 129 },
	{ "PGAMean", 130 },
	{ "PGAStddev", 131 },
	{ "PGADone", 132 },
	{ "PGAHammingDistance", 133 },
	{ "PGAPopAddress", 134 },
	{ "PGASetEvaluate", 135 },
	{ "PGAUpdateOnline", 136 },
	{ "PGAUpdateOffline", 137 },
	{ "PGAComputeSimilarity", 138 },
	{ "PGAGetBest", 139 },
        { "PGAGetWorst", 140 },
	{ "PGAReseedPopulation", 141 },     
	{ "PGABinaryCreateString", 201 },
	{ "PGABinaryCopyString", 202 },
	{ "PGABinaryRandomize", 203 },
	{ "PGABinarySendIndividual", 204 },
	{ "PGABinaryReceiveIndividual", 205 },
	{ "PGAGetBinaryAllele", 206 },
	{ "PGASetBinaryAllele", 207 },
	{ "PGABinaryMutation", 208 },
	{ "PGABinaryOneptCrossover", 209 },
	{ "PGABinaryTwoptCrossover", 210 },
	{ "PGABinaryUniformCrossover", 211 },
	{ "PGABinaryHammingDistance", 212 },
	{ "PGABinaryWriteString", 213 },
	{ "PGABinaryWrite", 214 },
	{ "PGABinaryDuplicate", 215 },
	{ "PGAGetRealFromBinary", 216 },
	{ "PGAGetRealFromGrayCode", 217 },
	{ "PGAEncodeRealAsBinary", 218 },
	{ "PGAEncodeRealAsGrayCode", 219 },
        { "PGAMapRealToInt", 220 },
        { "PGAMapIntToReal", 221 },
	{ "PGAGetIntegerFromBinary", 222 },
        { "PGAGetIntegerFromGrayCode", 223 },
        { "PGAEncodeIntegerAsBinary", 224 },
        { "PGAEncodeIntegerAsGrayCode", 225 },
	{ "PGAIntegerCreateString", 301 },
	{ "PGAIntegerCopyString", 302 },
	{ "PGAIntegerRandomize", 303 },
	{ "PGAIntegerSendIndividual", 304 },
	{ "PGAIntegerReceiveIndividual", 305 },
	{ "PGAGetIntegerAllele", 306 },
	{ "PGASetIntegerAllele", 307 },
	{ "PGAIntegerMutation", 308 },
	{ "PGAIntegerOneptCrossover", 309 },
	{ "PGAIntegerTwoptCrossover", 310 },
	{ "PGAIntegerUniformCrossover", 311 },
	{ "PGAIntegerWriteString", 312 },
	{ "PGAIntegerDuplicate", 313 },
        { "PGASetIntegerInitLU", 314 },
        { "PGASetIntegerInitPermute", 315 },
	{ "PGARealCreateString", 401 },
	{ "PGARealCopyString", 402 },
	{ "PGARealRandomize", 403 },
	{ "PGARealSendIndividual", 404 },
	{ "PGARealReceiveIndividual", 405 },
	{ "PGAGetRealAllele", 406 },
	{ "PGASetRealAllele", 407 },
	{ "PGARealMutation", 408 },
	{ "PGARealOneptCrossover", 409 },
	{ "PGARealTwoptCrossover", 410 },
	{ "PGARealUniformCrossover", 411 },
	{ "PGARealWriteString", 412 },
	{ "PGARealDuplicate", 413 },
        { "PGASetRealInitLU", 414 },
        { "PGASetRealInitPercent", 415 },
	{ "PGAParallelSetUp", 501 },
	{ "PGAStringToSend", 502 },
	{ "PGAStringToReplace", 503 },
	{ "PGABest", 504 },
	{ "PGAWorst", 505 },
	{ "PGANumSubpopulations", 506 },
	{ "PGAExchange", 507 },
	{ "PGASendIndividual", 508 },
	{ "PGAReceiveIndividual", 509 },
	{ "PGAMakeMesh", 510 },
	{ "PGAPower2", 511 },
	{ "PGAError", 601 },
	{ "PGADebugPrint", 602 },
	{ "PGAExit", 603 },
	{ "PGAPrintContext", 604 },
	{ "PGAPrintIndividual", 605 },
	{ "PGAWriteString", 606 },
	{ "PGARandomFlip", 607 },
	{ "PGARandomInterval", 608 },
	{ "PGARandom01", 609 },
	{ "PGAReadCmdLine", 610 },
	{ "PGAStripArgs", 611 },
	{ "PGAUsage", 612 },
	{ "PGAPrintVersion", 613 },
	{ "PGAPrintPopulation", 614 },
	{ "PGAPrintDebugOptions", 615 },
        { "PGAParseDebugArg", 616 },
        { "PGARandomGaussian", 617 },
        { "PGARandomUniform", 618 },
        { "PGASetSupportingDebugFlags", 622 },
	{ "PGASortPop", 631 },
	{ "PGAGetSortPop", 632 },
	{ "PGAIntHeapSort", 633 },
	{ "PGAIntHeapify", 634 },
	{ "PGAIntAdjustHeap", 635 },
	{ "PGADblHeapSort", 636 },
	{ "PGADblHeapify", 637 },
	{ "PGADblAdjustHeap", 638 },
	{ "PGASetPopSize", 701 },
	{ "PGASetStoppingRule", 702 },
	{ "PGASetMaxIter", 703 },
	{ "PGASetNumReplace", 704 },
	{ "PGASetCrossoverType", 705 },
	{ "PGASetSelectType", 709 },
	{ "PGASetFitnessType", 710 },
	{ "PGASetMutationType", 711 },
	{ "PGASetMutateOnlyNoCross", 712 },
	{ "PGASetMutationRealVal", 713 },
	{ "PGASetMutationProb", 714 },
	{ "PGASetCrossoverProb", 715 },
	{ "PGASetUniformCrossProb", 716 },
	{ "PGASetFitnessRankMax", 717 },
	{ "PGASetPopReplacement", 718 },
	{ "PGASetNumExchange", 719 },
	{ "PGASetFreqExchange", 720 },
	{ "PGASetStringToSend", 721 },
	{ "PGASetStringToReplace", 722 },
	{ "PGASetTopology", 723 },
	{ "PGASetPrintOptions", 724 },
	{ "PGASetPrintFreq", 725 },
	{ "PGASetDebugLevel", 726 },
	{ "PGASetRandomSeed", 727 },
	{ "PGASetUserCrossover", 728 },
        { "PGASetBinaryInitProb", 729 },
        { "PGASetEvalUpToDate", 730 },
        { "PGASetFitnessMinType", 731 },
	{ "PGASetMaxNoChange", 732 },
        { "PGASetMaxSimilarity", 733 },
        { "PGASetMutationIntegerVal", 734 },
        { "PGASetNoDuplicates", 735 },
        { "PGASetPTournamentProb", 736 },
        { "PGASetRandomInit", 737 },
        { "PGASetUserFunction", 738 },
	{ "PGAGetDataType", 801 },
	{ "PGAGetOptDir", 802 },
	{ "PGAGetPopSize", 803 },
	{ "PGAGetStringLen", 804 },
	{ "PGAGetStoppingRule", 805 },
	{ "PGAGetMaxIter", 806 },
	{ "PGAGetNumReplace", 807 },
	{ "PGAGetCrossoverType", 808 },
	{ "PGAGetSelectType", 812 },
	{ "PGAGetFitnessType", 813 },
	{ "PGAGetFitnessMinType", 814 },
	{ "PGAGetMutationType", 815 },
	{ "PGAGetMutateOnlyNoCross", 816 },
	{ "PGAGetMutateRealVal", 817 },
	{ "PGAGetNoDuplicates", 818 },
	{ "PGAGetMutationProb", 819 },
	{ "PGAGetCrossoverProb", 820 },
	{ "PGAGetUniformCrossProb", 821 },
	{ "PGAGetFitnessRankMax", 822 },
	{ "PGAGetPopReplace", 823 },
	{ "PGAGetIter", 824 },
	{ "PGAGetMaxInt", 825 },
	{ "PGAGetMinInt", 826 },
	{ "PGAGetMaxDouble", 827 },
	{ "PGAGetMinDouble", 828 },
	{ "PGAGetPrintString", 829 },
	{ "PGAGetPrintFreq", 830 },
	{ "PGAGetRandomInit", 831 },
	{ "PGAGetBinaryInitProb", 832 },
	{ "PGAGetIntegerType", 833 },
	{ "PGAGetInitIntegerMin", 834 },
	{ "PGAGetInitIntegerMax", 835 },
	{ "PGAGetInitRealMin", 836 },
	{ "PGAGetInitRealMax", 837 },
	{ "PGAGetRandomSeed", 838 },
	{ "PGAGetPID", 839 },
	{ "PGAGetNprocs", 840 },
	{ "PGAGetNumExchange", 841 },
	{ "PGAGetFreqExchange", 842 },
	{ "PGAGetStringToSend", 843 },
	{ "PGAGetStringToReplace", 844 },
	{ "PGAGetTopology", 845 },
	{ "PGAGetEvaluate", 846 },
	{ "PGAGetFitness", 847 },
	{ "PGAGetEvalUpToDate", 848 },
        { "PGAGetMutateIntegerVal", 849 },
        { "PGAGetPTournamentProb", 850 },
};

#ifndef OPTIMIZE
/*U****************************************************************************
  PGADebugPrint - Writes debugging prints

  Category: Debugging

  Inputs:
     ctx - context variable
     level - a symbolic constant that maps to the type of print requested
             (e.g., an entry or exit print)
     funcname - the name of the function that called this routines
     msg - a message that will be printed
     datatype - a symbolic constant that maps to the data type of the
                parameter data
     data - a pointer, whose contents will be interpreted based upon the
            datatype parameter

  Outputs:

  Example:
     Print the value of the int variable num as a debugging tool in the routine
     Add2Nums

     PGAContext *ctx;
     int num;
     PGADebugPrint(ctx, PGADEBUG_PRINTVAR, "Add2Nums", "num = ", PGA_INT,
                   (void *) &num);
     
****************************************************************************U*/
void PGADebugPrint( PGAContext *ctx, int level, char *funcname,
		   char *msg, int datatype, void *data )
{
     /*
	 0                       Trace ALL debugging messages
	 1--10                   Reserved
	11--20                   Basic event (enter, exit, malloc) traces
	21--30                   Print variables
	31--40                   Trace basic events and variables in low-level 
	41--50                   Parallel event traces
	51--60                   Trace groups of routines
	61--70                   Start up type routines
	71--90                   Generic high-level routines
	91--100                  Parallel routines
   */
	if (ctx->debug.PGADebugFlags[level] || PGAGetDebugFlag (ctx, funcname)
        || ctx->debug.PGADebugFlags[0]) {
        switch (datatype) {
            case PGA_VOID:
                fprintf(stdout, "%4d: %-32s: %s\n",
                        0, funcname, msg);
                break;
            case PGA_INT:
                switch (*(int *) data) {
                case PGA_TEMP1:
                    fprintf(stdout, "%4d: %-32s: %s PGA_TEMP1\n",
                            0, funcname, msg);
                    break;
                case PGA_TEMP2:
                    fprintf(stdout, "%4d: %-32s: %s PGA_TEMP2\n",
                            0, funcname, msg);
                    break;
                case PGA_OLDPOP:
                    fprintf(stdout, "%4d: %-32s: %s PGA_OLDPOP\n",
                            0, funcname, msg);
                    break;
                case PGA_NEWPOP:
                    fprintf(stdout, "%4d: %-32s: %s PGA_NEWPOP\n",
                            0, funcname, msg);
                    break;
                default:
                    fprintf(stdout, "%4d: %-32s: %s %d\n",
                            0, funcname, msg, *(int *) data);
                    break;
                }
                break;
            case PGA_DOUBLE:
                fprintf(stdout, "%4d: %-32s: %s %e\n",
                        0, funcname, msg, *(double *) data);
                break;
            case PGA_CHAR:
                fprintf(stdout, "%4d: %-32s: %s %s\n",
                        0, funcname, msg,  (char *) data);
                break;
            default:
                PGAError( ctx, "PGADebugPrint: Invalid value of datatype:",
                          PGA_FATAL, PGA_INT, (void *) &datatype );
                break;
        }
    }
}
#endif

/*I****************************************************************************
  PGAGetDebugFlag - checks whether the flag to do a debug print in routine
  funcname has been set.  Returns a 1 if so, otherwise a 0.

  Inputs:
     ctx - context variable
     funcname - name of the function in question

  Outputs:

  Example:
     PGAContext *ctx;
     char *funcname;
     int IsItSet;

     IsItSet = PGAGetDebugFlag(ctx, "Add2Nums");

****************************************************************************I*/
int PGAGetDebugFlag(PGAContext *ctx, char *funcname)
{
     int i, found=PGAFALSE, flag = PGAFALSE;
     for (i = 0; i < PGADEBUG_MAXPROCS && !found; i++)
	  if (!strcmp (funcname, PGAFuncIndex[i].PGAFuncName))
	       found = PGATRUE;
     if (found)
	  flag = ctx->debug.PGADebugFlags[PGAFuncIndex[i-1].PGAFuncNum];
     else
	  PGAError(ctx, "PGAGetDebugFlag: Function missing from PGAFuncIndex:",
		   PGA_WARNING, PGA_CHAR, (void *) funcname);
     return flag;
}

/*I****************************************************************************
  PGASetSupportingDebugFlags - sets the corresponding low-levels flags that
  the already set high-level flags imply

  Inputs:
     ctx - context variable

  Outputs:

  Example:
     PGAContext *ctx;
     PGASetSupportingDebugFlags(ctx);

****************************************************************************I*/
void PGASetSupportingDebugFlags(PGAContext *ctx)
{
     if (ctx->debug.PGADebugFlags[51])	/* Trace generic routines */
     {
	  ctx->debug.PGADebugFlags[104] = PGATRUE; /*PGACreate*/
	  ctx->debug.PGADebugFlags[105] = PGATRUE; /*PGASetUp*/
	  ctx->debug.PGADebugFlags[108] = PGATRUE; /*PGARun*/
	  ctx->debug.PGADebugFlags[109] = PGATRUE; /*PGARunMutateAndCross*/
	  ctx->debug.PGADebugFlags[110] = PGATRUE; /*PGARunMutateOrCross*/
	  ctx->debug.PGADebugFlags[113] = PGATRUE; /*PGASelect*/
	  ctx->debug.PGADebugFlags[112] = PGATRUE; /*PGACopyIndividual*/
	  ctx->debug.PGADebugFlags[119] = PGATRUE; /*PGACrossover*/
	  ctx->debug.PGADebugFlags[123] = PGATRUE; /*PGAMutate*/
	  ctx->debug.PGADebugFlags[122] = PGATRUE; /*PGADuplicate*/
	  ctx->debug.PGADebugFlags[103] = PGATRUE; /*PGAEvaluate*/
	  ctx->debug.PGADebugFlags[124] = PGATRUE; /*PGAFitness*/
	  ctx->debug.PGADebugFlags[133] = PGATRUE; /*PGAHammingDistance*/
	  ctx->debug.PGADebugFlags[631] = PGATRUE; /*PGASortPop*/
	  ctx->debug.PGADebugFlags[632] = PGATRUE; /*PGAGetSortPop*/
	  ctx->debug.PGADebugFlags[120] = PGATRUE; /*PGAUpdateGeneration*/
	  ctx->debug.PGADebugFlags[132] = PGATRUE; /*PGADone*/
	  ctx->debug.PGADebugFlags[501] = PGATRUE; /*PGAParallelSetUp*/
	  ctx->debug.PGADebugFlags[507] = PGATRUE; /*PGAExchange*/
	  ctx->debug.PGADebugFlags[508] = PGATRUE; /*PGASendIndividual*/
	  ctx->debug.PGADebugFlags[509] = PGATRUE; /*PGAReceiveIndividual*/
     }
     
     if (ctx->debug.PGADebugFlags[52])	/* Trace parallel routines */
     {
	  ctx->debug.PGADebugFlags[501] = PGATRUE; /*PGAParallelSetUp*/
	  ctx->debug.PGADebugFlags[507] = PGATRUE; /*PGAExchange*/
	  ctx->debug.PGADebugFlags[508] = PGATRUE; /*PGASendIndividual*/
	  ctx->debug.PGADebugFlags[509] = PGATRUE; /*PGAReceiveIndividual*/
     }
     
     if (ctx->debug.PGADebugFlags[53])	/* Trace Binary specific routines */
     {
	  ctx->debug.PGADebugFlags[201] = PGATRUE; /*PGABinaryCreateString*/
	  ctx->debug.PGADebugFlags[202] = PGATRUE; /*PGABinaryCopyString*/
	  ctx->debug.PGADebugFlags[203] = PGATRUE; /*PGABinaryRandomize*/
	  ctx->debug.PGADebugFlags[204] = PGATRUE; /*PGABinarySendIndividual*/
	  ctx->debug.PGADebugFlags[205] = PGATRUE; /*PGABinaryReceiveIndividual*/
	  ctx->debug.PGADebugFlags[206] = PGATRUE; /*PGAGetBinaryAllele*/
	  ctx->debug.PGADebugFlags[207] = PGATRUE; /*PGASetBinaryAllele*/
	  ctx->debug.PGADebugFlags[208] = PGATRUE; /*PGABinaryMutation*/
	  ctx->debug.PGADebugFlags[209] = PGATRUE; /*PGABinaryOneptCrossover*/
	  ctx->debug.PGADebugFlags[210] = PGATRUE; /*PGABinaryTwoptCrossover*/
	  ctx->debug.PGADebugFlags[211] = PGATRUE; /*PGABinaryUniformCrossover*/
	  ctx->debug.PGADebugFlags[212] = PGATRUE; /*PGABinaryHammingDistance*/
	  ctx->debug.PGADebugFlags[213] = PGATRUE; /*PGABinaryWriteString*/
	  ctx->debug.PGADebugFlags[214] = PGATRUE; /*PGABinaryWrite*/
	  ctx->debug.PGADebugFlags[215] = PGATRUE; /*PGABinaryDuplicate*/
     }
     
     if (ctx->debug.PGADebugFlags[54])	/* Trace Integer specific routines */
     {
	  ctx->debug.PGADebugFlags[301] = PGATRUE; /*PGAIntegerCreateString*/
	  ctx->debug.PGADebugFlags[302] = PGATRUE; /*PGAIntegerCopyString*/
	  ctx->debug.PGADebugFlags[303] = PGATRUE; /*PGAIntegerRandomize*/
	  ctx->debug.PGADebugFlags[304] = PGATRUE; /*PGAIntegerSendIndividual*/
	  ctx->debug.PGADebugFlags[305] = PGATRUE; /*PGAIntegerReceiveIndividual*/
	  ctx->debug.PGADebugFlags[306] = PGATRUE; /*PGAGetIntegerAllele*/
	  ctx->debug.PGADebugFlags[307] = PGATRUE; /*PGASetIntegerAllele*/
	  ctx->debug.PGADebugFlags[308] = PGATRUE; /*PGAIntegerMutation*/
	  ctx->debug.PGADebugFlags[309] = PGATRUE; /*PGAIntegerOneptCrossover*/
	  ctx->debug.PGADebugFlags[310] = PGATRUE; /*PGAIntegerTwoptCrossover*/
	  ctx->debug.PGADebugFlags[311] = PGATRUE; /*PGAIntegerUniformCrossover*/
	  ctx->debug.PGADebugFlags[312] = PGATRUE; /*PGAIntegerWriteString*/
	  ctx->debug.PGADebugFlags[313] = PGATRUE; /*PGAIntegerDuplicate*/
     }
     
     if (ctx->debug.PGADebugFlags[55])	/* Trace REAL specific routines */
     {
	  ctx->debug.PGADebugFlags[401] = PGATRUE; /*PGARealCreateString*/
	  ctx->debug.PGADebugFlags[402] = PGATRUE; /*PGARealCopyString*/
	  ctx->debug.PGADebugFlags[403] = PGATRUE; /*PGARealRandomize*/
	  ctx->debug.PGADebugFlags[404] = PGATRUE; /*PGARealSendIndividual*/
	  ctx->debug.PGADebugFlags[405] = PGATRUE; /*PGARealReceiveIndividual*/
	  ctx->debug.PGADebugFlags[406] = PGATRUE; /*PGAGetRealAllele*/
	  ctx->debug.PGADebugFlags[407] = PGATRUE; /*PGASetRealAllele*/
	  ctx->debug.PGADebugFlags[408] = PGATRUE; /*PGARealMutation*/
	  ctx->debug.PGADebugFlags[409] = PGATRUE; /*PGARealOneptCrossover*/
	  ctx->debug.PGADebugFlags[410] = PGATRUE; /*PGARealTwoptCrossover*/
	  ctx->debug.PGADebugFlags[411] = PGATRUE; /*PGARealUniformCrossover*/
	  ctx->debug.PGADebugFlags[412] = PGATRUE; /*PGARealWriteString*/
	  ctx->debug.PGADebugFlags[413] = PGATRUE; /*PGARealDuplicate*/
     }
     
     if (ctx->debug.PGADebugFlags[56])	/* Trace random number routines */
     {
	  ctx->debug.PGADebugFlags[607] = PGATRUE; /*PGARandomFlip*/
	  ctx->debug.PGADebugFlags[608] = PGATRUE; /*PGARandomInterval*/
	  ctx->debug.PGADebugFlags[609] = PGATRUE; /*PGARandom01*/
     }
     
     if (ctx->debug.PGADebugFlags[61])	/* PGACreate */
     {
	  ctx->debug.PGADebugFlags[104] = PGATRUE; /*PGACreate*/
	  ctx->debug.PGADebugFlags[106] = PGATRUE; /*PGACreatePop*/
	  ctx->debug.PGADebugFlags[107] = PGATRUE; /*PGACreateIndividual*/
	  ctx->debug.PGADebugFlags[201] = PGATRUE; /*PGABinaryCreateString*/
	  ctx->debug.PGADebugFlags[301] = PGATRUE; /*PGAIntegerCreateString*/
	  ctx->debug.PGADebugFlags[401] = PGATRUE; /*PGARealCreateString*/
	  ctx->debug.PGADebugFlags[203] = PGATRUE; /*PGABinaryRandomize*/
	  ctx->debug.PGADebugFlags[303] = PGATRUE; /*PGAIntegerRandomize*/
	  ctx->debug.PGADebugFlags[403] = PGATRUE; /*PGARealRandomize*/
     }
     
     if (ctx->debug.PGADebugFlags[62])	/* PGASetUp */
	  ctx->debug.PGADebugFlags[105] = PGATRUE; /*PGASetUp*/
     
     if (ctx->debug.PGADebugFlags[70])	/* PGARun */
	  ctx->debug.PGADebugFlags[108] = PGATRUE; /*PGARun*/
     
     if (ctx->debug.PGADebugFlags[71])	/* PGARunMutateAndCross */
	  ctx->debug.PGADebugFlags[109] = PGATRUE; /*PGARunMutateAndCross*/
     
     if (ctx->debug.PGADebugFlags[72])	/* PGARunMutateOrCross */
	  ctx->debug.PGADebugFlags[110] = PGATRUE; /*PGARunMutateOrCross*/
     
     if (ctx->debug.PGADebugFlags[73])	/* PGASelect */
     {
	  ctx->debug.PGADebugFlags[113] = PGATRUE; /*PGASelect*/
	  ctx->debug.PGADebugFlags[114] = PGATRUE; /*PGASelectNext*/
	  ctx->debug.PGADebugFlags[115] = PGATRUE; /*PGASelectProportional*/
	  ctx->debug.PGADebugFlags[116] = PGATRUE; /*PGASelectSUS*/
	  ctx->debug.PGADebugFlags[117] = PGATRUE; /*PGASelectTournament*/
	  ctx->debug.PGADebugFlags[118] = PGATRUE; /*PGASelectPTournament*/
     }
     
     if (ctx->debug.PGADebugFlags[74])	/* PGACopyIndividual */
     {
	  ctx->debug.PGADebugFlags[112] = PGATRUE; /*PGACopyIndividual*/
	  ctx->debug.PGADebugFlags[202] = PGATRUE; /*PGABinaryCopyString*/
	  ctx->debug.PGADebugFlags[302] = PGATRUE; /*PGAIntegerCopyString*/
	  ctx->debug.PGADebugFlags[402] = PGATRUE; /*PGARealCopyString*/
     }
     
     if (ctx->debug.PGADebugFlags[75])	/* PGACrossover */
     {
	  ctx->debug.PGADebugFlags[119] = PGATRUE; /*PGACrossover*/
	  ctx->debug.PGADebugFlags[209] = PGATRUE; /*PGABinaryOneptCrossover*/
	  ctx->debug.PGADebugFlags[210] = PGATRUE; /*PGABinaryTwoptCrossover*/
	  ctx->debug.PGADebugFlags[211] = PGATRUE; /*PGABinaryUniformCrossover*/
	  ctx->debug.PGADebugFlags[309] = PGATRUE; /*PGAIntegerOneptCrossover*/
	  ctx->debug.PGADebugFlags[310] = PGATRUE; /*PGAIntegerTwoptCrossover*/
	  ctx->debug.PGADebugFlags[311] = PGATRUE; /*PGAIntegerUniformCrossover*/
	  ctx->debug.PGADebugFlags[409] = PGATRUE; /*PGARealOneptCrossover*/
	  ctx->debug.PGADebugFlags[410] = PGATRUE; /*PGARealTwoptCrossover*/
	  ctx->debug.PGADebugFlags[411] = PGATRUE; /*PGARealUniformCrossover*/
     }
     
     if (ctx->debug.PGADebugFlags[76])	/* PGAMutate */
     {
	  ctx->debug.PGADebugFlags[123] = PGATRUE; /*PGAMutate*/
	  ctx->debug.PGADebugFlags[208] = PGATRUE; /*PGABinaryMutation*/
	  ctx->debug.PGADebugFlags[308] = PGATRUE; /*PGAIntegerMutation*/
	  ctx->debug.PGADebugFlags[408] = PGATRUE; /*PGARealMutation*/
     }
     
     if (ctx->debug.PGADebugFlags[77])	/* PGADuplicate */
     {
	  ctx->debug.PGADebugFlags[122] = PGATRUE; /*PGADuplicate*/
	  ctx->debug.PGADebugFlags[101] = PGATRUE; /*PGAChange*/
	  ctx->debug.PGADebugFlags[215] = PGATRUE; /*PGABinaryDuplicate*/
	  ctx->debug.PGADebugFlags[313] = PGATRUE; /*PGAIntegerDuplicate*/
	  ctx->debug.PGADebugFlags[413] = PGATRUE; /*PGARealDuplicate*/
     }
     
     if (ctx->debug.PGADebugFlags[78])	/* PGAEvaluate */
	  ctx->debug.PGADebugFlags[103] = PGATRUE; /*PGAEvaluate*/
     
     if (ctx->debug.PGADebugFlags[79])	/* PGAFitness */
     {
	  ctx->debug.PGADebugFlags[124] = PGATRUE; /*PGAFitness*/
	  ctx->debug.PGADebugFlags[125] = PGATRUE; /*PGAFitnessLinNor*/
	  ctx->debug.PGADebugFlags[126] = PGATRUE; /*PGAFitnessLinRank*/
	  ctx->debug.PGADebugFlags[127] = PGATRUE; /*PGAFitnessMinRecprl*/
	  ctx->debug.PGADebugFlags[128] = PGATRUE; /*PGAFitnessMinCmax*/
	  ctx->debug.PGADebugFlags[129] = PGATRUE; /*PGARank*/
     }
     
     if (ctx->debug.PGADebugFlags[80])	/* PGAHammingDistance */
     {
	  ctx->debug.PGADebugFlags[133] = PGATRUE; /*PGAHammingDistance*/
	  ctx->debug.PGADebugFlags[212] = PGATRUE; /*PGABinaryHammingDistance*/
     }
     
     if (ctx->debug.PGADebugFlags[82])	/* PGASortPop */
     {
	  ctx->debug.PGADebugFlags[633] = PGATRUE; /*PGAIntHeapSort*/
	  ctx->debug.PGADebugFlags[634] = PGATRUE; /*PGAIntHeapify*/
	  ctx->debug.PGADebugFlags[635] = PGATRUE; /*PGAIntAdjustHeap*/
	  ctx->debug.PGADebugFlags[636] = PGATRUE; /*PGADblHeapSort*/
	  ctx->debug.PGADebugFlags[637] = PGATRUE; /*PGADblHeapify*/
	  ctx->debug.PGADebugFlags[638] = PGATRUE; /*PGADblAdjustHeap*/
     }
     
     if (ctx->debug.PGADebugFlags[83])	/* PGAGetSortPop */
	  ctx->debug.PGADebugFlags[632] = PGATRUE; /*PGAGetSortPop*/
     
     if (ctx->debug.PGADebugFlags[84])	/* PGAUpdateGeneration */
	  ctx->debug.PGADebugFlags[120] = PGATRUE; /*PGAUpdateGeneration*/
     
     if (ctx->debug.PGADebugFlags[85])	/* PGADone */
	  ctx->debug.PGADebugFlags[132] = PGATRUE; /*PGADone*/
     
     if (ctx->debug.PGADebugFlags[90])	/* PGAParallelSetUp */
     {
	  ctx->debug.PGADebugFlags[501] = PGATRUE; /*PGAParallelSetUp*/
	  ctx->debug.PGADebugFlags[506] = PGATRUE; /*PGANumSubpopulations*/
	  ctx->debug.PGADebugFlags[510] = PGATRUE; /*PGAMakeMesh*/
	  ctx->debug.PGADebugFlags[511] = PGATRUE; /*PGAPower2*/
     }
     
     if (ctx->debug.PGADebugFlags[91])	/* PGAExchange */
     {
	  ctx->debug.PGADebugFlags[507] = PGATRUE; /*PGAExchange*/
	  ctx->debug.PGADebugFlags[502] = PGATRUE; /*PGAStringToSend*/
	  ctx->debug.PGADebugFlags[503] = PGATRUE; /*PGAStringToReplace*/
	  ctx->debug.PGADebugFlags[504] = PGATRUE; /*PGABest*/
	  ctx->debug.PGADebugFlags[505] = PGATRUE; /*PGAWorst*/
	  ctx->debug.PGADebugFlags[508] = PGATRUE; /*PGASendIndividual*/
	  ctx->debug.PGADebugFlags[204] = PGATRUE; /*PGABinarySendIndividual*/
	  ctx->debug.PGADebugFlags[304] = PGATRUE; /*PGAIntegerSendIndividual*/
	  ctx->debug.PGADebugFlags[404] = PGATRUE; /*PGARealSendIndividual*/
	  ctx->debug.PGADebugFlags[509] = PGATRUE; /*PGAReceiveIndividual*/
	  ctx->debug.PGADebugFlags[205] = PGATRUE; /*PGABinaryReceiveIndividual*/
	  ctx->debug.PGADebugFlags[305] = PGATRUE; /*PGAIntegerReceiveIndividual*/
	  ctx->debug.PGADebugFlags[405] = PGATRUE; /*PGARealReceiveIndividual*/
     }
     
     if (ctx->debug.PGADebugFlags[92])	/* PGASendIndividual */
     {
	  ctx->debug.PGADebugFlags[508] = PGATRUE; /*PGASendIndividual*/
	  ctx->debug.PGADebugFlags[204] = PGATRUE; /*PGABinarySendIndividual*/
	  ctx->debug.PGADebugFlags[304] = PGATRUE; /*PGAIntegerSendIndividual*/
	  ctx->debug.PGADebugFlags[404] = PGATRUE; /*PGARealSendIndividual*/
     }
     
     if (ctx->debug.PGADebugFlags[93])	/* PGAReceiveIndividual */
     {
	  ctx->debug.PGADebugFlags[509] = PGATRUE; /*PGAReceiveIndividual*/
	  ctx->debug.PGADebugFlags[205] = PGATRUE; /*PGABinaryReceiveIndividual*/
	  ctx->debug.PGADebugFlags[305] = PGATRUE; /*PGAIntegerReceiveIndividual*/
	  ctx->debug.PGADebugFlags[405] = PGATRUE; /*PGARealReceiveIndividual*/
     }
}

