|
GeneticAlgorithm
0.5 (beta)
A python framework for rapid GA prototyping
|
Classes | |
| class | Knapsack |
| An evaluation operator that computes the relaxed version of the objective function used to solve a knapsack instance. More... | |
Variables | |
| int | nObjects = 12 |
| list | objectVolumes = [random.randrange(1, 20) for i in xrange(nObjects)] |
| list | objectCosts = [random.randrange(10, 20) for i in xrange(nObjects)] |
| tuple | maxVolume = reduce(lambda x, y: x+y, objectVolumes) |
| int | volumeLambda = 10 |
| maximize = True | |
| int | nGenerations = 5 |
| int | popSize = 10 |
| tuple | genSize = int(math.floor( popSize/10 )) |
| tuple | ch = Core.Genotype(segments=[GenotypeLibrary.BinaryChromosomeSegment(nBits=1) for i in range(nObjects)]) |
| tuple | p = Core.Population(schema=ch, popSize=popSize, genSize=genSize, maximize=maximize, mutation_probability=0.01) |
| tuple | ga |
| tuple KnapsackDemo::ch = Core.Genotype(segments=[GenotypeLibrary.BinaryChromosomeSegment(nBits=1) for i in range(nObjects)]) |
Definition at line 211 of file KnapsackDemo.py.
| tuple KnapsackDemo::ga |
00001 Core.Scheduler(name='Demo',\ 00002 population=p,\ 00003 operators=[Knapsack(maxVolume, objectVolumes, volumeLambda, objectCosts),\ 00004 LoggingOperators.LogGenerations(iterationFrequency=1),\ 00005 PlottingOperators.PlotBestLogger(iterationFrequency=1, maximize=maximize),\ 00006 SelectionOperators.KTournament(),\ 00007 SelectionOperators.SelectLethals(),\ 00008 Core.Crossover(),\ 00009 Core.Mutate()])
Definition at line 213 of file KnapsackDemo.py.
| tuple KnapsackDemo::genSize = int(math.floor( popSize/10 )) |
Definition at line 208 of file KnapsackDemo.py.
| KnapsackDemo::maximize = True |
Definition at line 205 of file KnapsackDemo.py.
| tuple KnapsackDemo::maxVolume = reduce(lambda x, y: x+y, objectVolumes) |
Definition at line 201 of file KnapsackDemo.py.
| int KnapsackDemo::nGenerations = 5 |
Definition at line 206 of file KnapsackDemo.py.
| int KnapsackDemo::nObjects = 12 |
Definition at line 197 of file KnapsackDemo.py.
| list KnapsackDemo::objectCosts = [random.randrange(10, 20) for i in xrange(nObjects)] |
Definition at line 200 of file KnapsackDemo.py.
| list KnapsackDemo::objectVolumes = [random.randrange(1, 20) for i in xrange(nObjects)] |
Definition at line 199 of file KnapsackDemo.py.
| tuple KnapsackDemo::p = Core.Population(schema=ch, popSize=popSize, genSize=genSize, maximize=maximize, mutation_probability=0.01) |
Definition at line 212 of file KnapsackDemo.py.
| int KnapsackDemo::popSize = 10 |
Definition at line 207 of file KnapsackDemo.py.
| int KnapsackDemo::volumeLambda = 10 |
Definition at line 202 of file KnapsackDemo.py.