aboutsummaryrefslogtreecommitdiffstats
path: root/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/GeneralTest.xtend
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/GeneralTest.xtend')
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/GeneralTest.xtend76
1 files changed, 52 insertions, 24 deletions
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/GeneralTest.xtend b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/GeneralTest.xtend
index 40e305aa..b67a867a 100644
--- a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/GeneralTest.xtend
+++ b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/GeneralTest.xtend
@@ -31,6 +31,7 @@ import org.eclipse.emf.ecore.resource.Resource
31import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl 31import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl
32import org.eclipse.viatra.query.runtime.api.IQueryGroup 32import org.eclipse.viatra.query.runtime.api.IQueryGroup
33import org.eclipse.emf.ecore.EClassifier 33import org.eclipse.emf.ecore.EClassifier
34import functionalarchitecture.FunctionalOutput
34 35
35class GeneralTest { 36class GeneralTest {
36 def static String createAndSolveProblem(EcoreMetamodelDescriptor metamodel, List<EObject> partialModel, 37 def static String createAndSolveProblem(EcoreMetamodelDescriptor metamodel, List<EObject> partialModel,
@@ -45,43 +46,70 @@ class GeneralTest {
45 var problem = modelGenerationProblem.output 46 var problem = modelGenerationProblem.output
46// problem = instanceModel2Logic.transform(modelGenerationProblem, partialModel).output 47// problem = instanceModel2Logic.transform(modelGenerationProblem, partialModel).output
47// problem = viatra2Logic.transformQueries(queries, modelGenerationProblem, new Viatra2LogicConfiguration).output 48// problem = viatra2Logic.transformQueries(queries, modelGenerationProblem, new Viatra2LogicConfiguration).output
48
49 workspace.writeModel(problem, "Fam.logicproblem") 49 workspace.writeModel(problem, "Fam.logicproblem")
50 50
51 println("Problem created") 51 println("Problem created")
52 52
53 var LogicResult solution 53 var LogicResult solution
54 var LogicReasoner reasoner 54 var LogicReasoner reasoner
55 55
56 //* 56 // *
57 reasoner = new VampireSolver 57 reasoner = new VampireSolver
58// val typeMap = new HashMap<Type, Integer> 58
59// val n = Function.simpleName 59 // Setting up scope
60// val classif = factory.vampireLanguagePackage.getEClassifier(n) as EClass 60 val typeMapMin = new HashMap<Type, Integer>
61// val x = ecore2Logic.TypeofEClass(modelGenerationProblem.trace, classif) 61 val typeMapMax = new HashMap<Type, Integer>
62// typeMap.put(x, 3) 62 val list2MapMin = metamodel.classes.toMap[s|s.name]
63 val list2MapMax = metamodel.classes.toMap[s|s.name]
64
65 // Minimum Scope
66 typeMapMin.put(ecore2Logic.TypeofEClass(modelGenerationProblem.trace,
67 list2MapMin.get(Function.simpleName)
68 ), 3)
69 typeMapMin.put(ecore2Logic.TypeofEClass(modelGenerationProblem.trace,
70 list2MapMin.get(functionalarchitecture.FunctionalInterface.simpleName)
71 ), 2)
72 typeMapMin.put(ecore2Logic.TypeofEClass(modelGenerationProblem.trace,
73 list2MapMin.get(FunctionalOutput.simpleName)
74 ), 1)
75
76 // Maximum Scope
77 typeMapMax.put(ecore2Logic.TypeofEClass(
78 modelGenerationProblem.trace,
79 list2MapMax.get(Function.simpleName)
80 ), 5)
81 typeMapMax.put(ecore2Logic.TypeofEClass(
82 modelGenerationProblem.trace,
83 list2MapMax.get(functionalarchitecture.FunctionalInterface.simpleName)
84 ), 2)
85 typeMapMax.put(ecore2Logic.TypeofEClass(
86 modelGenerationProblem.trace,
87 list2MapMax.get(FunctionalOutput.simpleName)
88 ), 4)
89
90 // Configuration
63 val vampireConfig = new VampireSolverConfiguration => [ 91 val vampireConfig = new VampireSolverConfiguration => [
64 // add configuration things, in config file first 92 // add configuration things, in config file first
65 it.documentationLevel = DocumentationLevel::FULL 93 it.documentationLevel = DocumentationLevel::FULL
66 it.typeScopes.minNewElements = 3 94 it.typeScopes.minNewElements = 6
67 it.typeScopes.maxNewElements = 6 95 it.typeScopes.maxNewElements = 8
68// it.typeScopes.minNewElementsByType = typeMap 96 it.typeScopes.minNewElementsByType = typeMapMin
97 it.typeScopes.maxNewElementsByType = typeMapMax
69 ] 98 ]
70 solution = reasoner.solve(problem, vampireConfig, workspace) 99 solution = reasoner.solve(problem, vampireConfig, workspace)
71
72 /*/
73
74 reasoner = new AlloySolver
75 val alloyConfig = new AlloySolverConfiguration => [
76 it.typeScopes.maxNewElements = 7
77 it.typeScopes.minNewElements = 3
78 it.solutionScope.numberOfRequiredSolution = 1
79 it.typeScopes.maxNewIntegers = 0
80 it.documentationLevel = DocumentationLevel::NORMAL
81 ]
82 solution = reasoner.solve(problem, alloyConfig, workspace)
83 //*/
84 100
101 /*/
102 *
103 * reasoner = new AlloySolver
104 * val alloyConfig = new AlloySolverConfiguration => [
105 * it.typeScopes.maxNewElements = 7
106 * it.typeScopes.minNewElements = 3
107 * it.solutionScope.numberOfRequiredSolution = 1
108 * it.typeScopes.maxNewIntegers = 0
109 * it.documentationLevel = DocumentationLevel::NORMAL
110 * ]
111 * solution = reasoner.solve(problem, alloyConfig, workspace)
112 //*/
85 println("Problem solved") 113 println("Problem solved")
86 } 114 }
87 115