aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <marussy@mit.bme.hu>2020-11-26 13:56:17 +0100
committerLibravatar Kristóf Marussy <marussy@mit.bme.hu>2020-11-26 13:56:17 +0100
commit8a219bb3ee05e16a8da20247947addb86bf9cb96 (patch)
tree67163ee3fe180ab41d0926614737d4db840add8d
parentFix Z3 dependency (diff)
parentNumericProblemSolver is initialized only if it is necessary (diff)
downloadVIATRA-Generator-8a219bb3ee05e16a8da20247947addb86bf9cb96.tar.gz
VIATRA-Generator-8a219bb3ee05e16a8da20247947addb86bf9cb96.tar.zst
VIATRA-Generator-8a219bb3ee05e16a8da20247947addb86bf9cb96.zip
Merge branch 'master' of github.com:viatra/VIATRA-Generator
-rw-r--r--Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/SolverLoader.xtend7
-rw-r--r--Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/ExpressionEvaluation2Logic.xtend10
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
28import org.eclipse.viatra.query.patternlanguage.emf.vql.PatternModel 28import org.eclipse.viatra.query.patternlanguage.emf.vql.PatternModel
29import org.eclipse.xtext.EcoreUtil2 29import org.eclipse.xtext.EcoreUtil2
30import org.eclipse.xtext.xbase.lib.Functions.Function1 30import org.eclipse.xtext.xbase.lib.Functions.Function1
31import hu.bme.mit.inf.dlsreasoner.alloy.reasoner.AlloyBackendSolver
31 32
32class SolverLoader { 33class 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
12import org.eclipse.xtext.xbase.XNumberLiteral 12import org.eclipse.xtext.xbase.XNumberLiteral
13import org.eclipse.xtext.xbase.XUnaryOperation 13import org.eclipse.xtext.xbase.XUnaryOperation
14 14
15import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.*
16
17class ExpressionEvaluation2Logic { 15class 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)