Thanks so much Siggy, I will follow your advice.

Regards,
Adrián.

El 12/10/2018 a las 10:46 PM, Eric 'Siggy' Scott escribió:
[log in to unmask]">
Hi Adrián,

Overriding paretoDominates() is the right way to go. 

NSGA2 has a bit of specific machinery, however.  Its non-dominated sorting procedure uses the paretoDominates() method to 1) divide the population up based on their Pareto rank and 2) set the 'rank' attribute of every individual in the population.  NSGA2 also assumes that your "betterThan()" method sorts lexicographically, first by Pareto dominance, then by sparsity.

These features are provided by a NSGA2MultiObjectiveFitness (which is why NSGA2 cannot work with a vanilla MultiObjectiveFitness object).  I've committed some error handling, so that future users will receive an error message explaining this instead of the ClassCastException that you got.

I took a glance at NSGA2Breeder just now, and it looks to me like you can still override NSGA2MultiObjectiveFitness.paretoDominates() to experiment with an alternate definition of domination.  If I were you, though, I would read through everyplace that ECJ's NSGA2 package uses paretoDominance() and betterThan() methods yourself just to make sure that it doesn't cause any unexpected behavior.

Thanks!
Siggy

On Mon, Dec 10, 2018 at 12:35 PM Adrián Romero Cáceres <[log in to unmask]> wrote:
Hello Siggy,

thanks for your help. I did not explain correctly.

I am trying to use another comparison operator based on goals an priorities  instead of the Pareto dominance criteria. I am planing to use this new comparison operator only with the tournament selection operator.  I saw that the paretoDominates function is implemented in the MultiObjectiveFitness class.  Because of this I extended the MultiObjectiveFitness class, but apparently I was wrong.  Could you tell me which is the right way to substitute the Pareto dominance for my custom operator into the tournament selection?

Thanks in advance,

Adrián.

El 12/9/2018 a las 11:30 PM, Eric 'Siggy' Scott escribió:
Hi Adrián,

The problem is that NSGA2 expects to be working with Fitness objects that are specifically of type NSGA2Fitness (which is itself a subclass of MultiObjectiveFitness).

If you have your CustomFitness class inherent from NSGA2Fitness instead of MultiObjectiveFitness, you should be good to go.

Thanks,
Siggy

On Sun, Dec 9, 2018 at 4:38 PM Adrián Romero Cáceres <[log in to unmask]> wrote:
Hello!

I have implemented a new betterThan operator into a CustomFitness class,
which is an extended class of MultiObjectiveFitness.  I wrote 
pop.subpop.0.species.fitness = ec.multiobjective.CustomFitness inside my
experiment param file. Once the execution starts, after the first
generation fails, returning the next error:

Exception in thread "main" java.lang.ClassCastException:
ec.multiobjective.CustomFitness cannot be cast to
ec.multiobjective.nsga2.NSGA2MultiObjectiveFitness
         at
ec.multiobjective.nsga2.NSGA2Breeder.assignFrontRanks(NSGA2Breeder.java:185)
         at
ec.multiobjective.nsga2.NSGA2Breeder.buildArchive(NSGA2Breeder.java:121)
         at
ec.multiobjective.nsga2.NSGA2Breeder.loadElites(NSGA2Breeder.java:82)
         at ec.simple.SimpleBreeder.breedPopulation(SimpleBreeder.java:225)
         at
ec.multiobjective.nsga2.NSGA2Breeder.breedPopulation(NSGA2Breeder.java:113)
         at
ec.simple.SimpleEvolutionState.evolve(SimpleEvolutionState.java:104)
         at ec.EvolutionState.run(EvolutionState.java:482)
         at ec.Evolve.main(Evolve.java:771)

I forgot something? Is it the right way to extend the betterThan operator?

Thanks in advance,
Adrián.


--

Doctoral Candidate, George Mason University


--

Doctoral Candidate, George Mason University