void DE(Individual Pop, int n, Individual New) { int i, best; int p1, p2, p3; if(Gen==1) { DEBest=0; for(i=1; i<n; i++) if(Better(&Pop[i], &Pop[DEBest])) DEBest=i; } best=DEBest; for(i=0; i<n; i++) { DEselect(p1, p2, p3); if(DEBinomialCrossoverFlag) DE1bin(New[i].x, Pop[i].x, Pop[p1].x, Pop[p2].x, Pop[p3].x) else DE1exp(New[i].x, Pop[i].x, Pop[p1].x, Pop[p2].x, Pop[p3].x) EvaluateIndividual(&New[i]); if(Better(&New[i], &Pop[i])) { /* new is better than old */ if(Better(&New[i], &Pop[DEBest])) { if(!SwapPopulationFlag) DEBest=i; else best=i; } if(!SwapPopulationFlag) Copy(&Pop[i], &New[i]); SuccessEval++; } else { if(SwapPopulationFlag) Copy(&New[i], &Pop[i]); FailEval++; } } if(SwapPopulationFlag) DEBest=best; }
/// see d_ary_heap_indirect for public methods (push(val), pop(), Val const& top()), adjust_top() priority_queue(Size containerReserve = 1 + Arity + Arity * Arity) : Base(DistanceMap(), IndexInHeapPropertyMap(), Better(), containerReserve, Equal()) {}
priority_queue(DistanceMap const& distance, IndexInHeapPropertyMap const& indexInHeap = IndexInHeapPropertyMap(), Better const& better = Better(), Size containerReserve = 100, Equal const& equal = Equal()) : Base(distance, indexInHeap, better, containerReserve, equal) {}