public class MKProblem extends Problem<BinaryRepresentation>
Constructor and Description |
---|
MKProblem(java.lang.String filename)
Constructor.
|
MKProblem(java.lang.String filename,
int which)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
compare(double d1,
double d2)
Comparator which defines if it's a minimization or maximization problem.
|
void |
crossover(BinaryRepresentation r1,
BinaryRepresentation r2,
java.util.BitSet n)
Epigenetic crossover of two solutions.
|
BinaryRepresentation |
generateSolution()
Generate a new solution of the Problem.
|
static void |
main(java.lang.String[] args)
Used to convert to CPLEX format.
|
void |
methilate(BinaryRepresentation r,
java.util.BitSet n,
float eprobability)
Epigenetic methilation of a solution.
|
void |
save(BinaryRepresentation representation,
java.lang.String file)
Saves the problem representation to a file.
|
void |
saveCPLEX(java.lang.String filename,
java.lang.String name)
Saves the problem instance to CPLEX format.
|
java.lang.String |
toString()
Returns the String representation of the Problem
|
getEvaluations, getFitness, getSize, isBetter
public MKProblem(java.lang.String filename) throws java.io.IOException
filename
- the name of the file containing the instancejava.io.IOException
- if the file cannot be read.public MKProblem(java.lang.String filename, int which) throws java.io.IOException
filename
- the name of the file containing the instanceswhich
- the instance to loadjava.io.IOException
- if the file cannot be read.public java.lang.String toString()
Problem
toString
in class Problem<BinaryRepresentation>
public void saveCPLEX(java.lang.String filename, java.lang.String name) throws java.io.IOException
filename
- the file.name
- the instance name.java.io.IOException
- if the file cannot be saved.public static void main(java.lang.String[] args) throws java.lang.Exception
args
- mkpfile cplexfile name [instance]java.lang.NumberFormatException
- if the instance number is not a valid numberjava.lang.Exception
- if something goes wrongpublic BinaryRepresentation generateSolution()
Problem
generateSolution
in class Problem<BinaryRepresentation>
public void crossover(BinaryRepresentation r1, BinaryRepresentation r2, java.util.BitSet n)
Problem
crossover
in class Problem<BinaryRepresentation>
r1
- the representation of the first solutionr2
- the representation of the second solutionn
- the nucleosome vectorpublic void methilate(BinaryRepresentation r, java.util.BitSet n, float eprobability)
Problem
methilate
in class Problem<BinaryRepresentation>
r
- the representation of the solutionn
- the nucleosome vectoreprobability
- the epigenetic probabilitypublic int compare(double d1, double d2)
Problem
compare
in class Problem<BinaryRepresentation>
d1
- the first fitness valued2
- the second fitness valuepublic void save(BinaryRepresentation representation, java.lang.String file) throws java.io.FileNotFoundException
Problem
save
in class Problem<BinaryRepresentation>
representation
- the representationfile
- the filenamejava.io.FileNotFoundException
- If the file cannot be saved