It seems there is a bug in "FunctionSlot.FunctionSlot.add(obj, weight)". Suppose that we want to use two selectors with different weights as follows:
ga.selector.set(Selectors.GRankSelector,0.3)
ga.selector.add(Selectors.GRouletteWheel,.7)
here is the output:
>>> ga.printStats
<bound method GSimpleGA.printStats of - GSimpleGA
GP Mode: False
Population Size: 80
Generations: 1000
Current Generation: 799
Mutation Rate: 0.04
Crossover Rate: 0.90
Minimax Type: Minimize
Elitism: True
Elitism Replacement: 1
DB Adapter: DBSQLite DB Adapter [File='pyevolve.db', identify='ackley']
Slot [Selector] (Count: 2)
Name: GRankSelector - Weight: 0.50
Doc: The Rank Selector - This selector will pick the best individual of
the population every time.
Name: GRouletteWheel - Weight: 0.30
Doc: The Roulette Wheel selector
Slot [Generation Step Callback] (Count: 0)
No function
Slot [Termination Criteria] (Count: 1)
Name: RawScoreCriteria - Weight: 0.50
Doc: Terminate the evolution using the **bestrawscore** and **rounddecimal**
parameter obtained from the individual
Example:
>>> genome.setParams(bestrawscore=0.00, rounddecimal=2)
(...)
>>> ga_engine.terminationCriteria.set(GSimpleGA.RawScoreCriteria)
As you can see, the first Selector has a weight of 0.5 and the second one has 0.3! So, if we look at:
>>> ga.selector.funcWeights
[0.5, 0.3, 0.7]
We can see the "funcWeights" has three elements and this may causes the problem. if we modify this list according to our desire weights, it will work fine. Please let me know if im right.