diff options
Diffstat (limited to 'Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/NumericProblemSolver.java')
-rw-r--r-- | Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/NumericProblemSolver.java | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/NumericProblemSolver.java b/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/NumericProblemSolver.java index 5e823d9d..8f57e40c 100644 --- a/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/NumericProblemSolver.java +++ b/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/NumericProblemSolver.java | |||
@@ -35,6 +35,24 @@ public abstract class NumericProblemSolver { | |||
35 | public long getEndSolvingProblem() {return endSolvingProblem;} | 35 | public long getEndSolvingProblem() {return endSolvingProblem;} |
36 | public long getEndFormingSolution() {return endFormingSolution;} | 36 | public long getEndFormingSolution() {return endFormingSolution;} |
37 | 37 | ||
38 | public abstract boolean isSatisfiable(Map<XExpression, Iterable<Map<JvmIdentifiableElement,PrimitiveElement>>> matches) throws Exception; | 38 | public boolean isSatisfiable(Map<XExpression, Iterable<Map<JvmIdentifiableElement,PrimitiveElement>>> matches) throws Exception { |
39 | public abstract Map<PrimitiveElement,Number> getOneSolution(List<PrimitiveElement> objs, Map<XExpression, Iterable<Map<JvmIdentifiableElement,PrimitiveElement>>> matches) throws Exception; | 39 | if(!initialized) { |
40 | this.initialize(); | ||
41 | this.initialized=true; | ||
42 | } | ||
43 | return this.internalIsSatisfiable(matches); | ||
44 | } | ||
45 | public Map<PrimitiveElement,Number> getOneSolution(List<PrimitiveElement> objs, Map<XExpression, Iterable<Map<JvmIdentifiableElement,PrimitiveElement>>> matches) throws Exception{ | ||
46 | if(!initialized) { | ||
47 | this.initialize(); | ||
48 | this.initialized=true; | ||
49 | } | ||
50 | return this.internalGetOneSolution(objs, matches); | ||
51 | } | ||
52 | |||
53 | boolean initialized = false; | ||
54 | protected abstract void initialize(); | ||
55 | |||
56 | protected abstract boolean internalIsSatisfiable(Map<XExpression, Iterable<Map<JvmIdentifiableElement,PrimitiveElement>>> matches) throws Exception; | ||
57 | protected abstract Map<PrimitiveElement,Number> internalGetOneSolution(List<PrimitiveElement> objs, Map<XExpression, Iterable<Map<JvmIdentifiableElement,PrimitiveElement>>> matches) throws Exception; | ||
40 | } | 58 | } |