diff options
author | Kristóf Marussy <kris7topher@gmail.com> | 2019-08-14 18:26:33 +0200 |
---|---|---|
committer | Kristóf Marussy <kris7topher@gmail.com> | 2019-08-14 18:26:33 +0200 |
commit | fc84d3fe670331bc89fb1e4c44104bc1fc811438 (patch) | |
tree | 466da8333151c51d2e17075600f9452ed35835da /Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SGraphHint.xtend | |
parent | Be more lenient with rounding IP solver results (diff) | |
download | VIATRA-Generator-fc84d3fe670331bc89fb1e4c44104bc1fc811438.tar.gz VIATRA-Generator-fc84d3fe670331bc89fb1e4c44104bc1fc811438.tar.zst VIATRA-Generator-fc84d3fe670331bc89fb1e4c44104bc1fc811438.zip |
Measurements WIP
Diffstat (limited to 'Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SGraphHint.xtend')
-rw-r--r-- | Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SGraphHint.xtend | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SGraphHint.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SGraphHint.xtend new file mode 100644 index 00000000..97ce4ee6 --- /dev/null +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SGraphHint.xtend | |||
@@ -0,0 +1,46 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.run | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic | ||
4 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic_Trace | ||
5 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.LinearTypeExpressionBuilderFactory | ||
6 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.patterns.PatternGenerator | ||
7 | |||
8 | class SGraphHint extends Ecore2LogicTraceBasedHint { | ||
9 | new(Ecore2Logic ecore2Logic, Ecore2Logic_Trace trace) { | ||
10 | super(ecore2Logic, trace) | ||
11 | } | ||
12 | |||
13 | override getAdditionalPatterns(extension PatternGenerator patternGenerator) { | ||
14 | "" | ||
15 | } | ||
16 | |||
17 | override createConstraintUpdater(LinearTypeExpressionBuilderFactory it) { | ||
18 | val newEntriesWithoutRegionCount = createBuilder.add(1, "Entry".type).add(-1, "Region".type).build | ||
19 | val newStatesWithoutRegionCount = createBuilder.add(1, "State".type).add(-1, "Region".type).build | ||
20 | val newTransitionWithoutNeedsOutgoingCount = createBuilder.add(1, "Transition".type).add(-1, "Entry".type). | ||
21 | add(-1, "Choice".type).build | ||
22 | val newTransitionWithoutNeedsIncomingCount = createBuilder.add(1, "Transition".type).add(-1, "Choice".type). | ||
23 | build | ||
24 | |||
25 | val regionsWithoutEntryMatcher = createMatcher( | ||
26 | "unfinishedBy_pattern_hu_bme_mit_inf_dslreasoner_partialsnapshot_mavo_yakindu_noEntryInRegion") | ||
27 | val regionsWithoutStateMatcher = createMatcher( | ||
28 | "unfinishedBy_pattern_hu_bme_mit_inf_dslreasoner_partialsnapshot_mavo_yakindu_noStateInRegion") | ||
29 | val entryHasNoOutgoingMatcher = createMatcher( | ||
30 | "unfinishedBy_pattern_hu_bme_mit_inf_dslreasoner_partialsnapshot_mavo_yakindu_noOutgoingTransitionFromEntry") | ||
31 | val choiceHasNoOutgoingMatcher = createMatcher( | ||
32 | "unfinishedBy_pattern_hu_bme_mit_inf_dslreasoner_partialsnapshot_mavo_yakindu_choiceHasNoOutgoing") | ||
33 | val choiceHasNoIncomingMatcher = createMatcher( | ||
34 | "unfinishedBy_pattern_hu_bme_mit_inf_dslreasoner_partialsnapshot_mavo_yakindu_choiceHasNoIncoming") | ||
35 | val transitionWithoutTargetMatcher = createMatcher("unfinishedLowerMultiplicity_target_reference_Transition") | ||
36 | |||
37 | return [ p | | ||
38 | newEntriesWithoutRegionCount.assertEqualsTo(regionsWithoutEntryMatcher.countMatches(p)) | ||
39 | newStatesWithoutRegionCount.tightenLowerBound(regionsWithoutStateMatcher.countMatches(p)) | ||
40 | newTransitionWithoutNeedsOutgoingCount.tightenLowerBound( | ||
41 | entryHasNoOutgoingMatcher.countMatches(p) + choiceHasNoOutgoingMatcher.countMatches(p)) | ||
42 | newTransitionWithoutNeedsIncomingCount.tightenLowerBound( | ||
43 | choiceHasNoIncomingMatcher.countMatches(p) - transitionWithoutTargetMatcher.getCount(p)) | ||
44 | ] | ||
45 | } | ||
46 | } | ||