From e50e771261d96fa30ff61748ad8a3c129a064499 Mon Sep 17 00:00:00 2001 From: OszkarSemerath Date: Tue, 15 Aug 2017 02:34:18 +0200 Subject: Partial interpretation initialiser with primitive types --- .../PartialInterpretationInitialiser.xtend | 26 +++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf') diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/PartialInterpretationInitialiser.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/PartialInterpretationInitialiser.xtend index eeccbf76..598c8f9e 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/PartialInterpretationInitialiser.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/PartialInterpretationInitialiser.xtend @@ -23,6 +23,7 @@ import org.eclipse.viatra.query.runtime.emf.EMFScope import org.eclipse.xtend.lib.annotations.Data import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* +import hu.bme.mit.inf.dslreasoner.logic.model.builder.TypeScopes @Data class Problem2PartialInterpretationTrace { Map type2Interpretation = new HashMap @@ -37,17 +38,32 @@ class PartialInterpretationInitialiser { * Initialises an empty partial interpretation from a logic problem */ def TracedOutput initialisePartialInterpretation( - LogicProblem problem, - int minNewElement, int maxNewElement) + LogicProblem problem, TypeScopes typeScopes) { val engine = ViatraQueryEngine.on(new EMFScope(problem)) val trace = new Problem2PartialInterpretationTrace val res = createPartialInterpretation => [ it.problem = problem - it.openWorldElementPrototype = createDefinedElement => [it.name = "Symbolic New Element"] - it.minNewElements = minNewElement - it.maxNewElements = maxNewElement + + it.minNewElements = typeScopes.maxNewElements + it.maxNewElements = typeScopes.minNewElements + if(maxNewElements>0) { + it.openWorldElementPrototypes += createDefinedElement => [it.name = "Symbolic New Element"] + } + + it.maxNewIntegers = typeScopes.numberOfUseableIntegers + if(maxNewIntegers>0) { + it.openWorldElementPrototypes += createIntegerElement => [it.name = "Symbolic New Integer" it.valueSet = false] + } + it.maxNewReals = typeScopes.numberOfUseableReals + if(maxNewReals>0) { + it.openWorldElementPrototypes += createRealElement => [it.name = "Symbolic New Real" it.valueSet = false] + } + it.maxNewStrings = typeScopes.numberOfUseableStrings + if(maxNewStrings>0) { + it.openWorldElementPrototypes += createStringElement => [it.name = "Symbolic New String" it.valueSet = false] + } for(typeDeclaration : problem.types.filter(TypeDeclaration)) { it.partialtypeinterpratation += typeDeclaration.initialisePartialTypeInterpretation(engine,trace) -- cgit v1.2.3-54-g00ecf