diff options
Diffstat (limited to 'Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/SolutionStoreWithCopy.xtend')
-rw-r--r-- | Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/SolutionStoreWithCopy.xtend | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/SolutionStoreWithCopy.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/SolutionStoreWithCopy.xtend new file mode 100644 index 00000000..4bd2c349 --- /dev/null +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/SolutionStoreWithCopy.xtend | |||
@@ -0,0 +1,51 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.dse | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation | ||
4 | import java.util.LinkedList | ||
5 | import java.util.List | ||
6 | import java.util.Map | ||
7 | import org.eclipse.emf.ecore.EObject | ||
8 | import org.eclipse.emf.ecore.util.EcoreUtil | ||
9 | import org.eclipse.viatra.dse.base.ThreadContext | ||
10 | |||
11 | class SolutionStoreWithCopy { | ||
12 | |||
13 | long runtime = 0 | ||
14 | List<PartialInterpretation> solutions = new LinkedList | ||
15 | //public List<SortedMap<String,Integer>> additionalMatches = new LinkedList | ||
16 | List<Map<EObject,EObject>> copyTraces = new LinkedList | ||
17 | |||
18 | long sartTime = System.nanoTime | ||
19 | List<Long> solutionTimes = new LinkedList | ||
20 | |||
21 | /*def newSolution(ThreadContext context, SortedMap<String,Integer> additonalMatch) { | ||
22 | additionalMatches+= additonalMatch | ||
23 | newSolution(context) | ||
24 | }*/ | ||
25 | |||
26 | def Map<EObject,EObject> newSolution(ThreadContext context) { | ||
27 | //print(System.nanoTime-initTime + ";") | ||
28 | val copyStart = System.nanoTime | ||
29 | val solution = context.model as PartialInterpretation | ||
30 | val copier = new EcoreUtil.Copier | ||
31 | val solutionCopy = copier.copy(solution) as PartialInterpretation | ||
32 | copier.copyReferences | ||
33 | solutions.add(solutionCopy) | ||
34 | copyTraces.add(copier) | ||
35 | runtime += System.nanoTime - copyStart | ||
36 | solutionTimes.add(System.nanoTime-sartTime) | ||
37 | return copier | ||
38 | } | ||
39 | def getSumRuntime() { | ||
40 | return runtime | ||
41 | } | ||
42 | def getAllRuntimes() { | ||
43 | return solutionTimes | ||
44 | } | ||
45 | def getSolutions() { | ||
46 | solutions | ||
47 | } | ||
48 | def getCopyTraces() { | ||
49 | return copyTraces | ||
50 | } | ||
51 | } \ No newline at end of file | ||