public abstract class Problem extends Module
Problem
is to evaluate a population and assign a fitness value to each chromosome.
BestFitness.HIGH
or BestFitness.LOW
as appropriate.
Fitness orientation is set to high by default.
setFunctionSet()
, setFileExtension()
and setFitnessOrientation()
,
with the respective arguments. As with all subclasses of Module
, setName()
and
registerParameters()
should be used where appropriate as well.
Resources.reportln()
and Resources.report()
to print any relevant information. Note that reportln() and report() are affected
by the report interval base parameter. Use Resources.println()
and
Resources.print()
to print information regardless of the current generation.
See Resources
for more information.Module
Modifier and Type | Method and Description |
---|---|
abstract void |
evaluate(Population population)
The most important method of the problem type.
|
double |
getBestFitness() |
java.lang.String |
getFileExtension() |
BestFitness |
getFitnessOrientation() |
FunctionSet |
getFunctionSet() |
abstract int |
hasImprovement(Population population)
Used to assert whether a given population has a chromosome that is an improvement over
the current best chromosome.
|
abstract int |
hasPerfectSolution(Population population)
Used to assert whether a given population contains a perfect solution
to the problem.
|
abstract void |
parseProblemData(java.io.File file,
ModifiableResources resources)
Parses the specified file and uses the parsed data to
set up the problem type instance appropriately.
|
void |
reset()
Resets the bestFitness parameter.
|
getLocalParameters, toString
public abstract void evaluate(Population population)
population
- the population to be evaluated.public abstract int hasPerfectSolution(Population population)
population
- the population to search through for a perfect chromosome.public abstract int hasImprovement(Population population)
population
- the population potentially containing a fitter chromosome.public abstract void parseProblemData(java.io.File file, ModifiableResources resources)
ModifiableResources
instance.
file
- the data file to parse.resources
- a modifiable reference to the experiment's resources.public FunctionSet getFunctionSet()
public java.lang.String getFileExtension()
public BestFitness getFitnessOrientation()
public double getBestFitness()
public void reset()