| 1 | package de.uka.ipd.sdq.dsexplore.opt4j.representation; |
| 2 | |
| 3 | import org.opt4j.config.annotations.Info; |
| 4 | import org.opt4j.config.annotations.Order; |
| 5 | import org.opt4j.core.IndividualBuilder; |
| 6 | import org.opt4j.core.optimizer.Iterations; |
| 7 | import org.opt4j.core.optimizer.OptimizerModule; |
| 8 | import org.opt4j.operator.copy.CopyModule; |
| 9 | import org.opt4j.start.Constant; |
| 10 | |
| 11 | import de.uka.ipd.sdq.dsexplore.opt4j.operator.CopyDesignDecisionGenotype; |
| 12 | import de.uka.ipd.sdq.dsexplore.opt4j.optimizer.RuleBasedSearch; |
| 13 | |
| 14 | public class RuleBasedSearchModule extends OptimizerModule { |
| 15 | |
| 16 | @Info("The number of generations.") |
| 17 | @Order(0) |
| 18 | @Iterations |
| 19 | protected int generations = 1000; |
| 20 | |
| 21 | @Info("Whether to perform a full search (true) or discard / prune suboptimal candidates (false)") |
| 22 | @Order(1) |
| 23 | @Constant(value = "fullSearch", namespace = RuleBasedSearch.class) |
| 24 | protected boolean fullSearch; |
| 25 | |
| 26 | |
| 27 | @Override |
| 28 | protected void config() { |
| 29 | bindOptimizer(RuleBasedSearch.class); |
| 30 | |
| 31 | bind(IndividualBuilder.class).to(DSEIndividualBuilder.class); |
| 32 | |
| 33 | CopyModule.addCopy(binder(), CopyDesignDecisionGenotype.class); |
| 34 | |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * Returns the number of generations. |
| 39 | * |
| 40 | * @return the number of generations |
| 41 | */ |
| 42 | public int getGenerations() { |
| 43 | return generations; |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * Sets the number of generations. |
| 48 | * |
| 49 | * @param generations |
| 50 | * the number of generations |
| 51 | */ |
| 52 | public void setGenerations(int generations) { |
| 53 | this.generations = generations; |
| 54 | } |
| 55 | |
| 56 | public void setFullSearch(boolean fullRuleBasedSearch) { |
| 57 | this.fullSearch = fullRuleBasedSearch; |
| 58 | } |
| 59 | |
| 60 | public boolean isFullSearch(){ |
| 61 | return this.fullSearch; |
| 62 | } |
| 63 | |
| 64 | |
| 65 | } |