jenes.tutorials.problem2
Class PatternProblem
java.lang.Object
jenes.tutorials.problem2.PatternProblem
- All Implemented Interfaces:
- GenerationEventListener<IntegerChromosome>
public class PatternProblem
- extends java.lang.Object
- implements GenerationEventListener<IntegerChromosome>
Tutorial showing how to extend GeneticAlgorithm
and how to use
the flexible and configurable breeding structure in Jenes.
The problem consists in searching a pattern of integers with a given precision.
Solutions flow through two different crossovers in parallel. Some are processed by
a single point crossover, the other by a double point crossover.
After solutions are mutated.
This is the main class that specifies the problem.
- Since:
- 1.0
- Version:
- 1.3
- Author:
- Luigi Troiano, Pierpaolo Lombardi
Method Summary |
static void |
main(java.lang.String[] args)
|
void |
onGeneration(GeneticAlgorithm ga,
long time)
Invoked when at the end of one generation step |
void |
run(int[] target,
int precision)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PatternProblem
public PatternProblem()
run
public void run(int[] target,
int precision)
onGeneration
public void onGeneration(GeneticAlgorithm ga,
long time)
- Description copied from interface:
GenerationEventListener
- Invoked when at the end of one generation step
- Specified by:
onGeneration
in interface GenerationEventListener<IntegerChromosome>
- Parameters:
ga
- the genetic algorithm generating the eventtime
- the event time expressed in milliseconds
main
public static void main(java.lang.String[] args)