commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject svn commit: r1295583 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/Chromosome.java
Date Thu, 01 Mar 2012 14:33:04 GMT
Author: erans
Date: Thu Mar  1 14:33:03 2012
New Revision: 1295583

URL: http://svn.apache.org/viewvc?rev=1295583&view=rev
Log:
Fixed misuse of "Double.MIN_VALUE".

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/Chromosome.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/Chromosome.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/Chromosome.java?rev=1295583&r1=1295582&r2=1295583&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/Chromosome.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/Chromosome.java
Thu Mar  1 14:33:03 2012
@@ -26,9 +26,11 @@ package org.apache.commons.math3.genetic
  * @version $Id$
  */
 public abstract class Chromosome implements Comparable<Chromosome>,Fitness {
+    /** Value assigned when no fitness has been computed yet. */
+    private static final double NO_FITNESS = Double.NEGATIVE_INFINITY;
 
     /** Cached value of the fitness of this chromosome. */
-    private double fitness = Double.MIN_VALUE;
+    private double fitness = NO_FITNESS;
 
     /**
      * Access the fitness of this chromosome. The bigger the fitness, the better
@@ -40,7 +42,7 @@ public abstract class Chromosome impleme
      * @return the fitness.
      */
     public double getFitness() {
-        if (this.fitness == Double.MIN_VALUE) {
+        if (this.fitness == NO_FITNESS) {
             // no cache - compute the fitness
             this.fitness = fitness();
         }



Mime
View raw message