Changeset 986 for trunk/optimizer/src/pgapack
- Timestamp:
- Apr 2, 2008, 2:32:58 PM (16 years ago)
- Location:
- trunk/optimizer/src/pgapack/pgapack
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/optimizer/src/pgapack/pgapack/source/parallel.c
r816 r986 69 69 70 70 #include "pgapack.h" 71 #include <setjmp.h> 72 73 extern jmp_buf pgapack_jmpbuf; 74 extern int *pgapack_abortPtr; 71 75 72 76 #define DEBUG_EVAL 0 … … 111 115 112 116 PGAEvaluate(ctx, PGA_OLDPOP, f, comm); 117 113 118 if (rank == 0) 114 119 PGAFitness(ctx, PGA_OLDPOP); … … 192 197 PGASetEvaluation (ctx, p-1, pop, e); 193 198 } 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 } 196 204 if (!PGAGetEvaluationUpToDateFlag(ctx, p, pop)) { 197 205 e = (*f)(ctx, p, pop); 198 206 PGASetEvaluation(ctx, p, pop, e); 199 } 207 } 208 } 200 209 } 201 210 PGADebugExited("PGAEvaluateSeq"); … … 485 494 PGAEvaluateSlave(ctx, pop, f, comm); 486 495 } 487 488 496 PGADebugExited("PGAEvaluate"); 489 497 } -
trunk/optimizer/src/pgapack/pgapack/source/pga.c
r816 r986 71 71 72 72 #include "pgapack.h" 73 #include <setjmp.h> 74 75 jmp_buf pgapack_jmpbuf; 73 76 74 77 /*U**************************************************************************** … … 112 115 ndemes = PGAGetNumDemes (ctx); 113 116 117 if (setjmp(pgapack_jmpbuf)) { 118 return; /* PGA pack was aborted. */ 119 } 114 120 /**********************************************************************/ 115 121 /* Global model, one island, one deme */ 116 122 /**********************************************************************/ 117 if ( (npops == 1) && (ndemes == 1) ) { 118 123 if ( (npops == 1) && (ndemes == 1) ) { 119 124 PGARunGM(ctx, evaluate, comm); 120 125 } -
trunk/optimizer/src/pgapack/pgapack/source/stop.c
r816 r986 71 71 72 72 #include "pgapack.h" 73 74 int *pgapack_abortPtr = NULL; 73 75 74 76 /*U**************************************************************************** … … 377 379 PGADebugExited("PGASetMaxSimilarityValue"); 378 380 } 381 382 void PGASetAbortVar(int *abortPtr) 383 { 384 pgapack_abortPtr = abortPtr; 385 }
Note: See TracChangeset
for help on using the changeset viewer.