1 | package de.uka.ipd.sdq.dsexplore.opt4j.optimizer; |
2 | |
3 | import org.eclipse.core.runtime.CoreException; |
4 | import org.opt4j.core.Archive; |
5 | import org.opt4j.core.Individual; |
6 | import org.opt4j.core.IndividualBuilder; |
7 | import org.opt4j.core.Population; |
8 | import org.opt4j.core.optimizer.AbstractOptimizer; |
9 | import org.opt4j.core.optimizer.Completer; |
10 | import org.opt4j.core.optimizer.Control; |
11 | import org.opt4j.core.optimizer.StopException; |
12 | import org.opt4j.core.optimizer.TerminationException; |
13 | |
14 | import com.google.inject.Inject; |
15 | |
16 | import de.uka.ipd.sdq.dsexplore.opt4j.start.Opt4JStarter; |
17 | |
18 | public class PredefinedInstanceEvaluator extends AbstractOptimizer { |
19 | |
20 | @Inject |
21 | public PredefinedInstanceEvaluator(Population population, Archive archive, |
22 | IndividualBuilder individualBuilder, Completer completer, |
23 | Control control){ |
24 | |
25 | super(population, archive, individualBuilder, completer, control); |
26 | |
27 | } |
28 | |
29 | @Override |
30 | public void optimize() throws StopException, TerminationException { |
31 | |
32 | try { |
33 | int numberOfCandidatesToEvaluate = Opt4JStarter.getDSECreator().getNumberOfNotEvaluatedPredefinedOnes(); |
34 | |
35 | for (int i = 0; i < numberOfCandidatesToEvaluate; i ++){ |
36 | Individual indiv = individualBuilder.build(); |
37 | population.add(indiv); |
38 | } |
39 | |
40 | nextIteration(); |
41 | |
42 | } catch (CoreException e) { |
43 | // TODO Auto-generated catch block |
44 | e.printStackTrace(); |
45 | } |
46 | |
47 | |
48 | |
49 | |
50 | } |
51 | |
52 | } |