com.Bayesia.positioning.algorithm
Class GeneticPositioning

java.lang.Object
  extended bycom.Bayesia.positioning.algorithm.GeneticPositioning

public final class GeneticPositioning
extends java.lang.Object

The class GeneticPositioning is used to compute the positions of the vertices of a com.Bayesia.positioning.structure.Graph.

The GeneticPositioning can be created specifying the size of the population used, the individual mutation rate, the gene mutation rate and the selection rate.

It can be run in a thread or not. If not, the method start(int) must be used.

To listen to the progress of the positioning , a ProgressListener can be added to it.

Warning: The start() method must be used in a thread so the algorithm could be stopped with stop().

Please see Graph Please see ProgressListener

Version:
2.0 28/10/04
Author:
Bayesia S.A.

Constructor Summary
GeneticPositioning(java.lang.String licenseKey, Graph graph, int populationSize, double individualMutationRate, double geneMutationRate, double selectionRate)
          Create a new GeneticPositioning on the given Graph with populationSize as the population size and the different rates.
 
Method Summary
 void addProgressListener(ProgressListener l)
          Adds a listener to the list that's notified each time a change to the progress model occurs.
 void removeProgressListener(ProgressListener l)
          Removes a listener from the list that's notified each time a change to the progress model occurs.
 void start()
          Start the genetic positioning algorithm.
 void start(int maximumGenerationNumber)
          Start the genetic positioning algorithm with the specified maximum number of generations.
 void stop()
          Stop the running genetic positioning algorithm if this one was run in a thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeneticPositioning

public GeneticPositioning(java.lang.String licenseKey,
                          Graph graph,
                          int populationSize,
                          double individualMutationRate,
                          double geneMutationRate,
                          double selectionRate)
Create a new GeneticPositioning on the given Graph with populationSize as the population size and the different rates.

Parameters:
licenseKey - a valid license key
graph - the graph on which the positioning is done
populationSize - the size of the population to use (>0)
individualMutationRate - the mutation rate of each individual ([0, 1])
geneMutationRate - the mutation rate of a gene ([0, 1])
selectionRate - the selection rate ([0, 1])
See Also:
Graph
Method Detail

addProgressListener

public void addProgressListener(ProgressListener l)
Adds a listener to the list that's notified each time a change to the progress model occurs.

Parameters:
l - the ProgressListener

removeProgressListener

public void removeProgressListener(ProgressListener l)
Removes a listener from the list that's notified each time a change to the progress model occurs.

Parameters:
l - the ProgressListener

start

public void start()
Start the genetic positioning algorithm. Warning: This method must be used in thread !

Example :

 final GeneticPositioning positioning = new GeneticPositioning(graph, 100, 0.2, 0.2, 0.2);
 Thread t = new Thread() {
 		public void run() {
 			positioning.start();
 		}
 };
 t.setPriority(Thread.MIN_PRIORITY);
 t.start();
 
To stop the algorithm use the stop method.

See Also:
stop()

start

public void start(int maximumGenerationNumber)
Start the genetic positioning algorithm with the specified maximum number of generations. This method can be used in a thread or not. If it is used in a thread, it can be stopped before the maximum number of generations would be reached with the stop method.

Parameters:
maximumGenerationNumber - the number of generations the algorithm will compute (>0).
See Also:
start(), stop()

stop

public void stop()
Stop the running genetic positioning algorithm if this one was run in a thread.

See Also:
start(), start(int)