1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| def CCAS(objFunct, dim, learningLength): V = (k, numIndv) pop = initPop(dim, maxNumIndv) b = initContextVector(pop) f = objFunct(b) for (j, numIndv) in V: G[j] = randomGroup(dim, j) b[j] = b pop[j] = extractPop(pop, numIndv) f_prev[j] = f fitnessEval = 0 selectDecom = 0 learnCount = 0 q = [0 for i in range(m)] R = [0 for i in range(m)] while fitnessEval < maxFitnessEval: if learnCount == learnLen: learnCount = -1 for (j, numIndv) in V: q[j] = computeValFunct(r[j]) selectedDecomposer = decomposerWithMax(q) bestFitnessDecomposer = decomposerWithMax(f) copySearchState(bestFitnessDecomposer, selectedDecomposer) if learnCount >= 0: learnCount ← learnCount + 1 for (j, numIndv) in V: (f[j], FitnessEval[j]) = optimizeSubcomponents(objFunct, G[j] , b[j] , pop[j] ) fitnessEval = fitnessEval+FitnessEval[j] r_learnCount[j] = (f_prev[j]-f_cur[j])/(abs(f_prev[j])*FitnessEval[j]) f_prev[j] = f_cur[j] G[j] = randomGroup(dim, j) else: j = SelectedDecomposer (f[j], FitnessEval[j]) = optimizeSubcomponents(objectiveFunction, G[j] , b[j] , pop[j] ) fitnessEval = fitnessEval+FitnessEval[j] if unifRandom(0, 1) < epsilon: learnCount = 0 broadcastSearchState(b[j], pop[j]) f_prev[j] = f[j] b = b[j] G[j] = randomGroup(dim, j) return objFunct(b), b
|