diff options
author | 2020-04-14 22:45:52 +0200 | |
---|---|---|
committer | 2020-04-14 22:45:52 +0200 | |
commit | ed434397058fd520ad92a938eccd8f93ef378d8a (patch) | |
tree | 210f3460809e2b050e315e933b5678e24d67c3c3 /Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PatternGenerator.xtend | |
parent | Primitive object indexing update (diff) | |
download | VIATRA-Generator-ed434397058fd520ad92a938eccd8f93ef378d8a.tar.gz VIATRA-Generator-ed434397058fd520ad92a938eccd8f93ef378d8a.tar.zst VIATRA-Generator-ed434397058fd520ad92a938eccd8f93ef378d8a.zip |
restructured pattern generation
Diffstat (limited to 'Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PatternGenerator.xtend')
-rw-r--r-- | Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PatternGenerator.xtend | 102 |
1 files changed, 100 insertions, 2 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 04163962..379e334a 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 | |||
@@ -200,18 +200,116 @@ class PatternGenerator { | |||
200 | //////////////////////// | 200 | //////////////////////// |
201 | // 0.2 Equivalence | 201 | // 0.2 Equivalence |
202 | //////////////////////// | 202 | //////////////////////// |
203 | pattern mayEquivalent(problem:LogicProblem, interpretation:PartialInterpretation, a: DefinedElement, b: DefinedElement) { | 203 | pattern mayEquivalent(problem:LogicProblem, interpretation:PartialInterpretation, a: DefinedElement, b: DefinedElement) |
204 | // For non-primitive type. Boolean types always must equivalent or cannot equivalent | ||
205 | { | ||
204 | find mayExist(problem,interpretation,a); | 206 | find mayExist(problem,interpretation,a); |
205 | find mayExist(problem,interpretation,b); | 207 | find mayExist(problem,interpretation,b); |
206 | a == b; | 208 | a == b; |
209 | } or { | ||
210 | find mayExist(problem,interpretation,a); | ||
211 | find mayExist(problem,interpretation,b); | ||
212 | IntegerElement(a); | ||
213 | IntegerElement(b); | ||
214 | PrimitiveElement.valueSet(a,false); | ||
215 | } or { | ||
216 | find mayExist(problem,interpretation,a); | ||
217 | find mayExist(problem,interpretation,b); | ||
218 | IntegerElement(a); | ||
219 | IntegerElement(b); | ||
220 | PrimitiveElement.valueSet(b,false); | ||
221 | } or { | ||
222 | find mayExist(problem,interpretation,a); | ||
223 | find mayExist(problem,interpretation,b); | ||
224 | RealElement(a); | ||
225 | RealElement(b); | ||
226 | PrimitiveElement.valueSet(a,false); | ||
227 | } or { | ||
228 | find mayExist(problem,interpretation,a); | ||
229 | find mayExist(problem,interpretation,b); | ||
230 | RealElement(a); | ||
231 | RealElement(b); | ||
232 | PrimitiveElement.valueSet(b,false); | ||
233 | } or { | ||
234 | find mayExist(problem,interpretation,a); | ||
235 | find mayExist(problem,interpretation,b); | ||
236 | RealElement(a); | ||
237 | IntegerElement(b); | ||
238 | PrimitiveElement.valueSet(a,false); | ||
239 | } or { | ||
240 | find mayExist(problem,interpretation,a); | ||
241 | find mayExist(problem,interpretation,b); | ||
242 | RealElement(a); | ||
243 | IntegerElement(b); | ||
244 | PrimitiveElement.valueSet(b,false); | ||
245 | } or { | ||
246 | find mayExist(problem,interpretation,a); | ||
247 | find mayExist(problem,interpretation,b); | ||
248 | IntegerElement(a); | ||
249 | RealElement(b); | ||
250 | PrimitiveElement.valueSet(a,false); | ||
251 | } or { | ||
252 | find mayExist(problem,interpretation,a); | ||
253 | find mayExist(problem,interpretation,b); | ||
254 | IntegerElement(a); | ||
255 | RealElement(b); | ||
256 | PrimitiveElement.valueSet(b,false); | ||
257 | } or { | ||
258 | find mayExist(problem,interpretation,a); | ||
259 | find mayExist(problem,interpretation,b); | ||
260 | StringElement(a); | ||
261 | StringElement(b); | ||
262 | PrimitiveElement.valueSet(a,false); | ||
263 | } or { | ||
264 | find mayExist(problem,interpretation,a); | ||
265 | find mayExist(problem,interpretation,b); | ||
266 | StringElement(a); | ||
267 | StringElement(b); | ||
268 | PrimitiveElement.valueSet(b,false); | ||
207 | } | 269 | } |
270 | |||
208 | pattern mustEquivalent(problem:LogicProblem, interpretation:PartialInterpretation, a: DefinedElement, b: DefinedElement) { | 271 | pattern mustEquivalent(problem:LogicProblem, interpretation:PartialInterpretation, a: DefinedElement, b: DefinedElement) { |
272 | // For non-primitive and Boolean primitive type | ||
209 | find mustExist(problem,interpretation,a); | 273 | find mustExist(problem,interpretation,a); |
210 | find mustExist(problem,interpretation,b); | 274 | find mustExist(problem,interpretation,b); |
211 | a == b; | 275 | a == b; |
276 | } or { | ||
277 | find mustExist(problem,interpretation,a); | ||
278 | find mustExist(problem,interpretation,b); | ||
279 | PrimitiveElement.valueSet(a,true); | ||
280 | PrimitiveElement.valueSet(b,true); | ||
281 | IntegerElement.value(a,value); | ||
282 | IntegerElement.value(b,value); | ||
283 | } or { | ||
284 | find mustExist(problem,interpretation,a); | ||
285 | find mustExist(problem,interpretation,b); | ||
286 | PrimitiveElement.valueSet(a,true); | ||
287 | PrimitiveElement.valueSet(b,true); | ||
288 | RealElement.value(a,value); | ||
289 | RealElement.value(b,value); | ||
290 | } or { | ||
291 | find mustExist(problem,interpretation,a); | ||
292 | find mustExist(problem,interpretation,b); | ||
293 | PrimitiveElement.valueSet(a,true); | ||
294 | PrimitiveElement.valueSet(b,true); | ||
295 | RealElement.value(a,value); | ||
296 | IntegerElement.value(b,value); | ||
297 | } or { | ||
298 | find mustExist(problem,interpretation,a); | ||
299 | find mustExist(problem,interpretation,b); | ||
300 | PrimitiveElement.valueSet(a,true); | ||
301 | PrimitiveElement.valueSet(b,true); | ||
302 | IntegerElement.value(a,value); | ||
303 | RealElement.value(b,value); | ||
304 | } or { | ||
305 | find mustExist(problem,interpretation,a); | ||
306 | find mustExist(problem,interpretation,b); | ||
307 | PrimitiveElement.valueSet(a,true); | ||
308 | PrimitiveElement.valueSet(b,true); | ||
309 | StringElement.value(a,value); | ||
310 | StringElement.value(b,value); | ||
212 | } | 311 | } |
213 | 312 | ||
214 | |||
215 | ////////// | 313 | ////////// |
216 | // 1. Problem-Specific Base Indexers | 314 | // 1. Problem-Specific Base Indexers |
217 | ////////// | 315 | ////////// |