R
- the representation typepublic abstract class Problem<R extends Representation<?>>
extends java.lang.Object
Constructor and Description |
---|
Problem(int size,
boolean cache)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
abstract int |
compare(double d1,
double d2)
Comparator which defines if it's a minimization or maximization problem.
|
abstract void |
crossover(R r1,
R r2,
java.util.BitSet n)
Epigenetic crossover of two solutions.
|
abstract R |
generateSolution()
Generate a new solution of the Problem.
|
int |
getEvaluations()
Returns the number of evaluations done.
|
double |
getFitness(R representation)
Compute and return the fitness value.
|
int |
getSize()
Returns the size of the solution vector of the problem.
|
boolean |
isBetter(double d1,
double d2)
Returns true if the first fitness value is better than the second one, according to the comparison
function.
|
abstract void |
methilate(R r,
java.util.BitSet n,
float eprobability)
Epigenetic methilation of a solution.
|
abstract void |
save(R representation,
java.lang.String file)
Saves the problem representation to a file.
|
java.lang.String |
toString()
Returns the String representation of the Problem
|
public Problem(int size, boolean cache)
size
- the problem size.cache
- true if a hash table will be used as a evaluation cache.public abstract R generateSolution()
public java.lang.String toString()
toString
in class java.lang.Object
public double getFitness(R representation)
representation
- the representation to be evaluated.public int getEvaluations()
public int getSize()
public abstract void crossover(R r1, R r2, java.util.BitSet n)
r1
- the representation of the first solutionr2
- the representation of the second solutionn
- the nucleosome vectorpublic abstract void methilate(R r, java.util.BitSet n, float eprobability)
r
- the representation of the solutionn
- the nucleosome vectoreprobability
- the epigenetic probabilitypublic boolean isBetter(double d1, double d2)
d1
- the first fitness valued2
- the second fitness valuepublic abstract int compare(double d1, double d2)
d1
- the first fitness valued2
- the second fitness valuepublic abstract void save(R representation, java.lang.String file) throws java.io.FileNotFoundException
representation
- the representationfile
- the filenamejava.io.FileNotFoundException
- If the file cannot be saved