diff options
author | 2020-11-26 13:56:17 +0100 | |
---|---|---|
committer | 2020-11-26 13:56:17 +0100 | |
commit | 8a219bb3ee05e16a8da20247947addb86bf9cb96 (patch) | |
tree | 67163ee3fe180ab41d0926614737d4db840add8d | |
parent | Fix Z3 dependency (diff) | |
parent | NumericProblemSolver is initialized only if it is necessary (diff) | |
download | VIATRA-Generator-8a219bb3ee05e16a8da20247947addb86bf9cb96.tar.gz VIATRA-Generator-8a219bb3ee05e16a8da20247947addb86bf9cb96.tar.zst VIATRA-Generator-8a219bb3ee05e16a8da20247947addb86bf9cb96.zip |
Merge branch 'master' of github.com:viatra/VIATRA-Generator
2 files changed, 11 insertions, 6 deletions
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/SolverLoader.xtend b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/SolverLoader.xtend index a549df00..fd50ad51 100644 --- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/SolverLoader.xtend +++ b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/SolverLoader.xtend | |||
@@ -28,6 +28,7 @@ import java.util.Optional | |||
28 | import org.eclipse.viatra.query.patternlanguage.emf.vql.PatternModel | 28 | import org.eclipse.viatra.query.patternlanguage.emf.vql.PatternModel |
29 | import org.eclipse.xtext.EcoreUtil2 | 29 | import org.eclipse.xtext.EcoreUtil2 |
30 | import org.eclipse.xtext.xbase.lib.Functions.Function1 | 30 | import org.eclipse.xtext.xbase.lib.Functions.Function1 |
31 | import hu.bme.mit.inf.dlsreasoner.alloy.reasoner.AlloyBackendSolver | ||
31 | 32 | ||
32 | class SolverLoader { | 33 | class SolverLoader { |
33 | def loadSolver(Solver solver, Map<String, String> config) { | 34 | def loadSolver(Solver solver, Map<String, String> config) { |
@@ -73,9 +74,9 @@ class SolverLoader { | |||
73 | if (!objectiveEntries.empty) { | 74 | if (!objectiveEntries.empty) { |
74 | throw new IllegalArgumentException("Objectives are not supported by Alloy.") | 75 | throw new IllegalArgumentException("Objectives are not supported by Alloy.") |
75 | } | 76 | } |
76 | val c = new SmtSolverConfiguration | 77 | val c = new AlloySolverConfiguration |
77 | config.getAsBoolean("fixRandomSeed", console).ifPresent[c.fixRandomSeed = it] | 78 | config.getAsInteger("symmetry", console).ifPresent[c.symmetry = it] |
78 | config.getAsType("path", console, [it], String).ifPresent[c.solverPath = it] | 79 | config.getAsType("solver",console,[x|AlloyBackendSolver::valueOf(x)],AlloyBackendSolver).ifPresent[c.solver = it] |
79 | c | 80 | c |
80 | } | 81 | } |
81 | case SMT_SOLVER: { | 82 | case SMT_SOLVER: { |
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/ExpressionEvaluation2Logic.xtend b/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/ExpressionEvaluation2Logic.xtend index b4303739..6393121b 100644 --- a/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/ExpressionEvaluation2Logic.xtend +++ b/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/ExpressionEvaluation2Logic.xtend | |||
@@ -12,11 +12,15 @@ import org.eclipse.xtext.xbase.XMemberFeatureCall | |||
12 | import org.eclipse.xtext.xbase.XNumberLiteral | 12 | import org.eclipse.xtext.xbase.XNumberLiteral |
13 | import org.eclipse.xtext.xbase.XUnaryOperation | 13 | import org.eclipse.xtext.xbase.XUnaryOperation |
14 | 14 | ||
15 | import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* | ||
16 | |||
17 | class ExpressionEvaluation2Logic { | 15 | class ExpressionEvaluation2Logic { |
18 | val extension LogicProblemBuilder builder = new LogicProblemBuilder | 16 | val extension LogicProblemBuilder builder = new LogicProblemBuilder |
19 | val NumericProblemSolver numericSolver = new NumericProblemSolver | 17 | var NumericProblemSolver _numericSolver = null //new NumericProblemSolver |
18 | def getNumericSolver() { | ||
19 | if(_numericSolver === null) { | ||
20 | _numericSolver = new NumericProblemSolver | ||
21 | } | ||
22 | return _numericSolver | ||
23 | } | ||
20 | 24 | ||
21 | def Term transformCheck(XExpression expression, Map<PVariable, Variable> variable2Variable) { | 25 | def Term transformCheck(XExpression expression, Map<PVariable, Variable> variable2Variable) { |
22 | return expression.transform(variable2Variable) | 26 | return expression.transform(variable2Variable) |