Ignore:
Timestamp:
Apr 2, 2008 2:32:58 PM (15 years ago)
Author:
gah
Message:

added global pgapack_abort flag to plugin and abort operation to optimizer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/optimizer/src/plugin_pgapack.c

    r903 r986  
    7979    dataPtr->popRepl = PGA_POPREPL_BEST;
    8080    dataPtr->popSize = 200;
    81 
    8281    return (ClientData)dataPtr;
    8382}
     83
     84int pgapack_abort = 0;
    8485
    8586/*
     
    103104    /* fake it here by just saying something like "rappture" */
    104105    int argc = 1; char *argv[] = {"rappture"};
     106
     107    pgapack_abort = 0;          /* FALSE */
     108    PGASetAbortVar(&pgapack_abort);
    105109
    106110    ctx = PGACreate(&argc, argv, PGA_DATATYPE_USER, envPtr->numParams,
     
    143147    PgapUnlinkContext2Env(ctx);
    144148
     149    if (pgapack_abort) {
     150        return RP_OPTIM_ABORTED;
     151    }
    145152    return RP_OPTIM_SUCCESS;
    146153}
     
    172179    status = (*envPtr->evalProc)(envPtr, paramPtr, envPtr->numParams, &fit);
    173180
     181    if (pgapack_abort) {
     182        fprintf(stderr, "==WARNING: run aborted!");
     183        return 0.0;
     184    }
     185       
    174186    if (status != RP_OPTIM_SUCCESS) {
    175187        fprintf(stderr, "==WARNING: run failed!");
Note: See TracChangeset for help on using the changeset viewer.