aboutsummaryrefslogtreecommitdiffstats
path: root/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/BestFirstStrategyForModelGeneration.java
diff options
context:
space:
mode:
Diffstat (limited to 'Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/BestFirstStrategyForModelGeneration.java')
-rw-r--r--Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/BestFirstStrategyForModelGeneration.java22
1 files changed, 5 insertions, 17 deletions
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/BestFirstStrategyForModelGeneration.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/BestFirstStrategyForModelGeneration.java
index e529892c..09575384 100644
--- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/BestFirstStrategyForModelGeneration.java
+++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/BestFirstStrategyForModelGeneration.java
@@ -18,6 +18,7 @@ import java.util.List;
18import java.util.PriorityQueue; 18import java.util.PriorityQueue;
19import java.util.Random; 19import java.util.Random;
20 20
21import org.apache.log4j.Level;
21import org.apache.log4j.Logger; 22import org.apache.log4j.Logger;
22import org.eclipse.emf.ecore.EObject; 23import org.eclipse.emf.ecore.EObject;
23import org.eclipse.emf.ecore.util.EcoreUtil; 24import org.eclipse.emf.ecore.util.EcoreUtil;
@@ -76,7 +77,7 @@ public class BestFirstStrategyForModelGeneration implements IStrategy {
76 private volatile boolean isInterrupted = false; 77 private volatile boolean isInterrupted = false;
77 private ModelResult modelResultByInternalSolver = null; 78 private ModelResult modelResultByInternalSolver = null;
78 private Random random = new Random(); 79 private Random random = new Random();
79 //private Collection<ViatraQueryMatcher<? extends IPatternMatch>> matchers; 80// private Collection<ViatraQueryMatcher<? extends IPatternMatch>> matchers;
80 public ActivationSelector activationSelector = new EvenActivationSelector(random); 81 public ActivationSelector activationSelector = new EvenActivationSelector(random);
81 public ViatraReasonerSolutionSaver solutionSaver; 82 public ViatraReasonerSolutionSaver solutionSaver;
82 public NumericSolver numericSolver; 83 public NumericSolver numericSolver;
@@ -100,7 +101,7 @@ public class BestFirstStrategyForModelGeneration implements IStrategy {
100 this.method = method; 101 this.method = method;
101 this.solutionSaver = solutionSaver; 102 this.solutionSaver = solutionSaver;
102 this.numericSolver = numericSolver; 103 this.numericSolver = numericSolver;
103 //logger.setLevel(Level.DEBUG); 104// logger.setLevel(Level.DEBUG);
104 } 105 }
105 106
106 public int getNumberOfStatecoderFail() { 107 public int getNumberOfStatecoderFail() {
@@ -136,7 +137,6 @@ public class BestFirstStrategyForModelGeneration implements IStrategy {
136// ViatraQueryEngine engine = context.getQueryEngine(); 137// ViatraQueryEngine engine = context.getQueryEngine();
137// matchers = new LinkedList<ViatraQueryMatcher<? extends IPatternMatch>>(); 138// matchers = new LinkedList<ViatraQueryMatcher<? extends IPatternMatch>>();
138// for(IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>> p : this.method.getAllPatterns()) { 139// for(IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>> p : this.method.getAllPatterns()) {
139// //System.out.println(p.getSimpleName());
140// ViatraQueryMatcher<? extends IPatternMatch> matcher = p.getMatcher(engine); 140// ViatraQueryMatcher<? extends IPatternMatch> matcher = p.getMatcher(engine);
141// matchers.add(matcher); 141// matchers.add(matcher);
142// } 142// }
@@ -154,13 +154,6 @@ public class BestFirstStrategyForModelGeneration implements IStrategy {
154 154
155 @Override 155 @Override
156 public void explore() { 156 public void explore() {
157// System.out.println("press enter");
158// try {
159// new BufferedReader(new InputStreamReader(System.in)).readLine();
160// } catch (IOException e) {
161// // TODO Auto-generated catch block
162// e.printStackTrace();
163// }
164 this.explorationStarted=System.nanoTime(); 157 this.explorationStarted=System.nanoTime();
165 if (!checkGlobalConstraints()) { 158 if (!checkGlobalConstraints()) {
166 logger.info("Global contraint is not satisifed in the first state. Terminate."); 159 logger.info("Global contraint is not satisifed in the first state. Terminate.");
@@ -219,10 +212,6 @@ public class BestFirstStrategyForModelGeneration implements IStrategy {
219 212
220 while (!isInterrupted && !configuration.progressMonitor.isCancelled() && iterator.hasNext()) { 213 while (!isInterrupted && !configuration.progressMonitor.isCancelled() && iterator.hasNext()) {
221 final Object nextActivation = iterator.next(); 214 final Object nextActivation = iterator.next();
222// if (!iterator.hasNext()) {
223// logger.debug("Last untraversed activation of the state.");
224// trajectoiresToExplore.remove(currentTrajectoryWithfitness);
225// }
226 logger.debug("Executing new activation: " + nextActivation); 215 logger.debug("Executing new activation: " + nextActivation);
227 context.executeAcitvationId(nextActivation); 216 context.executeAcitvationId(nextActivation);
228 method.getStatistics().incrementDecisionCount(); 217 method.getStatistics().incrementDecisionCount();
@@ -230,10 +219,9 @@ public class BestFirstStrategyForModelGeneration implements IStrategy {
230 visualiseCurrentState(); 219 visualiseCurrentState();
231// for(ViatraQueryMatcher<? extends IPatternMatch> matcher : matchers) { 220// for(ViatraQueryMatcher<? extends IPatternMatch> matcher : matchers) {
232// int c = matcher.countMatches(); 221// int c = matcher.countMatches();
233// if(c>=100) { 222// if(c>=1) {
234// System.out.println(c+ " " +matcher.getPatternName()); 223// System.out.println(c+ " " +matcher.getPatternName());
235// } 224// }
236//
237// } 225// }
238 226
239 boolean consistencyCheckResult = checkConsistency(currentTrajectoryWithFitness); 227 boolean consistencyCheckResult = checkConsistency(currentTrajectoryWithFitness);