Hey Guys,
So I have 2 variables that I want to enter into my scoring function but each variable has its own list of integers that I would like to test.
I want my variable x to be an integer from this list: [34,40,45,73,52,64,55,60,65,61,62,63,41,42,43,44] and I want my variable y to be an integer from this list [100,200,300]
I can't seem to get it to work in the program. This is what I have.
choices = [[34,40,45,73,52,64,55,60,65,61,62,63,41,42,43,44],
[100,200,300]]
## Genome instance
alleles = GAllele.GAlleles(homogeneous=True) #alleles help me work
with a custom list.
lst = GAllele.GAlleleList(choices)
alleles.add(lst)
alleles[0].getRandomAllele() in lst
genome = G2DList.G2DList(2,1)
genome.setParams(allele=alleles)
genome.evaluator.set(eval_func)
genome.mutator.set(Mutators.G2DListMutatorSwap)
genome.crossover.set(Crossovers.G2DListCrossoverUniform)
genome.initializator.set(Initializators.G2DListInitializatorAllele)
ga = GSimpleGA.GSimpleGA(genome)
ga.setGenerations(15)
pop = ga.getPopulation()
pop.scaleMethod.set(Scaling.SigmaTruncScaling)
ga.evolve(freq_stats=10)
best = ga.bestIndividual()
mybestscore = best.score
Any suggestions?