Package jeco.core.problem
Class GrammaticalEvolutionAbstractProblem
- Direct Known Subclasses:
GrammaticalEvolutionProblem,GrammaticalEvolutionProblemSimple,GrammaticalEvolutionStaticModel,GrammaticalEvolutionTemporalModel
Abstract class for grammatical evolution problems.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault length of the chromosome.static final intDefault upper bound for the codons.protected booleanCorrect solution or not.protected intCurrent index.protected intCurrent wrapping.static final intDefault maximum number of wrappings.protected intMaximum number of wrappings.static final intDefault number of objectives.protected StringPath to the BNF file.protected BnfReaderBNF reader.Fields inherited from class jeco.core.problem.Problem
INFINITY, lowerBound, numberOfObjectives, numberOfVariables, upperBound -
Constructor Summary
ConstructorsConstructorDescriptionGrammaticalEvolutionAbstractProblem(String pathToBnf) Constructor.GrammaticalEvolutionAbstractProblem(String pathToBnf, int numberOfObjectives) Constructor.GrammaticalEvolutionAbstractProblem(String pathToBnf, int numberOfObjectives, int chromosomeLength, int maxCntWrappings, int codonUpperBound) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidFunction to evaluate a solution.abstract voidevaluate(Solution<Variable<Integer>> solution, GrammaticalEvolutionPhenotype phenotype) Evaluate the solution.voidFunction to evaluate a set of solutions.generatePhenotype(Solution<Variable<Integer>> solution) Generate the phenotype of the solution.newRandomSetOfSolutions(int size) Function to create a new random set of solutions.voidprocessProduction(Production currentProduction, Solution<Variable<Integer>> solution, LinkedList<String> phenotype) Process the production.Methods inherited from class jeco.core.problem.Problem
clone, getLowerBound, getNumberOfObjectives, getNumberOfVariables, getUpperBound
-
Field Details
-
CHROMOSOME_LENGTH_DEFAULT
public static final int CHROMOSOME_LENGTH_DEFAULTDefault length of the chromosome.- See Also:
-
CODON_UPPER_BOUND_DEFAULT
public static final int CODON_UPPER_BOUND_DEFAULTDefault upper bound for the codons.- See Also:
-
MAX_CNT_WRAPPINGS_DEFAULT
public static final int MAX_CNT_WRAPPINGS_DEFAULTDefault maximum number of wrappings.- See Also:
-
NUM_OF_OBJECTIVES_DEFAULT
public static final int NUM_OF_OBJECTIVES_DEFAULTDefault number of objectives.- See Also:
-
pathToBnf
Path to the BNF file. -
reader
BNF reader. -
maxCntWrappings
protected int maxCntWrappingsMaximum number of wrappings. -
currentIdx
protected int currentIdxCurrent index. -
currentWrp
protected int currentWrpCurrent wrapping. -
correctSol
protected boolean correctSolCorrect solution or not.
-
-
Constructor Details
-
GrammaticalEvolutionAbstractProblem
public GrammaticalEvolutionAbstractProblem(String pathToBnf, int numberOfObjectives, int chromosomeLength, int maxCntWrappings, int codonUpperBound) Constructor.- Parameters:
pathToBnf- Path to the BNF file.numberOfObjectives- Number of objectives.chromosomeLength- Length of the chromosome.maxCntWrappings- Maximum number of wrappings.codonUpperBound- Upper bound for the codons.
-
GrammaticalEvolutionAbstractProblem
Constructor.- Parameters:
pathToBnf- Path to the BNF file.numberOfObjectives- Number of objectives.
-
GrammaticalEvolutionAbstractProblem
Constructor.- Parameters:
pathToBnf- Path to the BNF file.
-
-
Method Details
-
evaluate
public abstract void evaluate(Solution<Variable<Integer>> solution, GrammaticalEvolutionPhenotype phenotype) Evaluate the solution.- Parameters:
solution- Solution to evaluate.phenotype- Phenotype of the solution.
-
evaluate
Description copied from class:ProblemFunction to evaluate a set of solutions. -
evaluate
Description copied from class:ProblemFunction to evaluate a solution. -
generatePhenotype
Generate the phenotype of the solution.- Parameters:
solution- Solution.- Returns:
- Phenotype of the solution.
-
processProduction
public void processProduction(Production currentProduction, Solution<Variable<Integer>> solution, LinkedList<String> phenotype) Process the production.- Parameters:
currentProduction- Current production.solution- Solution.phenotype- Phenotype.
-
newRandomSetOfSolutions
Description copied from class:ProblemFunction to create a new random set of solutions.- Specified by:
newRandomSetOfSolutionsin classProblem<Variable<Integer>>- Parameters:
size- Size of the set.- Returns:
- New random set of solutions.
-