Ignore:
Timestamp:
Apr 2, 2008, 2:32:58 PM (16 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/pgapack/pgapack/source/parallel.c

    r816 r986  
    6969
    7070#include "pgapack.h"
     71#include <setjmp.h>
     72
     73extern jmp_buf pgapack_jmpbuf;
     74extern int *pgapack_abortPtr;
    7175
    7276#define DEBUG_EVAL 0
     
    111115
    112116    PGAEvaluate(ctx, PGA_OLDPOP, f, comm);
     117       
    113118    if (rank == 0)
    114119        PGAFitness(ctx, PGA_OLDPOP);
     
    192197                PGASetEvaluation (ctx, p-1, pop, e);
    193198            }
    194     } else {
    195         for (p=0; p<ctx->ga.PopSize; p++)
     199    } else {
     200        for (p=0; p<ctx->ga.PopSize; p++) {
     201            if ((pgapack_abortPtr != NULL) && (*pgapack_abortPtr == 1)) {
     202                longjmp(pgapack_jmpbuf, 1);
     203            }
    196204            if (!PGAGetEvaluationUpToDateFlag(ctx, p, pop)) {
    197205                e = (*f)(ctx, p, pop);
    198206                PGASetEvaluation(ctx, p, pop, e);
    199             }
     207            }
     208        }
    200209    }
    201210    PGADebugExited("PGAEvaluateSeq");
     
    485494        PGAEvaluateSlave(ctx, pop, f, comm);
    486495    }
    487 
    488496    PGADebugExited("PGAEvaluate");
    489497}
Note: See TracChangeset for help on using the changeset viewer.