-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add single objective optimization algorithm, add method for finding i…
…deal point for given problem
- Loading branch information
Showing
2 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package core.algorithm; | ||
|
||
import java.util.Comparator; | ||
|
||
import core.Population; | ||
import core.Problem; | ||
import core.points.Solution; | ||
import operators.CrossoverOperator; | ||
import operators.MutationOperator; | ||
import operators.SelectionOperator; | ||
import solutionRankers.ChebyshevRanker; | ||
|
||
public class SingleObjectiveEA extends EA{ | ||
|
||
protected Comparator <Solution> comp; | ||
protected int popSize; | ||
public SingleObjectiveEA(Problem problem, SelectionOperator selectionOperator, CrossoverOperator crossoverOperator, | ||
MutationOperator mutationOperator, ChebyshevRanker cr, int popSize) { | ||
super(problem, selectionOperator, crossoverOperator, mutationOperator); | ||
this.popSize = popSize; | ||
population = problem.createPopulation(popSize); | ||
comp = cr; | ||
} | ||
|
||
@Override | ||
protected Population selectNewPopulation(Population pop) { | ||
pop.getSolutions().sort(comp); | ||
Population res = new Population(pop.getSolutions().subList(0, popSize)); | ||
return res; | ||
} | ||
|
||
} |