Print

Print


Hi all.

When running NSGA-II, I'm having a problem when extending the
Individual class. I create a new class called Measures, when I have
some attributes of performance such as accuracy, fmeasure, etc. My
Individual class (called myIndividual.java) has an object fro this
Measures class (the attribute calls performances). It is a private
attribute, and to get this I need to use individual.getPerformances().

public myIndividual () {

private Measures performances = new Measures();

...

}


At the end of the evolution, I get the paretoFront and it is very
weird because if I get, for example,
individual.getPerformance.getAccuracy(), the value is completely
wrong. Just to make sure, I added an attribute called accuracy
directly in myIndividual class, as below.

public myIndividual () {

private double accuracy;
private Measures performances = new Measures();
...
   void testMethod() {
      accuracy = 0.8;
      performance.setAccuracy(0.8);
   }
...
}

I assign the same value to both (as in testMethod()), but when I print
it in my Main class (when I have the paretoFront), these values are
different. The value accuracy attribute is correct, but the one in
performances.getAccuracy() is completely wrong.

Should I make some additional thing to fix it? I tried to make
Measures implements Serializable and Clonable, but it didn't work. It
is possible to add into myIndividual.java all attributes on
Measures.java, but I would not like to do it because it must have a
way to fix it correctly.

Best,
Márcio


--------
Prof. Márcio Porto Basgalupp
Instituto de Ciência e Tecnologia (ICT)
Universidade Federal de São Paulo (UNIFESP)