Changeset 1178


Ignore:
Timestamp:
Oct 7, 2008 6:03:52 PM (14 years ago)
Author:
liveletlive
Message:

Had earlier checked in files without these modifications which are necessary to make simple.tcl and app-qdot.tcl run

Location:
trunk/packages/optimizer/src/pgapack/pgapack
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/optimizer/src/pgapack/pgapack/include/pgapack.h

    r816 r1178  
    765765void PGASetRestartAlleleChangeProb(PGAContext *ctx, double prob);
    766766double PGAGetRestartAlleleChangeProb(PGAContext *ctx);
     767void PGASetRestartUserAction(int *userRestartCommand);
     768int PGARestartCondition(PGAContext *ctx);
    767769
    768770/*****************************************
  • trunk/packages/optimizer/src/pgapack/pgapack/source/restart.c

    r816 r1178  
    7272#include "pgapack.h"
    7373
     74int *pgapack_user_cmd_restart = NULL;
    7475/*U****************************************************************************
    7576   PGARestart - reseeds a population from the best string
     
    329330}
    330331
     332void PGASetRestartUserAction(int *userRestartCommand)
     333{
     334        pgapack_user_cmd_restart = userRestartCommand;
     335}
     336
     337int PGARestartCondition(PGAContext *ctx){
     338        int ifRestart = PGA_FALSE;
     339        if (  (pgapack_user_cmd_restart!=NULL && *pgapack_user_cmd_restart==PGA_TRUE)       ||
     340                        (
     341                                (ctx->ga.restart == PGA_TRUE) &&
     342                                (ctx->ga.ItersOfSame % ctx->ga.restartFreq == 0)
     343                        )
     344           ) {
     345                        ifRestart = PGA_TRUE;
     346                 }
     347                 
     348        if ((ctx->ga.restart == PGA_TRUE) &&
     349        (ctx->ga.ItersOfSame % ctx->ga.restartFreq == 0)) {
     350                ctx->ga.ItersOfSame++;
     351        }
     352        if (pgapack_user_cmd_restart!=NULL){
     353                *pgapack_user_cmd_restart = PGA_FALSE;
     354        }
     355        return ifRestart;
     356}
     357
Note: See TracChangeset for help on using the changeset viewer.