Quantcast

bug jgap

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

bug jgap

umut akdemir
Hi,
 
Jgap is a very useful package, hence I first want to thank authors for designing and continuously improving such a well defined and useful code. While using jgap version 2.5 I ran into a hard to notice bug. For my code I was having some problems and was trying to debug the code by setting m_fitnessValue of chromosome to an uninitialized value, and then seeing when it changes again. I wrote my own set and get functions, set breakpoints to every place it is changed, and also opened up a watch point from eclipse for that variable. Yet before getting into any of them as soon as I changed the member it was getting filled with some value when I tried it in the debug window.
 
The bug is in the toString() method of the chromosome
on line 505:
representation.append(", " + S_FITNESS_VALUE + ":" + getFitnessValue());
 
 
And in getFitnessValue method:
if (m_fitnessValue >= 0.000d) {
      return m_fitnessValue;
    }
    else {
      return calcFitnessValue();
    }
 
The problem is that whenever I want to see the chromosome in the eclipse debug window toString method of the chromosome is called. And what is worse, eclipse does not stop in the breakpoints or watchpoints when the call is made from the debug window (at least this is what I experienced). The problem can be solved with changing line 505 to
representation.append(", " + S_FITNESS_VALUE + ":" + m_fitnessValue);
if it is -1, then the users can at least understand they need to initialize the value.
 
Thank you,
Umut
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[jgap-devl] RE: bug jgap

Klaus Meffert
Hello Umut,
 
you are right!
 
I fixed the bug (after adding it to the database as bug 1403027 ) as you suggested and modified the tests testToString_1 and testToString_1 in class ChromosomeTest to expose the bug.
When running all tests, it came out that in Genotype.toString() (calling Chromosome.toString()) a change was necessary, too.
I've just checked in the changed sources (classes Chromosome, ChromosomeTest, Genotype, GenotypeTest) to the CVS.
 
Thanx again for your detailed report!
 
Klaus
 

From: [hidden email] [mailto:[hidden email]]
Sent: Wednesday, January 11, 2006 3:46 PM
To: [hidden email]; [hidden email]
Subject: [jgap-users] bug jgap

Hi,
 
Jgap is a very useful package, hence I first want to thank authors for designing and continuously improving such a well defined and useful code. While using jgap version 2.5 I ran into a hard to notice bug. For my code I was having some problems and was trying to debug the code by setting m_fitnessValue of chromosome to an uninitialized value, and then seeing when it changes again. I wrote my own set and get functions, set breakpoints to every place it is changed, and also opened up a watch point from eclipse for that variable. Yet before getting into any of them as soon as I changed the member it was getting filled with some value when I tried it in the debug window.
 
The bug is in the toString() method of the chromosome
on line 505:
representation.append(", " + S_FITNESS_VALUE + ":" + getFitnessValue());
 
 
And in getFitnessValue method:
if (m_fitnessValue >= 0.000d) {
      return m_fitnessValue;
    }
    else {
      return calcFitnessValue();
    }
 
The problem is that whenever I want to see the chromosome in the eclipse debug window toString method of the chromosome is called. And what is worse, eclipse does not stop in the breakpoints or watchpoints when the call is made from the debug window (at least this is what I experienced). The problem can be solved with changing line 505 to
representation.append(", " + S_FITNESS_VALUE + ":" + m_fitnessValue);
if it is -1, then the users can at least understand they need to initialize the value.
 
Thank you,
Umut
Loading...