Subject: | |
From: | |
Reply To: | |
Date: | Mon, 19 Oct 2015 18:56:27 -0400 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Hi, again.
I managed to solve the misconfiguration problem. I had to use the genetic programming pipeline AND the multiobjective fitness, breeder, and evaluator.
I post the working configuration here for anybody interested in it:
--- parameters ---
# The pipeline for GP is set in koza.params, included in my configuration file, like this
pop.subpop.0.species.pipe = ec.breed.MultiBreedingPipeline
pop.subpop.0.species.pipe.generate-max = false
pop.subpop.0.species.pipe.num-sources = 2
pop.subpop.0.species.pipe.source.0 = ec.gp.koza.CrossoverPipeline
pop.subpop.0.species.pipe.source.0.prob = 0.9
pop.subpop.0.species.pipe.source.1 = ec.breed.ReproductionPipeline
pop.subpop.0.species.pipe.source.1.prob = 0.1
# Multiobjective fitness configuration
pop.subpop.0.species.fitness = ec.multiobjective.nsga2.NSGA2MultiObjectiveFitness
pop.subpop.0.species.fitness.num-objectives = 2 # This is here only as a default value. It is set programatically
pop.subpop.0.species.fitness.maximize = false
seed.0 = time
pop.subpop.0.species.crossover-type = sbx
pop.subpop.0.species.crossover-distribution-index = 20
pop.subpop.0.species.mutation-type = polynomial
pop.subpop.0.species.mutation-distribution-index = 20
pop.subpop.0.species.mutation-bounded = true
# Use a statistics object which dumps the front
stat = ec.multiobjective.MultiObjectiveStatistics
stat.front = $front.stat
# specific evaluator and breeder
eval = ec.multiobjective.nsga2.NSGA2Evaluator
breed = ec.multiobjective.nsga2.NSGA2Breeder
...
--- end parameters ---
Also, in the evaluate() method in my custom GPProblem, I put this:
public void evaluate(final EvolutionState state, Individual ind,
int subpopulation, int threadnum) {
if (!ind.evaluated) { // don’t bother reevaluating
...
NSGA2MultiObjectiveFitness fitness = (NSGA2MultiObjectiveFitness) ind.fitness;
// NOT THIS ONE: ec.gp.koza.KozaFitness fitness = (ec.gp.koza.KozaFitness) ind.fitness;
double[] objectives = new double[numObjectives];
setupObjectives(objectives);
fitness.setObjectives(state, objectives);
...
ind.evaluated = true;
}
}
That's it.
Best,
--Pedro J. Ponce de León
|
|
|