diff options
Diffstat (limited to 'Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src')
2 files changed, 25 insertions, 33 deletions
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PatternGenerator.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PatternGenerator.xtend index d4c76bb4..04163962 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PatternGenerator.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PatternGenerator.xtend | |||
@@ -170,6 +170,7 @@ class PatternGenerator { | |||
170 | ///////////////////////// | 170 | ///////////////////////// |
171 | // 0.1 Existence | 171 | // 0.1 Existence |
172 | ///////////////////////// | 172 | ///////////////////////// |
173 | /** [[exist(element)]]=1 */ | ||
173 | private pattern mustExist(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement) { | 174 | private pattern mustExist(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement) { |
174 | find interpretation(problem,interpretation); | 175 | find interpretation(problem,interpretation); |
175 | LogicProblem.elements(problem,element); | 176 | LogicProblem.elements(problem,element); |
@@ -178,6 +179,7 @@ class PatternGenerator { | |||
178 | PartialInterpretation.newElements(interpretation,element); | 179 | PartialInterpretation.newElements(interpretation,element); |
179 | } | 180 | } |
180 | 181 | ||
182 | /** [[exist(element)]]>=1/2 */ | ||
181 | private pattern mayExist(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement) { | 183 | private pattern mayExist(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement) { |
182 | find mustExist(problem,interpretation,element); | 184 | find mustExist(problem,interpretation,element); |
183 | } or { | 185 | } or { |
@@ -209,46 +211,34 @@ class PatternGenerator { | |||
209 | a == b; | 211 | a == b; |
210 | } | 212 | } |
211 | 213 | ||
212 | //////////////////////// | ||
213 | // 0.3 Required Patterns by TypeIndexer | ||
214 | //////////////////////// | ||
215 | «typeIndexer.requiredQueries» | ||
216 | 214 | ||
217 | ////////// | 215 | ////////// |
218 | // 1. Problem-Specific Base Indexers | 216 | // 1. Problem-Specific Base Indexers |
219 | ////////// | 217 | ////////// |
220 | // 1.1 Type Indexers | 218 | // 1.1 Type Indexers |
221 | ////////// | 219 | ////////// |
222 | // 1.1.1 primitive Type Indexers | 220 | // 1.1.1 Required Patterns by TypeIndexer |
223 | ////////// | 221 | ////////// |
224 | ««« pattern instanceofBoolean(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement) { | 222 | «typeIndexer.requiredQueries» |
225 | ««« find interpretation(problem,interpretation); | 223 | ////////// |
226 | ««« PartialInterpretation.booleanelements(interpretation,element); | 224 | // 1.1.2 primitive Type Indexers |
227 | ««« } | 225 | ////////// |
228 | ««« pattern instanceofInteger(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement) { | 226 | // Currently unused. Refer primitive types as: |
229 | ««« find interpretation(problem,interpretation); | 227 | // > PrimitiveElement(element) |
230 | ««« PartialInterpretation.integerelements(interpretation,element); | 228 | // specific types are referred as: |
231 | ««« } or { | 229 | // > BooleanElement(variableName) |
232 | ««« find interpretation(problem,interpretation); | 230 | // > IntegerElement(variableName) |
233 | ««« PartialInterpretation.newIntegers(interpetation,element); | 231 | // > RealElement(variableName) |
234 | ««« } | 232 | // > StringElement(variableName) |
235 | ««« pattern instanceofReal(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement) { | 233 | // And their value as |
236 | ««« find interpretation(problem,interpretation); | 234 | // > BooleanElement.value(variableName,value) |
237 | ««« PartialInterpretation.realelements(interpretation,element); | 235 | // > IntegerElement.value(variableName,value) |
238 | ««« } or { | 236 | // > RealElement.value(variableName,value) |
239 | ««« find interpretation(problem,interpretation); | 237 | // > StringElement.value(variableName,value) |
240 | ««« PartialInterpretation.newReals(interpetation,element); | 238 | // Whether a value is set is defined by: |
241 | ««« } | 239 | // > PrimitiveElement.valueSet(variableName,isFilled); |
242 | ««« pattern instanceofString(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement) { | ||
243 | ««« find interpretation(problem,interpretation); | ||
244 | ««« PartialInterpretation.stringelements(interpretation,element); | ||
245 | ««« } or { | ||
246 | ««« find interpretation(problem,interpretation); | ||
247 | ««« PartialInterpretation.newStrings(interpetation,element); | ||
248 | ««« } | ||
249 | |||
250 | ////////// | 240 | ////////// |
251 | // 1.1.2 domain-specific Type Indexers | 241 | // 1.1.3 domain-specific Type Indexers |
252 | ////////// | 242 | ////////// |
253 | «typeIndexer.generateInstanceOfQueries(problem,emptySolution,typeAnalysisResult)» | 243 | «typeIndexer.generateInstanceOfQueries(problem,emptySolution,typeAnalysisResult)» |
254 | 244 | ||
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/TypeIndexer.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/TypeIndexer.xtend index d1d57189..41eb75a8 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/TypeIndexer.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/TypeIndexer.xtend | |||
@@ -48,5 +48,7 @@ abstract class TypeIndexer { | |||
48 | public def dispatch CharSequence referPrimitiveValue(String variableName, String value) { | 48 | public def dispatch CharSequence referPrimitiveValue(String variableName, String value) { |
49 | '''StringElement.value(«variableName»,"«value»");''' | 49 | '''StringElement.value(«variableName»,"«value»");''' |
50 | } | 50 | } |
51 | 51 | public def CharSequence referPrimitiveFilled(String variableName, boolean isFilled) { | |
52 | '''PrimitiveElement.valueSet(«variableName»,«isFilled»);''' | ||
53 | } | ||
52 | } \ No newline at end of file | 54 | } \ No newline at end of file |