diff options
Diffstat (limited to 'Solvers')
2 files changed, 19 insertions, 3 deletions
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasoner.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasoner.xtend index 198beabb..45379e36 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasoner.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasoner.xtend | |||
@@ -99,7 +99,7 @@ class ViatraReasoner extends LogicReasoner{ | |||
99 | dse.addTransformationRule(rule) | 99 | dse.addTransformationRule(rule) |
100 | } | 100 | } |
101 | 101 | ||
102 | val strategy = new BestFirstStrategyForModelGeneration(workspace,viatraConfig) | 102 | val strategy = new BestFirstStrategyForModelGeneration(workspace,viatraConfig,method) |
103 | viatraConfig.progressMonitor.workedForwardTransformation | 103 | viatraConfig.progressMonitor.workedForwardTransformation |
104 | 104 | ||
105 | val transformationTime = System.nanoTime - transformationStartTime | 105 | val transformationTime = System.nanoTime - transformationStartTime |
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 63697887..63bd3b17 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 | |||
@@ -25,12 +25,17 @@ import org.eclipse.viatra.dse.base.ThreadContext; | |||
25 | import org.eclipse.viatra.dse.objectives.Fitness; | 25 | import org.eclipse.viatra.dse.objectives.Fitness; |
26 | import org.eclipse.viatra.dse.objectives.ObjectiveComparatorHelper; | 26 | import org.eclipse.viatra.dse.objectives.ObjectiveComparatorHelper; |
27 | import org.eclipse.viatra.dse.solutionstore.SolutionStore; | 27 | import org.eclipse.viatra.dse.solutionstore.SolutionStore; |
28 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
29 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
30 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
31 | import org.eclipse.viatra.query.runtime.api.ViatraQueryMatcher; | ||
28 | 32 | ||
29 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicReasoner; | 33 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicReasoner; |
30 | import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem; | 34 | import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem; |
31 | import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.InconsistencyResult; | 35 | import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.InconsistencyResult; |
32 | import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.LogicResult; | 36 | import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.LogicResult; |
33 | import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.ModelResult; | 37 | import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.ModelResult; |
38 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.ModelGenerationMethod; | ||
34 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.PartialInterpretation2Logic; | 39 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.PartialInterpretation2Logic; |
35 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation; | 40 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation; |
36 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretationVisualisation; | 41 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretationVisualisation; |
@@ -59,6 +64,7 @@ public class BestFirstStrategyForModelGeneration implements IStrategy { | |||
59 | private ThreadContext context; | 64 | private ThreadContext context; |
60 | private ReasonerWorkspace workspace; | 65 | private ReasonerWorkspace workspace; |
61 | private ViatraReasonerConfiguration configuration; | 66 | private ViatraReasonerConfiguration configuration; |
67 | private ModelGenerationMethod method; | ||
62 | private PartialInterpretation2Logic partialInterpretation2Logic = new PartialInterpretation2Logic(); | 68 | private PartialInterpretation2Logic partialInterpretation2Logic = new PartialInterpretation2Logic(); |
63 | private Comparator<TrajectoryWithFitness> comparator; | 69 | private Comparator<TrajectoryWithFitness> comparator; |
64 | private Logger logger = Logger.getLogger(IStrategy.class); | 70 | private Logger logger = Logger.getLogger(IStrategy.class); |
@@ -79,10 +85,12 @@ public class BestFirstStrategyForModelGeneration implements IStrategy { | |||
79 | 85 | ||
80 | public BestFirstStrategyForModelGeneration( | 86 | public BestFirstStrategyForModelGeneration( |
81 | ReasonerWorkspace workspace, | 87 | ReasonerWorkspace workspace, |
82 | ViatraReasonerConfiguration configuration) | 88 | ViatraReasonerConfiguration configuration, |
89 | ModelGenerationMethod method) | ||
83 | { | 90 | { |
84 | this.workspace = workspace; | 91 | this.workspace = workspace; |
85 | this.configuration = configuration; | 92 | this.configuration = configuration; |
93 | this.method = method; | ||
86 | } | 94 | } |
87 | 95 | ||
88 | public SolutionStoreWithCopy getSolutionStoreWithCopy() { | 96 | public SolutionStoreWithCopy getSolutionStoreWithCopy() { |
@@ -99,6 +107,14 @@ public class BestFirstStrategyForModelGeneration implements IStrategy { | |||
99 | public void initStrategy(ThreadContext context) { | 107 | public void initStrategy(ThreadContext context) { |
100 | this.context = context; | 108 | this.context = context; |
101 | this.solutionStore = context.getGlobalContext().getSolutionStore(); | 109 | this.solutionStore = context.getGlobalContext().getSolutionStore(); |
110 | |||
111 | ViatraQueryEngine engine = context.getQueryEngine(); | ||
112 | // TODO: visualisation | ||
113 | // for(IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>> p : this.method.getAllPatterns()) { | ||
114 | // ViatraQueryMatcher<? extends IPatternMatch> matcher = p.getMatcher(engine); | ||
115 | // matcher.getAllMatches(); | ||
116 | // } | ||
117 | |||
102 | this.solutionStoreWithCopy = new SolutionStoreWithCopy(); | 118 | this.solutionStoreWithCopy = new SolutionStoreWithCopy(); |
103 | this.solutionStoreWithDiversityDescriptor = new SolutionStoreWithDiversityDescriptor(configuration.diversityRequirement); | 119 | this.solutionStoreWithDiversityDescriptor = new SolutionStoreWithDiversityDescriptor(configuration.diversityRequirement); |
104 | 120 | ||
@@ -275,7 +291,7 @@ public class BestFirstStrategyForModelGeneration implements IStrategy { | |||
275 | int id = ++numberOfPrintedModel; | 291 | int id = ++numberOfPrintedModel; |
276 | if (id % configuration.debugCongiguration.partalInterpretationVisualisationFrequency == 0) { | 292 | if (id % configuration.debugCongiguration.partalInterpretationVisualisationFrequency == 0) { |
277 | PartialInterpretationVisualisation visualisation = partialInterpretatioVisualiser.visualiseConcretization(p); | 293 | PartialInterpretationVisualisation visualisation = partialInterpretatioVisualiser.visualiseConcretization(p); |
278 | visualisation.writeToFile(workspace, String.format("state%09d", id)); | 294 | visualisation.writeToFile(workspace, String.format("state%09d.png", id)); |
279 | } | 295 | } |
280 | } | 296 | } |
281 | } | 297 | } |