|
JGAP | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jgap.impl.salesman.Salesman
public abstract class Salesman
The class solves the travelling salesman problem. The traveling salesman problem, or TSP for short, is this: given a finite number of 'cities' along with the cost of travel between each pair of them, find the cheapest way of visiting all the cities and returning to your starting point.)
Constructor Summary | |
---|---|
Salesman()
|
Method Summary | |
---|---|
Configuration |
createConfiguration(java.lang.Object a_initial_data)
Create a configuration. |
FitnessFunction |
createFitnessFunction(java.lang.Object a_initial_data)
Return the fitness function to use. |
abstract IChromosome |
createSampleChromosome(java.lang.Object a_initial_data)
Override this method to create a single sample chromosome, representing a list of "cities". |
abstract double |
distance(Gene a_from,
Gene a_to)
Override this method to compute the distance between "cities", indicated by these two given genes. |
IChromosome |
findOptimalPath(java.lang.Object a_initial_data)
Executes the genetic algorithm to determine the optimal path between the cities. |
Configuration |
getConfiguration()
|
int |
getMaxEvolution()
|
int |
getPopulationSize()
|
int |
getStartOffset()
Gets a number of genes at the start of chromosome, that are excluded from the swapping. |
void |
setMaxEvolution(int a_maxEvolution)
Set the maximal number of iterations for population to evolve (default 512). |
void |
setPopulationSize(int a_populationSize)
Set an population size for this solution (default 512) |
void |
setStartOffset(int a_offset)
Sets a number of genes at the start of chromosome, that are excluded from the swapping. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Salesman()
Method Detail |
---|
public abstract double distance(Gene a_from, Gene a_to)
a_from
- first gene, representing a citya_to
- second gene, representing a city
public abstract IChromosome createSampleChromosome(java.lang.Object a_initial_data)
a_initial_data
- the same object as was passed to findOptimalPath.
It can be used to specify the task more precisely if the class is
used for solving multiple tasks
public FitnessFunction createFitnessFunction(java.lang.Object a_initial_data)
a_initial_data
- the same object as was passed to findOptimalPath.
It can be used to specify the task more precisely if the class is
used for solving multiple tasks
public Configuration createConfiguration(java.lang.Object a_initial_data) throws InvalidConfigurationException
a_initial_data
- the same object as was passed to findOptimalPath.
It can be used to specify the task more precisely if the class is
used for solving multiple tasks
InvalidConfigurationException
public int getMaxEvolution()
public void setMaxEvolution(int a_maxEvolution)
a_maxEvolution
- sicpublic int getPopulationSize()
public void setPopulationSize(int a_populationSize)
a_populationSize
- sicpublic IChromosome findOptimalPath(java.lang.Object a_initial_data) throws java.lang.Exception
a_initial_data
- can be a record with fields, specifying the
task more precisely if the class is used to solve multiple tasks.
It is passed to createFitnessFunction, createSampleChromosome and
createConfiguration
java.lang.Exception
public void setStartOffset(int a_offset)
a_offset
- start offset for chromosomepublic int getStartOffset()
public Configuration getConfiguration()
|
JGAP | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |