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 int
Default length of the chromosome.static final int
Default upper bound for the codons.protected boolean
Correct solution or not.protected int
Current index.protected int
Current wrapping.static final int
Default maximum number of wrappings.protected int
Maximum number of wrappings.static final int
Default number of objectives.protected String
Path to the BNF file.protected BnfReader
BNF 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 TypeMethodDescriptionvoid
Function to evaluate a solution.abstract void
evaluate
(Solution<Variable<Integer>> solution, GrammaticalEvolutionPhenotype phenotype) Evaluate the solution.void
Function 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.void
processProduction
(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:Problem
Function to evaluate a set of solutions. -
evaluate
Description copied from class:Problem
Function 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:Problem
Function to create a new random set of solutions.- Specified by:
newRandomSetOfSolutions
in classProblem<Variable<Integer>>
- Parameters:
size
- Size of the set.- Returns:
- New random set of solutions.
-