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
Constructor and Description |
---|
Problem(Resources resources)
Initialises the two problem-wide parameters, maxFitness and bestFitness.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
evaluate(Population population,
Resources resources)
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 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.
|
abstract int |
perfectSolutionFound(Population population)
Used to assert whether a given population contains a perfect solution
to the problem.
|
void |
reset()
Resets the bestFitness parameter.
|
getLocalParameters, toString
public Problem(Resources resources)
resources
- a reference to the experiment's resources.public abstract void evaluate(Population population, Resources resources)
population
- the population to be evaluated.resources
- parameters and utilities for optional reference.public abstract int perfectSolutionFound(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()