www.pudn.com > dgpc.rar > proto.h


/*======================================================================+
| PGPC: Parallel Genetic Programming in C                               |
| (c) 1995 Genetic Algorithm Technology Corp. all rights reserved       |
|   written by David Andre                                              |
+======================================================================*/
/*======================================================================+
| FILE: proto.h                                                         |
| DESCRIPTION: Function prototypes for proto.c.                         |
|                                                                       |
| REVISIONS:                                                            |
| Jan 24, 1995:  Works as of today, no known bugs.                      |
+======================================================================*/

char * gpstatGetProblem(void); /*funcdef*/
int gpstatGetRunNum(void); /*funcdef*/
float gpstatGetBestFitness(void); /*funcdef*/
int gpstatGetBestSoFarHits(void); /*funcdef*/
int gpstatGetBestIndex(void); /*funcdef*/
Individual * gpstatGetBestDude(void); /*funcdef*/
Population * gpinitGetPopptr(void); /*funcdef*/
StartupInfo * gpinitGetParamptr(void); /*funcdef*/
void gpinitPopCreation(Population * pop); /*funcdef*/
int gpstatTerminationQuery(int gen); /*funcdef*/
void gpreproReproducePopulation(int counter); /*funcdef*/
void PreparePopulationForExportStep(void); /*funcdef*/
void PreparePopulationForImportStep(void); /*funcdef*/
void    UpdateForEndOfRun(Population *spop); /*funcdef - gpkernel - UpdateForEndOfRun*/
int FindBestAndWorst (void);  /*funcdef - dgpc - FindBestAndWorst*/
void InitializeIndividual(Individual * ind);    /*funcdef - dgpc - InitializeIndividual */
void InitializePopulation(void);     /*funcdef - dgpc - InitializePopulation */
void CreateInitialPopulation(int max_new_tree_depth);        /*funcdef - dgpc - CreateInitialPopulation*/
int FindGoodTree(int choice_type);   /*funcdef - dgpc - FindGoodTree */
int gpreproSelectRandomIndividual(Population *pop); /*funcdef*/
int FindTreeFromCulledPop(int sel_method);  /*funcdef - dgpc - FindTreeFromCulledPop*/
int FindBadTree(void);    /*funcdef - dgpc - FindBadTree */
Branch * GetRightBranch(Individual * dude, int bnum); /*funcdef - dgpc - GetRightBranch */
int ChoosePoint(Branch * br,        /*funcdef - dgpc - ChoosePoint*/
                int CurTreeSize,           /*funcdef - dgpc - ChoosePoint*/
                int choice);                /*funcdef - dgpc - ChoosePoint*/
int MakeFunctionVector(Branch *br,  /*funcdef - dgpc - MakeFunctionVector*/
                       int index,          /*funcdef - dgpc - MakeFunctionVector*/
                       int * fvector); /*funcdef - dgpc - MakeFunctionVector*/
int doMakeFunctionVector(Branch *br,   /*funcdef - dgpc - doMakeFunctionVector*/
                         int index,           /*funcdef - dgpc - doMakeFunctionVector*/
                         int * fvector);  /*funcdef - dgpc - doMakeFunctionVector*/
int CheckFVectorFit(Branch * br, /*funcdef - dgpc - CheckFVectorFit */
                      int * fvector); /*funcdef - dgpc - CheckFVectorFit */
void CullPopulation(int * fvector); /*funcdef - dgpc - CullPopulation */
int RandCullPopulation(int * fvector);  /*funcdef - dgpc - RandCullPopulation */
int FindGoodBranch(Individual * parent,   /*funcdef - dgpc - FindGoodBranch*/
                     int *fvector);     /*funcdef - dgpc - FindGoodBranch*/
int DoCrossover(int level,              /*funcdef - dgpc - DoCrossover*/
                Individual * child,     /*funcdef - dgpc - DoCrossover*/
                Individual * parent,    /*funcdef - dgpc - DoCrossover*/
                int bnum);          /*funcdef - dgpc - DoCrossover*/
void DoMutation(Branch * parent, Branch * child); /*funcdef - dgpc - DoMutation*/
void ReproducePopulation(int early, int counter); /*funcdef - dgpc - ReproducePopulation*/
void DoOneReproduction(int early, Individual * child1, int * p1, int * p2, int counter, int ind); /*funcdef - dgpc - DoOneReproduction*/
void CopySubtree(Branch * from_br,  /*funcdef - dgpc - CopySubtree*/
                  int from_start,           /*funcdef - dgpc - CopySubtree*/
                  int from_end,             /*funcdef - dgpc - CopySubtree*/
                  Branch * to_br,    /*funcdef - dgpc - CopySubtree*/
                  int to_start);        /*funcdef - dgpc - CopySubtree*/
int CreateRandomTree(Branch * br, int index, int mdepth, int top, int fillfull); /*funcdef - dgpc - CreateRandomTree*/
int CreateRandomADFTree(Branch * br,  /*funcdef - dgpc - CreateRandomADFTree*/
                           int index,           /*funcdef - dgpc - CreateRandomADFTree*/
                           int mdepth,          /*funcdef - dgpc - CreateRandomADFTree*/
                           int top,             /*funcdef - dgpc - CreateRandomADFTree*/
                           int fillfull);   /*funcdef - dgpc - CreateRandomADFTree*/
int TraverseSubtree(Branch * br, int index);  /*funcdef - dgpc - TraverseSubtree*/
int DoDepthOfPointInBranch(Branch *br, int index,   /*funcdef*/
                                       int point, int  level, int * depth)  ; /*funcdef*/
int do_depth_of_branch(Branch *br, int index, int * depth); /*funcdef*/
int depth_of_branch(Branch *br); /*funcdef*/
int DepthOfBranchFromPoint(Branch *br,int point); /*funcdef*/
int DepthOfPointInBranch(Branch *br,int point); /*funcdef*/
GTYPE EvalBranch(Branch *br,Population *pop); /*funcdef - gpkernel - EvalBranch*/
void UnCompressIndividual(CompInd * cind,       /*funcdef*/
                          Individual *ind); /*funcdef*/
void CompressIndividual(Individual *ind,     /*funcdef*/
                        CompInd * cind); /*funcdef*/
void SetJumpsAndVals(Branch * br,int stuff); /*funcdef*/
void ExecuteOperations(void); /*funcdef*/
ReproOpInfo * GetUnDoneOp(CompInd * ptr);  /*funcdef*/
void UpDateDude(int parent, int from_list); /*funcdef*/
void DoReproductiveOp(ReproOpInfo * op_to_do, Individual *child,int child_num); /*funcdef*/
void ChooseOneReproduction(int early, int counter, int ind_num); /*funcdef - dgpc - DoOneReproduction*/
CompInd * PlaceOnCindList(CompInd * dude, CompInd * list); /*funcdef*/
CompInd * RemoveFromCindList(CompInd * dude, CompInd * list); /*funcdef*/
void gpi_CondSendTrace(char *str);

int ChooseRandomFunction(Population * pop,int kind,Branch * br); /*funcdef*/
int ChooseRandomCSSFunction(Population * pop,int kind,Branch *br,int * fvector); /*funcdef*/
int doCreateRandomCSSTree(Branch * br, int index, int mdepth, int top, int fillfull,int * fvector); /*funcdef - dgpc - doCreateRandomCSSTree*/
int CreateRandomCSSTree(Branch * br, int index, int mdepth, int top, int fillfull); /*funcdef - dgpc - CreateRandomCSSTree*/
int ErrorInDude(Individual * ind);



int NewReadBranch(Branch *br, FILE *f);
int ProbSpecificSpecialIndividual(Individual * ind);
int ProbBeautyDecision(Population * pop, CompInd * b_a, CompInd * b_b);

int BRCFailureHook(Individual * parent);
int BRDUPFailureHook(Individual * parent, int dup_branch_index);
int BRDELFailureHook(Individual * parent);
int ARGDUPFailureHook(Individual * parent);
int ARGDELFailureHook(Individual * parent);
int BRCEndHook(Individual * parent);
int BRDUPEndHook(Individual * parent, int dup_branch_index);
int BRDELEndHook(Individual * parent);
int ARGDUPEndHook(Individual * parent);
int ARGDELEndHook(Individual * parent);

void gpap(Branch * br,
          int test,
          ParentInfo * p);

int FVectorSubsumeP(int * fvector_large, int * fvector_small);
int ConstrainedSyntaxFilters(int * fvector, Branch * br, int func, int arg, Population * pop);
void CopyFVector(int * fvector_from, int * fvector_to);

int gpRandomInt(   int i  ); /*;*/    /* 0 <= RandomInt() < i   */ /*funcdef - dgpc - gpRandomInt*/
float gpRandomFloat( float f  );

int doValidSubtreeGivenFVector(Branch *br,   /*funcdef - dgpc - doValidSubtreeGivenFVector*/
                         int index,           /*funcdef - dgpc - doValidSubtreeGivenFVector*/
                         int * fvector,
                         int * pcorrect);  /*funcdef - dgpc - doValidSubtreeGivenFVector*/
int ValidSubtreeGivenFVector(Branch *br, int index, int * fvector); /*funcdef -- gpkernel.c */

int FullCompare(Individual * ind1, Individual * ind2);
void init_pop_check(Population * pop);
int QuickCompare(CompInd * c1, CompInd * c2);
unsigned long GetSystemSeed(void);