Author: tn
Date: Sun Sep 16 15:19:55 2012
New Revision: 1385284
URL: http://svn.apache.org/viewvc?rev=1385284&view=rev
Log:
Javadoc cleanup of genetics package.
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/AbstractListChromosome.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/BinaryChromosome.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/BinaryMutation.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/Chromosome.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/ChromosomePair.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/CrossoverPolicy.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/ElitisticListPopulation.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/Fitness.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/FixedElapsedTime.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/FixedGenerationCount.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/GeneticAlgorithm.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/ListPopulation.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/NPointCrossover.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/OnePointCrossover.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/OrderedCrossover.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/PermutationChromosome.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/Population.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/RandomKey.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/RandomKeyMutation.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/StoppingCondition.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/TournamentSelection.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/UniformCrossover.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/package-info.java
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/AbstractListChromosome.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/AbstractListChromosome.java?rev=1385284&r1=1385283&r2=1385284&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/AbstractListChromosome.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/AbstractListChromosome.java
Sun Sep 16 15:19:55 2012
@@ -36,8 +36,7 @@ public abstract class AbstractListChromo
/**
* Constructor.
* @param representation inner representation of the chromosome
- * @throws InvalidRepresentationException iff the
<code>representation</code> can not represent
- * a valid chromosome
+ * @throws InvalidRepresentationException iff the
<code>representation</code> can not represent a valid chromosome
*/
public AbstractListChromosome(final List<T> representation) {
checkValidity(representation);
@@ -53,11 +52,10 @@ public abstract class AbstractListChromo
}
/**
- *
* Asserts that <code>representation</code> can represent a valid
chromosome.
+ *
* @param chromosomeRepresentation representation of the chromosome
- * @throws InvalidRepresentationException iff the
<code>representation</code> can not represent
- * a valid chromosome
+ * @throws InvalidRepresentationException iff the
<code>representation</code> can not represent a valid chromosome
*/
protected abstract void checkValidity(List<T> chromosomeRepresentation)
throws InvalidRepresentationException;
@@ -78,23 +76,17 @@ public abstract class AbstractListChromo
}
/**
- * Creates a new instance of the same class as <code>this</code> is, with a
- * given <code>arrayRepresentation</code>. This is needed in crossover and
- * mutation operators, where we need a new instance of the same class, but
- * with different array representation.
- *
+ * Creates a new instance of the same class as <code>this</code> is, with
a given <code>arrayRepresentation</code>.
+ * This is needed in crossover and mutation operators, where we need a new
instance of the same class, but with
+ * different array representation.
+ * <p>
* Usually, this method just calls a constructor of the class.
*
- * @param chromosomeRepresentation
- * the inner array representation of the new chromosome.
- * @return new instance extended from FixedLengthChromosome with the given
- * arrayRepresentation
+ * @param chromosomeRepresentation the inner array representation of the
new chromosome.
+ * @return new instance extended from FixedLengthChromosome with the given
arrayRepresentation
*/
public abstract AbstractListChromosome<T> newFixedLengthChromosome(final
List<T> chromosomeRepresentation);
- /**
- * {@inheritDoc}
- */
@Override
public String toString() {
return String.format("(f=%s %s)", getFitness(), getRepresentation());
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/BinaryChromosome.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/BinaryChromosome.java?rev=1385284&r1=1385283&r2=1385284&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/BinaryChromosome.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/BinaryChromosome.java
Sun Sep 16 15:19:55 2012
@@ -32,8 +32,7 @@ public abstract class BinaryChromosome e
/**
* Constructor.
* @param representation list of {0,1} values representing the chromosome
- * @throws InvalidRepresentationException iff the
<code>representation</code> can not represent
- * a valid chromosome
+ * @throws InvalidRepresentationException iff the
<code>representation</code> can not represent a valid chromosome
*/
public BinaryChromosome(List<Integer> representation) {
super(representation);
@@ -42,8 +41,7 @@ public abstract class BinaryChromosome e
/**
* Constructor.
* @param representation array of {0,1} values representing the chromosome
- * @throws InvalidRepresentationException iff the
<code>representation</code> can not represent
- * a valid chromosome
+ * @throws InvalidRepresentationException iff the
<code>representation</code> can not represent a valid chromosome
*/
public BinaryChromosome(Integer[] representation) {
super(representation);
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/BinaryMutation.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/BinaryMutation.java?rev=1385284&r1=1385283&r2=1385284&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/BinaryMutation.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/BinaryMutation.java
Sun Sep 16 15:19:55 2012
@@ -32,10 +32,10 @@ public class BinaryMutation implements M
/**
* Mutate the given chromosome. Randomly changes one gene.
+ *
* @param original the original chromosome.
* @return the mutated chromosome.
- * @throws MathIllegalArgumentException if <code>original</code> is not an
instance
- * of {@link BinaryChromosome}.
+ * @throws MathIllegalArgumentException if <code>original</code> is not an
instance of {@link BinaryChromosome}.
*/
public Chromosome mutate(Chromosome original) {
if (!(original instanceof BinaryChromosome)) {
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=1385284&r1=1385283&r2=1385284&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
Sun Sep 16 15:19:55 2012
@@ -18,7 +18,7 @@ package org.apache.commons.math3.genetic
/**
* Individual in a population. Chromosomes are compared based on their fitness.
- *
+ * <p>
* The chromosomes are IMMUTABLE, and so their fitness is also immutable and
* therefore it can be cached.
*
@@ -33,13 +33,11 @@ public abstract class Chromosome impleme
private double fitness = NO_FITNESS;
/**
- * Access the fitness of this chromosome. The bigger the fitness, the
better
- * the chromosome.
- *
- * Computation of fitness is usually very time-consuming task, therefore
the
- * fitness is cached.
+ * Access the fitness of this chromosome. The bigger the fitness, the
better the chromosome.
+ * <p>
+ * Computation of fitness is usually very time-consuming task, therefore
the fitness is cached.
*
- * @return the fitness.
+ * @return the fitness
*/
public double getFitness() {
if (this.fitness == NO_FITNESS) {
@@ -50,15 +48,14 @@ public abstract class Chromosome impleme
}
/**
- * Compares two chromosomes based on their fitness. The bigger the fitness,
- * the better the chromosome.
+ * Compares two chromosomes based on their fitness. The bigger the
fitness, the better the chromosome.
*
* @param another another chromosome to compare
* @return
* <ul>
- * <li>-1 if <code>another</code> is better than <code>this</code></li>
- * <li>1 if <code>another</code> is worse than <code>this</code></li>
- * <li>0 if the two chromosomes have the same fitness</li>
+ * <li>-1 if <code>another</code> is better than <code>this</code></li>
+ * <li>1 if <code>another</code> is worse than <code>this</code></li>
+ * <li>0 if the two chromosomes have the same fitness</li>
* </ul>
*/
public int compareTo(final Chromosome another) {
@@ -66,9 +63,9 @@ public abstract class Chromosome impleme
}
/**
- * Returns <code>true</code> iff <code>another</code> has the same
- * representation and therefore the same fitness. By default, it returns
- * false -- override it in your implementation if you need it.
+ * Returns <code>true</code> iff <code>another</code> has the same
representation and therefore the same fitness. By
+ * default, it returns false -- override it in your implementation if you
need it.
+ *
* @param another chromosome to compare
* @return true if <code>another</code> is equivalent to this chromosome
*/
@@ -77,13 +74,11 @@ public abstract class Chromosome impleme
}
/**
- * Searches the <code>population</code> for another chromosome with the
same
- * representation. If such chromosome is found, it is returned, if no such
- * chromosome exists, returns <code>null</code>.
+ * Searches the <code>population</code> for another chromosome with the
same representation. If such chromosome is
+ * found, it is returned, if no such chromosome exists, returns
<code>null</code>.
*
* @param population Population to search
- * @return Chromosome with the same representation, or <code>null</code> if
- * no such chromosome exists.
+ * @return Chromosome with the same representation, or <code>null</code>
if no such chromosome exists.
*/
protected Chromosome findSameChromosome(final Population population) {
for (Chromosome anotherChr : population) {
@@ -95,8 +90,8 @@ public abstract class Chromosome impleme
}
/**
- * Searches the population for a chromosome representing the same solution,
- * and if it finds one, updates the fitness to its value.
+ * Searches the population for a chromosome representing the same
solution, and if it finds one,
+ * updates the fitness to its value.
*
* @param population Population to search
*/
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/ChromosomePair.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/ChromosomePair.java?rev=1385284&r1=1385283&r2=1385284&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/ChromosomePair.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/ChromosomePair.java
Sun Sep 16 15:19:55 2012
@@ -59,9 +59,6 @@ public class ChromosomePair {
return second;
}
- /**
- * {@inheritDoc}
- */
@Override
public String toString() {
return String.format("(%s,%s)", getFirst(), getSecond());
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/CrossoverPolicy.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/CrossoverPolicy.java?rev=1385284&r1=1385283&r2=1385284&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/CrossoverPolicy.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/CrossoverPolicy.java
Sun Sep 16 15:19:55 2012
@@ -24,6 +24,7 @@ package org.apache.commons.math3.genetic
* @version $Id$
*/
public interface CrossoverPolicy {
+
/**
* Perform a crossover operation on the given chromosomes.
*
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/ElitisticListPopulation.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/ElitisticListPopulation.java?rev=1385284&r1=1385283&r2=1385284&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/ElitisticListPopulation.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/ElitisticListPopulation.java
Sun Sep 16 15:19:55 2012
@@ -40,8 +40,7 @@ public class ElitisticListPopulation ext
*
* @param chromosomes list of chromosomes in the population
* @param populationLimit maximal size of the population
- * @param elitismRate how many best chromosomes will be directly
transferred to the
- * next generation [in %]
+ * @param elitismRate how many best chromosomes will be directly
transferred to the next generation [in %]
* @throws OutOfRangeException if the elitism rate is outside the [0, 1]
range
*/
public ElitisticListPopulation(final List<Chromosome> chromosomes,
@@ -52,12 +51,10 @@ public class ElitisticListPopulation ext
}
/**
- * Creates a new {@link ElitisticListPopulation} instance and initializes
its inner
- * chromosome list.
+ * Creates a new {@link ElitisticListPopulation} instance and initializes
its inner chromosome list.
*
* @param populationLimit maximal size of the population
- * @param elitismRate how many best chromosomes will be directly
transferred to the
- * next generation [in %]
+ * @param elitismRate how many best chromosomes will be directly
transferred to the next generation [in %]
* @throws OutOfRangeException if the elitism rate is outside the [0, 1]
range
*/
public ElitisticListPopulation(final int populationLimit, final double
elitismRate) {
@@ -88,11 +85,9 @@ public class ElitisticListPopulation ext
}
/**
- * Sets the elitism rate, i.e. how many best chromosomes will be directly
- * transferred to the next generation [in %].
+ * Sets the elitism rate, i.e. how many best chromosomes will be directly
transferred to the next generation [in %].
*
- * @param elitismRate how many best chromosomes will be directly
transferred to the
- * next generation [in %]
+ * @param elitismRate how many best chromosomes will be directly
transferred to the next generation [in %]
* @throws OutOfRangeException if the elitism rate is outside the [0, 1]
range
*/
public void setElitismRate(final double elitismRate) {
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/Fitness.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/Fitness.java?rev=1385284&r1=1385283&r2=1385284&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/Fitness.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/Fitness.java
Sun Sep 16 15:19:55 2012
@@ -25,9 +25,7 @@ package org.apache.commons.math3.genetic
public interface Fitness {
/**
- * Compute the fitness. This is usually very time-consuming, so the value
- * should be cached.
- *
+ * Compute the fitness. This is usually very time-consuming, so the value
should be cached.
* @return fitness
*/
double fitness();
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/FixedElapsedTime.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/FixedElapsedTime.java?rev=1385284&r1=1385283&r2=1385284&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/FixedElapsedTime.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/FixedElapsedTime.java
Sun Sep 16 15:19:55 2012
@@ -22,13 +22,10 @@ import org.apache.commons.math3.exceptio
/**
* Stops after a fixed amount of time has elapsed.
- *
* <p>
- * The first time {@link #isSatisfied(Population)} is invoked, the end time of
- * the evolution is determined based on the provided <code>maxTime</code>
value.
- * Once the elapsed time reaches the configured <code>maxTime</code> value,
+ * The first time {@link #isSatisfied(Population)} is invoked, the end time of
the evolution is determined based on the
+ * provided <code>maxTime</code> value. Once the elapsed time reaches the
configured <code>maxTime</code> value,
* {@link #isSatisfied(Population)} returns true.
- * </p>
*
* @version $Id$
* @since 3.1
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/FixedGenerationCount.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/FixedGenerationCount.java?rev=1385284&r1=1385283&r2=1385284&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/FixedGenerationCount.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/FixedGenerationCount.java
Sun Sep 16 15:19:55 2012
@@ -19,11 +19,9 @@ package org.apache.commons.math3.genetic
import org.apache.commons.math3.exception.NumberIsTooSmallException;
/**
- * Stops after a fixed number of generations. Each time
- * {@link #isSatisfied(Population)} is invoked, a generation counter is
- * incremented. Once the counter reaches the configured
- * <code>maxGenerations</code> value, {@link #isSatisfied(Population)} returns
- * true.
+ * Stops after a fixed number of generations. Each time {@link
#isSatisfied(Population)} is invoked, a generation
+ * counter is incremented. Once the counter reaches the configured
<code>maxGenerations</code> value,
+ * {@link #isSatisfied(Population)} returns true.
*
* @version $Id$
* @since 2.0
@@ -49,9 +47,8 @@ public class FixedGenerationCount implem
}
/**
- * Determine whether or not the given number of generations have passed.
- * Increments the number of generations counter if the maximum has not
- * been reached.
+ * Determine whether or not the given number of generations have passed.
Increments the number of generations
+ * counter if the maximum has not been reached.
*
* @param population ignored (no impact on result)
* @return <code>true</code> IFF the maximum number of generations has
been exceeded
@@ -65,6 +62,7 @@ public class FixedGenerationCount implem
}
/**
+ * Returns the number of generations that have already passed.
* @return the number of generations that have passed
*/
public int getNumGenerations() {
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/GeneticAlgorithm.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/GeneticAlgorithm.java?rev=1385284&r1=1385283&r2=1385284&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/GeneticAlgorithm.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/GeneticAlgorithm.java
Sun Sep 16 15:19:55 2012
@@ -31,10 +31,9 @@ import org.apache.commons.math3.random.J
public class GeneticAlgorithm {
/**
- * Static random number generator shared by GA implementation classes.
- * Set the randomGenerator seed to get reproducible results.
- * Use {@link #setRandomGenerator(RandomGenerator)} to supply an
alternative
- * to the default JDK-provided PRNG.
+ * Static random number generator shared by GA implementation classes. Set
the randomGenerator seed to get
+ * reproducible results. Use {@link #setRandomGenerator(RandomGenerator)}
to supply an alternative to the default
+ * JDK-provided PRNG.
*/
//@GuardedBy("this")
private static RandomGenerator randomGenerator = new JDKRandomGenerator();
@@ -58,6 +57,7 @@ public class GeneticAlgorithm {
private int generationsEvolved = 0;
/**
+ * Create a new genetic algorithm.
* @param crossoverPolicy The {@link CrossoverPolicy}
* @param crossoverRate The crossover rate as a percentage (0-1 inclusive)
* @param mutationPolicy The {@link MutationPolicy}
@@ -125,23 +125,23 @@ public class GeneticAlgorithm {
}
/**
- * <p>Evolve the given population into the next generation.</p>
- * <p><ol>
- * <li>Get nextGeneration population to fill from <code>current</code>
- * generation, using its nextGeneration method</li>
- * <li>Loop until new generation is filled:</li>
- * <ul><li>Apply configured SelectionPolicy to select a pair of parents
- * from <code>current</code></li>
- * <li>With probability = {@link #getCrossoverRate()}, apply
- * configured {@link CrossoverPolicy} to parents</li>
- * <li>With probability = {@link #getMutationRate()}, apply
- * configured {@link MutationPolicy} to each of the
offspring</li>
- * <li>Add offspring individually to nextGeneration,
- * space permitting</li>
- * </ul>
- * <li>Return nextGeneration</li>
- * </ol>
- * </p>
+ * Evolve the given population into the next generation.
+ * <p>
+ * <ol>
+ * <li>Get nextGeneration population to fill from <code>current</code>
+ * generation, using its nextGeneration method</li>
+ * <li>Loop until new generation is filled:</li>
+ * <ul><li>Apply configured SelectionPolicy to select a pair of parents
+ * from <code>current</code></li>
+ * <li>With probability = {@link #getCrossoverRate()}, apply
+ * configured {@link CrossoverPolicy} to parents</li>
+ * <li>With probability = {@link #getMutationRate()}, apply
+ * configured {@link MutationPolicy} to each of the offspring</li>
+ * <li>Add offspring individually to nextGeneration,
+ * space permitting</li>
+ * </ul>
+ * <li>Return nextGeneration</li>
+ * </ol>
*
* @param current the current population.
* @return the population for the next generation.
@@ -222,8 +222,7 @@ public class GeneticAlgorithm {
}
/**
- * Returns the number of generations evolved to
- * reach {@link StoppingCondition} in the last run.
+ * Returns the number of generations evolved to reach {@link
StoppingCondition} in the last run.
*
* @return number of generations evolved
* @since 2.1
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/ListPopulation.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/ListPopulation.java?rev=1385284&r1=1385283&r2=1385284&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/ListPopulation.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/ListPopulation.java
Sun Sep 16 15:19:55 2012
@@ -54,7 +54,9 @@ public abstract class ListPopulation imp
/**
* Creates a new ListPopulation instance.
- * <p>Note: the chromosomes of the specified list are added to the
population.</p>
+ * <p>
+ * Note: the chromosomes of the specified list are added to the population.
+ *
* @param chromosomes list of chromosomes to be added to the population
* @param populationLimit maximal size of the population
* @throws NullArgumentException if the list of chromosomes is {@code null}
@@ -79,8 +81,10 @@ public abstract class ListPopulation imp
/**
* Sets the list of chromosomes.
- * <p>Note: this method removed all existing chromosomes in the population
and adds all chromosomes
- * of the specified list to the population.</p>
+ * <p>
+ * Note: this method removed all existing chromosomes in the population
and adds all chromosomes
+ * of the specified list to the population.
+ *
* @param chromosomes the list of chromosomes
* @throws NullArgumentException if the list of chromosomes is {@code null}
* @throws NumberIsTooLargeException if the list of chromosomes exceeds
the population limit
@@ -131,9 +135,10 @@ public abstract class ListPopulation imp
/**
* Add the given chromosome to the population.
+ *
* @param chromosome the chromosome to add.
* @throws NumberIsTooLargeException if the population would exceed the
{@code populationLimit} after
- * adding this chromosome
+ * adding this chromosome
*/
public void addChromosome(final Chromosome chromosome) {
if (chromosomes.size() >= populationLimit) {
@@ -172,7 +177,7 @@ public abstract class ListPopulation imp
* @param populationLimit maximal population size.
* @throws NotPositiveException if the population limit is not a positive
number (< 1)
* @throws NumberIsTooSmallException if the new population size is smaller
than the current number
- * of chromosomes in the population
+ * of chromosomes in the population
*/
public void setPopulationLimit(final int populationLimit) {
if (populationLimit <= 0) {
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/NPointCrossover.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/NPointCrossover.java?rev=1385284&r1=1385283&r2=1385284&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/NPointCrossover.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/NPointCrossover.java
Sun Sep 16 15:19:55 2012
@@ -57,14 +57,12 @@ public class NPointCrossover<T> implemen
/**
* Creates a new {@link NPointCrossover} policy using the given number of
points.
- *
- * <p><b>Note</b>: the number of crossover points must be <
<code>chromosome length - 1</code>.
+ * <p>
+ * <b>Note</b>: the number of crossover points must be <
<code>chromosome length - 1</code>.
* This condition can only be checked at runtime, as the chromosome length
is not known in advance.
- * </p>
*
* @param crossoverPoints the number of crossover points
- * @throws NotStrictlyPositiveException if the number of {@code
crossoverPoints} is not
- * strictly positive
+ * @throws NotStrictlyPositiveException if the number of {@code
crossoverPoints} is not strictly positive
*/
public NPointCrossover(final int crossoverPoints) {
if (crossoverPoints <= 0) {
@@ -103,7 +101,7 @@ public class NPointCrossover<T> implemen
* @param second second parent (p2)
* @return pair of two children (c1,c2)
* @throws MathIllegalArgumentException iff one of the chromosomes is
- * not an instance of {@link AbstractListChromosome}
+ * not an instance of {@link AbstractListChromosome}
* @throws DimensionMismatchException if the length of the two chromosomes
is different
*/
@SuppressWarnings("unchecked") // OK because of instanceof checks
@@ -121,8 +119,7 @@ public class NPointCrossover<T> implemen
* @param second the second chromosome
* @return the pair of new chromosomes that resulted from the crossover
* @throws DimensionMismatchException if the length of the two chromosomes
is different
- * @throws NumberIsTooLargeException if the number of crossoverPoints is
too large for the
- * actual chromosomes
+ * @throws NumberIsTooLargeException if the number of crossoverPoints is
too large for the actual chromosomes
*/
private ChromosomePair mate(final AbstractListChromosome<T> first,
final AbstractListChromosome<T> second) {
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/OnePointCrossover.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/OnePointCrossover.java?rev=1385284&r1=1385283&r2=1385284&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/OnePointCrossover.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/OnePointCrossover.java
Sun Sep 16 15:19:55 2012
@@ -72,7 +72,7 @@ public class OnePointCrossover<T> implem
* @param second second parent (p2)
* @return pair of two children (c1,c2)
* @throws MathIllegalArgumentException iff one of the chromosomes is
- * not an instance of {@link AbstractListChromosome}
+ * not an instance of {@link AbstractListChromosome}
* @throws DimensionMismatchException if the length of the two chromosomes
is different
*/
@SuppressWarnings("unchecked") // OK because of instanceof checks
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/OrderedCrossover.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/OrderedCrossover.java?rev=1385284&r1=1385283&r2=1385284&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/OrderedCrossover.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/OrderedCrossover.java
Sun Sep 16 15:19:55 2012
@@ -40,15 +40,14 @@ import org.apache.commons.math3.util.Fas
* <li>starting from the right side of the slice, copy genes from parent 2
as they
* appear to child 1 if they are not yet marked out.</li>
* </ol>
- * </p>
- *
+ * <p>
* Example (random sublist from index 3 to 7, underlined):
* <pre>
* p1 = (8 4 7 3 6 2 5 1 9 0) X c1 = (0 4 7 3 6 2 5 1 8 9)
* --------- ---------
* p2 = (0 1 2 3 4 5 6 7 8 9) X c2 = (8 1 2 3 4 5 6 7 9 0)
* </pre>
- *
+ * <p>
* This policy works only on {@link AbstractListChromosome}, and therefore it
* is parameterized by T. Moreover, the chromosomes must have same lengths.
*
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/PermutationChromosome.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/PermutationChromosome.java?rev=1385284&r1=1385283&r2=1385284&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/PermutationChromosome.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/PermutationChromosome.java
Sun Sep 16 15:19:55 2012
@@ -21,8 +21,7 @@ import java.util.List;
/**
* Interface indicating that the chromosome represents a permutation of
objects.
*
- * @param <T>
- * type of the permuted objects
+ * @param <T> type of the permuted objects
* @since 2.0
* @version $Id$
*/
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/Population.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/Population.java?rev=1385284&r1=1385283&r2=1385284&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/Population.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/Population.java
Sun Sep 16 15:19:55 2012
@@ -46,7 +46,7 @@ public interface Population extends Iter
* Add the given chromosome to the population.
* @param chromosome the chromosome to add.
* @throws org.apache.commons.math3.exception.NumberIsTooLargeException if
the population would exceed
- * the population limit when adding this chromosome
+ * the population limit when adding this chromosome
*/
void addChromosome(Chromosome chromosome);
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/RandomKey.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/RandomKey.java?rev=1385284&r1=1385283&r2=1385284&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/RandomKey.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/RandomKey.java
Sun Sep 16 15:19:55 2012
@@ -27,41 +27,30 @@ import org.apache.commons.math3.exceptio
import org.apache.commons.math3.exception.util.LocalizedFormats;
/**
- * <p>
* Random Key chromosome is used for permutation representation. It is a vector
* of a fixed length of real numbers in [0,1] interval. The index of the i-th
* smallest value in the vector represents an i-th member of the permutation.
- * </p>
- *
* <p>
* For example, the random key [0.2, 0.3, 0.8, 0.1] corresponds to the
* permutation of indices (3,0,1,2). If the original (unpermuted) sequence
would
* be (a,b,c,d), this would mean the sequence (d,a,b,c).
- * </p>
- *
* <p>
* With this representation, common operators like n-point crossover can be
* used, because any such chromosome represents a valid permutation.
- * </p>
- *
* <p>
* Since the chromosome (and thus its arrayRepresentation) is immutable, the
* array representation is sorted only once in the constructor.
- * </p>
- *
* <p>
* For details, see:
* <ul>
- * <li>Bean, J.C.: Genetic algorithms and random keys for sequencing and
- * optimization. ORSA Journal on Computing 6 (1994) 154-160</li>
- * <li>Rothlauf, F.: Representations for Genetic and Evolutionary Algorithms.
- * Volume 104 of Studies in Fuzziness and Soft Computing. Physica-Verlag,
- * Heidelberg (2002)</li>
+ * <li>Bean, J.C.: Genetic algorithms and random keys for sequencing and
+ * optimization. ORSA Journal on Computing 6 (1994) 154-160</li>
+ * <li>Rothlauf, F.: Representations for Genetic and Evolutionary Algorithms.
+ * Volume 104 of Studies in Fuzziness and Soft Computing. Physica-Verlag,
+ * Heidelberg (2002)</li>
* </ul>
- * </p>
*
- * @param <T>
- * type of the permuted objects
+ * @param <T> type of the permuted objects
* @since 2.0
* @version $Id$
*/
@@ -80,7 +69,7 @@ public abstract class RandomKey<T> exten
*
* @param representation list of [0,1] values representing the permutation
* @throws InvalidRepresentationException iff the
<code>representation</code> can not represent
- * a valid chromosome
+ * a valid chromosome
*/
public RandomKey(final List<Double> representation) {
super(representation);
@@ -120,7 +109,7 @@ public abstract class RandomKey<T> exten
* @param sortedRepr sorted <code>representation</code>
* @return list with the sequence values permuted according to the
representation
* @throws DimensionMismatchException iff the length of the
<code>sequence</code>,
- * <code>representation</code> or <code>sortedRepr</code> lists are not
equal
+ * <code>representation</code> or <code>sortedRepr</code> lists are not
equal
*/
private static <S> List<S> decodeGeneric(final List<S> sequence,
List<Double> representation,
final List<Double> sortedRepr) {
@@ -258,11 +247,11 @@ public abstract class RandomKey<T> exten
* @param originalData the original, unpermuted data
* @param permutedData the data, somehow permuted
* @return representation of a permutation corresponding to the permutation
- * <code>originalData -> permutedData</code>
+ * <code>originalData -> permutedData</code>
* @throws DimensionMismatchException iff the length of
<code>originalData</code>
- * and <code>permutedData</code> lists are not equal
+ * and <code>permutedData</code> lists are not equal
* @throws MathIllegalArgumentException iff the <code>permutedData</code>
and
- * <code>originalData</code> lists contain different data
+ * <code>originalData</code> lists contain different data
*/
public static <S> List<Double> inducedPermutation(final List<S>
originalData,
final List<S>
permutedData) {
@@ -286,9 +275,6 @@ public abstract class RandomKey<T> exten
return Arrays.asList(res);
}
- /**
- * {@inheritDoc}
- */
@Override
public String toString() {
return String.format("(f=%s pi=(%s))", getFitness(),
baseSeqPermutation);
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/RandomKeyMutation.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/RandomKeyMutation.java?rev=1385284&r1=1385283&r2=1385284&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/RandomKeyMutation.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/RandomKeyMutation.java
Sun Sep 16 15:19:55 2012
@@ -34,8 +34,7 @@ public class RandomKeyMutation implement
/**
* {@inheritDoc}
*
- * @throws MathIllegalArgumentException if <code>original</code> is not a
- * {@link RandomKey} instance
+ * @throws MathIllegalArgumentException if <code>original</code> is not a
{@link RandomKey} instance
*/
public Chromosome mutate(final Chromosome original) {
if (!(original instanceof RandomKey<?>)) {
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/StoppingCondition.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/StoppingCondition.java?rev=1385284&r1=1385283&r2=1385284&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/StoppingCondition.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/StoppingCondition.java
Sun Sep 16 15:19:55 2012
@@ -24,12 +24,11 @@ package org.apache.commons.math3.genetic
*/
public interface StoppingCondition {
/**
- * Determine whether or not the given population satisfies the stopping
- * condition.
+ * Determine whether or not the given population satisfies the stopping
condition.
*
* @param population the population to test.
- * @return <code>true</code> if this stopping condition is met by the
- * given population. <code>false</code> otherwise.
+ * @return <code>true</code> if this stopping condition is met by the
given population,
+ * <code>false</code> otherwise.
*/
boolean isSatisfied(Population population);
}
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/TournamentSelection.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/TournamentSelection.java?rev=1385284&r1=1385283&r2=1385284&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/TournamentSelection.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/TournamentSelection.java
Sun Sep 16 15:19:55 2012
@@ -60,14 +60,12 @@ public class TournamentSelection impleme
}
/**
- * Helper for {@link #select(Population)}. Draw {@link #arity} random
- * chromosomes without replacement from the population, and then select the
- * fittest chromosome among them.
+ * Helper for {@link #select(Population)}. Draw {@link #arity} random
chromosomes without replacement from the
+ * population, and then select the fittest chromosome among them.
*
* @param population the population from which the chromosomes are choosen.
* @return the selected chromosome.
- * @throws MathIllegalArgumentException if the tournament arity is bigger
than the
- * population size
+ * @throws MathIllegalArgumentException if the tournament arity is bigger
than the population size
*/
private Chromosome tournament(final ListPopulation population) {
if (population.getPopulationSize() < this.arity) {
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/UniformCrossover.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/UniformCrossover.java?rev=1385284&r1=1385283&r2=1385284&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/UniformCrossover.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/UniformCrossover.java
Sun Sep 16 15:19:55 2012
@@ -32,16 +32,15 @@ import org.apache.commons.math3.random.R
* parent. This is typically a poor method of crossover, but empirical evidence
* suggests that it is more exploratory and results in a larger part of the
* problem space being searched.
- *
- * <p>This crossover policy evaluates each gene of the parent chromosomes by
chosing a
+ * <p>
+ * This crossover policy evaluates each gene of the parent chromosomes by
chosing a
* uniform random number {@code p} in the range [0, 1]. If {@code p} <
{@code ratio},
* the parent genes are swapped. This means with a ratio of 0.7, 30% of the
genes from the
* first parent and 70% from the second parent will be selected for the first
offspring (and
- * vice versa for the second offspring).</p>
- *
- * <p>This policy works only on {@link AbstractListChromosome}, and therefore
it
+ * vice versa for the second offspring).
+ * <p>
+ * This policy works only on {@link AbstractListChromosome}, and therefore it
* is parameterized by T. Moreover, the chromosomes must have same lengths.
- * </p>
*
* @see <a
href="http://en.wikipedia.org/wiki/Crossover_%28genetic_algorithm%29">Crossover
techniques (Wikipedia)</a>
* @see <a
href="http://www.obitko.com/tutorials/genetic-algorithms/crossover-mutation.php">Crossover
(Obitko.com)</a>
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/package-info.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/package-info.java?rev=1385284&r1=1385283&r2=1385284&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/package-info.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/genetics/package-info.java
Sun Sep 16 15:19:55 2012
@@ -15,10 +15,6 @@
* limitations under the License.
*/
/**
- *
- * <p>
* This package provides Genetic Algorithms components and implementations.
- * </p>
- *
*/
package org.apache.commons.math3.genetics;