toolbox.register("population", tools.initRepeat, numpy.ndarray, toolbox.individual)
# Simple Example #i
@counter
def cp():
i = cp.count - 1
CP = C[i,:]
#CP = C[0][i,:]
return(CP)
C = numpy.array([ [1.0, 2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0], [3.0, 4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0] ]) # 1 x 2D-List
IND_LENGTH=1
creator.create("FitnessMulti", base.Fitness, weights=(-1.0,-1.0))
creator.create("Individual",numpy.ndarray , fitness=creator.FitnessMulti)
toolbox = base.Toolbox()
toolbox.register("attr_bool", cp)
toolbox.register("individual", tools.initRepeat, creator.Individual, toolbox.attr_bool, IND_LENGTH)
toolbox.register("population", tools.initRepeat, list, toolbox.individual)
pop = toolbox.population(n=2)
print "Population:", pop
print ""
i=0
for ind in pop:
print "Ind #"+str(i),":", ind
i+=1
# Evaluation Function #
## pop.fitness.values = Function_Optimisation2.Function_optimisation(pop) $ python arrdeap2.py
Population: [Individual([[ 1., 2., 3., 4., 5., 6., 7., 8., 9., 10.,
11., 12., 13.]]), Individual([[ 3., 4., 5., 6., 7., 8., 9., 10., 11., 12.,
13., 14., 15.]])]
Ind #0 : [[ 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13.]]
Ind #1 : [[ 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15.]]--
You received this message because you are subscribed to the Google Groups "deap-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to deap-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to deap-users+...@googlegroups.com.