diff options
author | Kristóf Marussy <marussy@mit.bme.hu> | 2020-05-07 17:26:07 +0200 |
---|---|---|
committer | Kristóf Marussy <marussy@mit.bme.hu> | 2020-05-07 17:26:07 +0200 |
commit | 6a3ff9bb588bf47242a56b91e35479dbba38eb19 (patch) | |
tree | 0432ecd0edafb99dc9f017d0a8cfee31a931583a | |
parent | Fix concurrency bug in AlloyHandler (diff) | |
download | VIATRA-Generator-6a3ff9bb588bf47242a56b91e35479dbba38eb19.tar.gz VIATRA-Generator-6a3ff9bb588bf47242a56b91e35479dbba38eb19.tar.zst VIATRA-Generator-6a3ff9bb588bf47242a56b91e35479dbba38eb19.zip |
Scope unsat benchmarks
27 files changed, 1488 insertions, 113 deletions
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeModule.xtendbin b/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeModule.xtendbin index 83195553..c8086733 100644 --- a/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeModule.xtendbin +++ b/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeModule.xtendbin | |||
Binary files differ | |||
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeSetup.xtendbin b/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeSetup.xtendbin index f5085470..1a907776 100644 --- a/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeSetup.xtendbin +++ b/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeSetup.xtendbin | |||
Binary files differ | |||
diff --git a/Domains/Examples/ModelGenExampleFAM_plugin/.project b/Domains/Examples/ModelGenExampleFAM_plugin/.project index 6e1b3a06..570f8a60 100644 --- a/Domains/Examples/ModelGenExampleFAM_plugin/.project +++ b/Domains/Examples/ModelGenExampleFAM_plugin/.project | |||
@@ -6,6 +6,11 @@ | |||
6 | </projects> | 6 | </projects> |
7 | <buildSpec> | 7 | <buildSpec> |
8 | <buildCommand> | 8 | <buildCommand> |
9 | <name>org.eclipse.xtext.ui.shared.xtextBuilder</name> | ||
10 | <arguments> | ||
11 | </arguments> | ||
12 | </buildCommand> | ||
13 | <buildCommand> | ||
9 | <name>org.eclipse.viatra.query.tooling.ui.projectbuilder</name> | 14 | <name>org.eclipse.viatra.query.tooling.ui.projectbuilder</name> |
10 | <arguments> | 15 | <arguments> |
11 | </arguments> | 16 | </arguments> |
@@ -30,5 +35,6 @@ | |||
30 | <nature>org.eclipse.jdt.core.javanature</nature> | 35 | <nature>org.eclipse.jdt.core.javanature</nature> |
31 | <nature>org.eclipse.viatra.query.projectnature</nature> | 36 | <nature>org.eclipse.viatra.query.projectnature</nature> |
32 | <nature>org.eclipse.pde.PluginNature</nature> | 37 | <nature>org.eclipse.pde.PluginNature</nature> |
38 | <nature>org.eclipse.xtext.ui.shared.xtextNature</nature> | ||
33 | </natures> | 39 | </natures> |
34 | </projectDescription> | 40 | </projectDescription> |
diff --git a/Domains/Examples/ModelGenExampleFAM_plugin/plugin.xml b/Domains/Examples/ModelGenExampleFAM_plugin/plugin.xml index c117a28e..8d99d401 100644 --- a/Domains/Examples/ModelGenExampleFAM_plugin/plugin.xml +++ b/Domains/Examples/ModelGenExampleFAM_plugin/plugin.xml | |||
@@ -5,23 +5,13 @@ | |||
5 | <extension id="extension.derived.hu.bme.mit.inf.dslreasoner.domains.transima.fam.type" point="org.eclipse.viatra.query.runtime.base.wellbehaving.derived.features"> | 5 | <extension id="extension.derived.hu.bme.mit.inf.dslreasoner.domains.transima.fam.type" point="org.eclipse.viatra.query.runtime.base.wellbehaving.derived.features"> |
6 | <wellbehaving-derived-feature classifier-name="Function" feature-name="type" package-nsUri="http://www.inf.mit.bme.hu/viatrasolver/example/fam"/> | 6 | <wellbehaving-derived-feature classifier-name="Function" feature-name="type" package-nsUri="http://www.inf.mit.bme.hu/viatrasolver/example/fam"/> |
7 | </extension> | 7 | </extension> |
8 | <extension point="org.eclipse.emf.ecore.generated_package"> | 8 | <extension point="org.eclipse.emf.ecore.generated_package"> |
9 | <!-- @generated FamMetamodel --> | 9 | <!-- @generated FamMetamodel --> |
10 | <package | 10 | <package class="functionalarchitecture.FunctionalarchitecturePackage" genModel="model/FamMetamodel.genmodel" uri="http://www.inf.mit.bme.hu/viatrasolver/example/fam"/> |
11 | uri="http://www.inf.mit.bme.hu/viatrasolver/example/fam" | 11 | </extension> |
12 | class="functionalarchitecture.FunctionalarchitecturePackage" | ||
13 | genModel="model/FamMetamodel.genmodel"/> | ||
14 | </extension> | ||
15 | <extension id="hu.bme.mit.inf.dslreasoner.domains.transima.fam.FamPatterns" point="org.eclipse.viatra.query.runtime.queryspecification"> | 12 | <extension id="hu.bme.mit.inf.dslreasoner.domains.transima.fam.FamPatterns" point="org.eclipse.viatra.query.runtime.queryspecification"> |
16 | <group group="org.eclipse.viatra.query.runtime.extensibility.SingletonExtensionFactory:hu.bme.mit.inf.dslreasoner.domains.transima.fam.FamPatterns" id="hu.bme.mit.inf.dslreasoner.domains.transima.fam.FamPatterns"> | 13 | <group group="org.eclipse.viatra.query.runtime.extensibility.SingletonExtensionFactory:hu.bme.mit.inf.dslreasoner.domains.transima.fam.FamPatterns" id="hu.bme.mit.inf.dslreasoner.domains.transima.fam.FamPatterns"> |
17 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.transima.fam.terminatorAndInformation"/> | 14 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.transima.fam.terminatorAndInformation"/> |
18 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.transima.fam.type"/> | ||
19 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.transima.fam.rootElements"/> | ||
20 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.transima.fam.parent"/> | ||
21 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.transima.fam.model"/> | ||
22 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.transima.fam.hasRoot"/> | ||
23 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.transima.fam.hasInt"/> | ||
24 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.transima.fam.hasLeaf"/> | ||
25 | </group> | 15 | </group> |
26 | </extension> | 16 | </extension> |
27 | </plugin> | 17 | </plugin> |
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/patterns/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Ecore.vql b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/patterns/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Ecore.vql index 78525a35..16c24d05 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/patterns/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Ecore.vql +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/patterns/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Ecore.vql | |||
@@ -11,6 +11,16 @@ pattern loopInInheritence(a: EClass) { | |||
11 | find directSupertype+(a,a); | 11 | find directSupertype+(a,a); |
12 | } | 12 | } |
13 | 13 | ||
14 | pattern unsat_subpackage(a: EPackage, b: EPackage) { | ||
15 | EPackage.eSubpackages(a, b); | ||
16 | } | ||
17 | |||
18 | @Constraint(key={p}, severity="error", message="error") | ||
19 | pattern unsat_loopInInheritance(p: EPackage) { | ||
20 | neg find unsat_subpackage(_, p); | ||
21 | neg find loopInInheritence(_); | ||
22 | } | ||
23 | |||
14 | pattern opposite(a:EReference, b: EReference) { | 24 | pattern opposite(a:EReference, b: EReference) { |
15 | EReference.eOpposite(a,b); | 25 | EReference.eOpposite(a,b); |
16 | } | 26 | } |
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/plugin.xml b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/plugin.xml index 6eae8535..eddd482c 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/plugin.xml +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/plugin.xml | |||
@@ -11,6 +11,8 @@ | |||
11 | <group group="org.eclipse.viatra.query.runtime.extensibility.SingletonExtensionFactory:hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Ecore" id="hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Ecore"> | 11 | <group group="org.eclipse.viatra.query.runtime.extensibility.SingletonExtensionFactory:hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Ecore" id="hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Ecore"> |
12 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.alloyexamples.directSupertype"/> | 12 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.alloyexamples.directSupertype"/> |
13 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.alloyexamples.loopInInheritence"/> | 13 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.alloyexamples.loopInInheritence"/> |
14 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.alloyexamples.unsat_subpackage"/> | ||
15 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.alloyexamples.unsat_loopInInheritance"/> | ||
14 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.alloyexamples.opposite"/> | 16 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.alloyexamples.opposite"/> |
15 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.alloyexamples.oppositeDifferentClass"/> | 17 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.alloyexamples.oppositeDifferentClass"/> |
16 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.alloyexamples.nonSymmetricOpposite"/> | 18 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.alloyexamples.nonSymmetricOpposite"/> |
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/.gitignore b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/.gitignore index 0f8c77a1..70eab455 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/.gitignore +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/.gitignore | |||
@@ -54,3 +54,8 @@ | |||
54 | /.RootIsNotDir.java._trace | 54 | /.RootIsNotDir.java._trace |
55 | /Dir.java | 55 | /Dir.java |
56 | /RootIsNotDir.java | 56 | /RootIsNotDir.java |
57 | /.Unsat_loopInInheritance.java._trace | ||
58 | /.Subpackage.java._trace | ||
59 | /.Unsat_subpackage.java._trace | ||
60 | /.Unsat_subpackageOrSelf.java._trace | ||
61 | /.Unsat_topLevelPackageWithLoop.java._trace | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Unsat_loopInInheritance.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Unsat_loopInInheritance.java new file mode 100644 index 00000000..83bd0f66 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Unsat_loopInInheritance.java | |||
@@ -0,0 +1,566 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/patterns/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Ecore.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.alloyexamples; | ||
5 | |||
6 | import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.LoopInInheritence; | ||
7 | import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Unsat_subpackage; | ||
8 | import java.util.Arrays; | ||
9 | import java.util.Collection; | ||
10 | import java.util.LinkedHashSet; | ||
11 | import java.util.List; | ||
12 | import java.util.Objects; | ||
13 | import java.util.Optional; | ||
14 | import java.util.Set; | ||
15 | import java.util.function.Consumer; | ||
16 | import java.util.stream.Collectors; | ||
17 | import java.util.stream.Stream; | ||
18 | import org.apache.log4j.Logger; | ||
19 | import org.eclipse.emf.ecore.EClass; | ||
20 | import org.eclipse.emf.ecore.EPackage; | ||
21 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
22 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
23 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
24 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
25 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; | ||
26 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | ||
27 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | ||
28 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; | ||
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
37 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
38 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
39 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
40 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; | ||
41 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
42 | import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | ||
43 | |||
44 | /** | ||
45 | * A pattern-specific query specification that can instantiate Matcher in a type-safe way. | ||
46 | * | ||
47 | * <p>Original source: | ||
48 | * <code><pre> | ||
49 | * {@literal @}Constraint(key={p}, severity="error", message="error") | ||
50 | * pattern unsat_loopInInheritance(p: EPackage) { | ||
51 | * neg find unsat_subpackage(_, p); | ||
52 | * neg find loopInInheritence(_); | ||
53 | * } | ||
54 | * </pre></code> | ||
55 | * | ||
56 | * @see Matcher | ||
57 | * @see Match | ||
58 | * | ||
59 | */ | ||
60 | @SuppressWarnings("all") | ||
61 | public final class Unsat_loopInInheritance extends BaseGeneratedEMFQuerySpecification<Unsat_loopInInheritance.Matcher> { | ||
62 | /** | ||
63 | * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.alloyexamples.unsat_loopInInheritance pattern, | ||
64 | * to be used in conjunction with {@link Matcher}. | ||
65 | * | ||
66 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | ||
67 | * Each instance is a (possibly partial) substitution of pattern parameters, | ||
68 | * usable to represent a match of the pattern in the result of a query, | ||
69 | * or to specify the bound (fixed) input parameters when issuing a query. | ||
70 | * | ||
71 | * @see Matcher | ||
72 | * | ||
73 | */ | ||
74 | public static abstract class Match extends BasePatternMatch { | ||
75 | private EPackage fP; | ||
76 | |||
77 | private static List<String> parameterNames = makeImmutableList("p"); | ||
78 | |||
79 | private Match(final EPackage pP) { | ||
80 | this.fP = pP; | ||
81 | } | ||
82 | |||
83 | @Override | ||
84 | public Object get(final String parameterName) { | ||
85 | switch(parameterName) { | ||
86 | case "p": return this.fP; | ||
87 | default: return null; | ||
88 | } | ||
89 | } | ||
90 | |||
91 | @Override | ||
92 | public Object get(final int index) { | ||
93 | switch(index) { | ||
94 | case 0: return this.fP; | ||
95 | default: return null; | ||
96 | } | ||
97 | } | ||
98 | |||
99 | public EPackage getP() { | ||
100 | return this.fP; | ||
101 | } | ||
102 | |||
103 | @Override | ||
104 | public boolean set(final String parameterName, final Object newValue) { | ||
105 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
106 | if ("p".equals(parameterName) ) { | ||
107 | this.fP = (EPackage) newValue; | ||
108 | return true; | ||
109 | } | ||
110 | return false; | ||
111 | } | ||
112 | |||
113 | public void setP(final EPackage pP) { | ||
114 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
115 | this.fP = pP; | ||
116 | } | ||
117 | |||
118 | @Override | ||
119 | public String patternName() { | ||
120 | return "hu.bme.mit.inf.dslreasoner.domains.alloyexamples.unsat_loopInInheritance"; | ||
121 | } | ||
122 | |||
123 | @Override | ||
124 | public List<String> parameterNames() { | ||
125 | return Unsat_loopInInheritance.Match.parameterNames; | ||
126 | } | ||
127 | |||
128 | @Override | ||
129 | public Object[] toArray() { | ||
130 | return new Object[]{fP}; | ||
131 | } | ||
132 | |||
133 | @Override | ||
134 | public Unsat_loopInInheritance.Match toImmutable() { | ||
135 | return isMutable() ? newMatch(fP) : this; | ||
136 | } | ||
137 | |||
138 | @Override | ||
139 | public String prettyPrint() { | ||
140 | StringBuilder result = new StringBuilder(); | ||
141 | result.append("\"p\"=" + prettyPrintValue(fP)); | ||
142 | return result.toString(); | ||
143 | } | ||
144 | |||
145 | @Override | ||
146 | public int hashCode() { | ||
147 | return Objects.hash(fP); | ||
148 | } | ||
149 | |||
150 | @Override | ||
151 | public boolean equals(final Object obj) { | ||
152 | if (this == obj) | ||
153 | return true; | ||
154 | if (obj == null) { | ||
155 | return false; | ||
156 | } | ||
157 | if ((obj instanceof Unsat_loopInInheritance.Match)) { | ||
158 | Unsat_loopInInheritance.Match other = (Unsat_loopInInheritance.Match) obj; | ||
159 | return Objects.equals(fP, other.fP); | ||
160 | } else { | ||
161 | // this should be infrequent | ||
162 | if (!(obj instanceof IPatternMatch)) { | ||
163 | return false; | ||
164 | } | ||
165 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
166 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
167 | } | ||
168 | } | ||
169 | |||
170 | @Override | ||
171 | public Unsat_loopInInheritance specification() { | ||
172 | return Unsat_loopInInheritance.instance(); | ||
173 | } | ||
174 | |||
175 | /** | ||
176 | * Returns an empty, mutable match. | ||
177 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
178 | * | ||
179 | * @return the empty match. | ||
180 | * | ||
181 | */ | ||
182 | public static Unsat_loopInInheritance.Match newEmptyMatch() { | ||
183 | return new Mutable(null); | ||
184 | } | ||
185 | |||
186 | /** | ||
187 | * Returns a mutable (partial) match. | ||
188 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
189 | * | ||
190 | * @param pP the fixed value of pattern parameter p, or null if not bound. | ||
191 | * @return the new, mutable (partial) match object. | ||
192 | * | ||
193 | */ | ||
194 | public static Unsat_loopInInheritance.Match newMutableMatch(final EPackage pP) { | ||
195 | return new Mutable(pP); | ||
196 | } | ||
197 | |||
198 | /** | ||
199 | * Returns a new (partial) match. | ||
200 | * This can be used e.g. to call the matcher with a partial match. | ||
201 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
202 | * @param pP the fixed value of pattern parameter p, or null if not bound. | ||
203 | * @return the (partial) match object. | ||
204 | * | ||
205 | */ | ||
206 | public static Unsat_loopInInheritance.Match newMatch(final EPackage pP) { | ||
207 | return new Immutable(pP); | ||
208 | } | ||
209 | |||
210 | private static final class Mutable extends Unsat_loopInInheritance.Match { | ||
211 | Mutable(final EPackage pP) { | ||
212 | super(pP); | ||
213 | } | ||
214 | |||
215 | @Override | ||
216 | public boolean isMutable() { | ||
217 | return true; | ||
218 | } | ||
219 | } | ||
220 | |||
221 | private static final class Immutable extends Unsat_loopInInheritance.Match { | ||
222 | Immutable(final EPackage pP) { | ||
223 | super(pP); | ||
224 | } | ||
225 | |||
226 | @Override | ||
227 | public boolean isMutable() { | ||
228 | return false; | ||
229 | } | ||
230 | } | ||
231 | } | ||
232 | |||
233 | /** | ||
234 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.alloyexamples.unsat_loopInInheritance pattern, | ||
235 | * providing pattern-specific query methods. | ||
236 | * | ||
237 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
238 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
239 | * | ||
240 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
241 | * | ||
242 | * <p>Original source: | ||
243 | * <code><pre> | ||
244 | * {@literal @}Constraint(key={p}, severity="error", message="error") | ||
245 | * pattern unsat_loopInInheritance(p: EPackage) { | ||
246 | * neg find unsat_subpackage(_, p); | ||
247 | * neg find loopInInheritence(_); | ||
248 | * } | ||
249 | * </pre></code> | ||
250 | * | ||
251 | * @see Match | ||
252 | * @see Unsat_loopInInheritance | ||
253 | * | ||
254 | */ | ||
255 | public static class Matcher extends BaseMatcher<Unsat_loopInInheritance.Match> { | ||
256 | /** | ||
257 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
258 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
259 | * | ||
260 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
261 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
262 | * | ||
263 | */ | ||
264 | public static Unsat_loopInInheritance.Matcher on(final ViatraQueryEngine engine) { | ||
265 | // check if matcher already exists | ||
266 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
267 | if (matcher == null) { | ||
268 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
269 | } | ||
270 | return matcher; | ||
271 | } | ||
272 | |||
273 | /** | ||
274 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
275 | * @return an initialized matcher | ||
276 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
277 | * | ||
278 | */ | ||
279 | public static Unsat_loopInInheritance.Matcher create() { | ||
280 | return new Matcher(); | ||
281 | } | ||
282 | |||
283 | private static final int POSITION_P = 0; | ||
284 | |||
285 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(Unsat_loopInInheritance.Matcher.class); | ||
286 | |||
287 | /** | ||
288 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
289 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
290 | * | ||
291 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
292 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
293 | * | ||
294 | */ | ||
295 | private Matcher() { | ||
296 | super(querySpecification()); | ||
297 | } | ||
298 | |||
299 | /** | ||
300 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
301 | * @param pP the fixed value of pattern parameter p, or null if not bound. | ||
302 | * @return matches represented as a Match object. | ||
303 | * | ||
304 | */ | ||
305 | public Collection<Unsat_loopInInheritance.Match> getAllMatches(final EPackage pP) { | ||
306 | return rawStreamAllMatches(new Object[]{pP}).collect(Collectors.toSet()); | ||
307 | } | ||
308 | |||
309 | /** | ||
310 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
311 | * </p> | ||
312 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
313 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
314 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
315 | * @param pP the fixed value of pattern parameter p, or null if not bound. | ||
316 | * @return a stream of matches represented as a Match object. | ||
317 | * | ||
318 | */ | ||
319 | public Stream<Unsat_loopInInheritance.Match> streamAllMatches(final EPackage pP) { | ||
320 | return rawStreamAllMatches(new Object[]{pP}); | ||
321 | } | ||
322 | |||
323 | /** | ||
324 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
325 | * Neither determinism nor randomness of selection is guaranteed. | ||
326 | * @param pP the fixed value of pattern parameter p, or null if not bound. | ||
327 | * @return a match represented as a Match object, or null if no match is found. | ||
328 | * | ||
329 | */ | ||
330 | public Optional<Unsat_loopInInheritance.Match> getOneArbitraryMatch(final EPackage pP) { | ||
331 | return rawGetOneArbitraryMatch(new Object[]{pP}); | ||
332 | } | ||
333 | |||
334 | /** | ||
335 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
336 | * under any possible substitution of the unspecified parameters (if any). | ||
337 | * @param pP the fixed value of pattern parameter p, or null if not bound. | ||
338 | * @return true if the input is a valid (partial) match of the pattern. | ||
339 | * | ||
340 | */ | ||
341 | public boolean hasMatch(final EPackage pP) { | ||
342 | return rawHasMatch(new Object[]{pP}); | ||
343 | } | ||
344 | |||
345 | /** | ||
346 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
347 | * @param pP the fixed value of pattern parameter p, or null if not bound. | ||
348 | * @return the number of pattern matches found. | ||
349 | * | ||
350 | */ | ||
351 | public int countMatches(final EPackage pP) { | ||
352 | return rawCountMatches(new Object[]{pP}); | ||
353 | } | ||
354 | |||
355 | /** | ||
356 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
357 | * Neither determinism nor randomness of selection is guaranteed. | ||
358 | * @param pP the fixed value of pattern parameter p, or null if not bound. | ||
359 | * @param processor the action that will process the selected match. | ||
360 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
361 | * | ||
362 | */ | ||
363 | public boolean forOneArbitraryMatch(final EPackage pP, final Consumer<? super Unsat_loopInInheritance.Match> processor) { | ||
364 | return rawForOneArbitraryMatch(new Object[]{pP}, processor); | ||
365 | } | ||
366 | |||
367 | /** | ||
368 | * Returns a new (partial) match. | ||
369 | * This can be used e.g. to call the matcher with a partial match. | ||
370 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
371 | * @param pP the fixed value of pattern parameter p, or null if not bound. | ||
372 | * @return the (partial) match object. | ||
373 | * | ||
374 | */ | ||
375 | public Unsat_loopInInheritance.Match newMatch(final EPackage pP) { | ||
376 | return Unsat_loopInInheritance.Match.newMatch(pP); | ||
377 | } | ||
378 | |||
379 | /** | ||
380 | * Retrieve the set of values that occur in matches for p. | ||
381 | * @return the Set of all values or empty set if there are no matches | ||
382 | * | ||
383 | */ | ||
384 | protected Stream<EPackage> rawStreamAllValuesOfp(final Object[] parameters) { | ||
385 | return rawStreamAllValues(POSITION_P, parameters).map(EPackage.class::cast); | ||
386 | } | ||
387 | |||
388 | /** | ||
389 | * Retrieve the set of values that occur in matches for p. | ||
390 | * @return the Set of all values or empty set if there are no matches | ||
391 | * | ||
392 | */ | ||
393 | public Set<EPackage> getAllValuesOfp() { | ||
394 | return rawStreamAllValuesOfp(emptyArray()).collect(Collectors.toSet()); | ||
395 | } | ||
396 | |||
397 | /** | ||
398 | * Retrieve the set of values that occur in matches for p. | ||
399 | * @return the Set of all values or empty set if there are no matches | ||
400 | * | ||
401 | */ | ||
402 | public Stream<EPackage> streamAllValuesOfp() { | ||
403 | return rawStreamAllValuesOfp(emptyArray()); | ||
404 | } | ||
405 | |||
406 | @Override | ||
407 | protected Unsat_loopInInheritance.Match tupleToMatch(final Tuple t) { | ||
408 | try { | ||
409 | return Unsat_loopInInheritance.Match.newMatch((EPackage) t.get(POSITION_P)); | ||
410 | } catch(ClassCastException e) { | ||
411 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
412 | return null; | ||
413 | } | ||
414 | } | ||
415 | |||
416 | @Override | ||
417 | protected Unsat_loopInInheritance.Match arrayToMatch(final Object[] match) { | ||
418 | try { | ||
419 | return Unsat_loopInInheritance.Match.newMatch((EPackage) match[POSITION_P]); | ||
420 | } catch(ClassCastException e) { | ||
421 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
422 | return null; | ||
423 | } | ||
424 | } | ||
425 | |||
426 | @Override | ||
427 | protected Unsat_loopInInheritance.Match arrayToMatchMutable(final Object[] match) { | ||
428 | try { | ||
429 | return Unsat_loopInInheritance.Match.newMutableMatch((EPackage) match[POSITION_P]); | ||
430 | } catch(ClassCastException e) { | ||
431 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
432 | return null; | ||
433 | } | ||
434 | } | ||
435 | |||
436 | /** | ||
437 | * @return the singleton instance of the query specification of this pattern | ||
438 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
439 | * | ||
440 | */ | ||
441 | public static IQuerySpecification<Unsat_loopInInheritance.Matcher> querySpecification() { | ||
442 | return Unsat_loopInInheritance.instance(); | ||
443 | } | ||
444 | } | ||
445 | |||
446 | private Unsat_loopInInheritance() { | ||
447 | super(GeneratedPQuery.INSTANCE); | ||
448 | } | ||
449 | |||
450 | /** | ||
451 | * @return the singleton instance of the query specification | ||
452 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
453 | * | ||
454 | */ | ||
455 | public static Unsat_loopInInheritance instance() { | ||
456 | try{ | ||
457 | return LazyHolder.INSTANCE; | ||
458 | } catch (ExceptionInInitializerError err) { | ||
459 | throw processInitializerError(err); | ||
460 | } | ||
461 | } | ||
462 | |||
463 | @Override | ||
464 | protected Unsat_loopInInheritance.Matcher instantiate(final ViatraQueryEngine engine) { | ||
465 | return Unsat_loopInInheritance.Matcher.on(engine); | ||
466 | } | ||
467 | |||
468 | @Override | ||
469 | public Unsat_loopInInheritance.Matcher instantiate() { | ||
470 | return Unsat_loopInInheritance.Matcher.create(); | ||
471 | } | ||
472 | |||
473 | @Override | ||
474 | public Unsat_loopInInheritance.Match newEmptyMatch() { | ||
475 | return Unsat_loopInInheritance.Match.newEmptyMatch(); | ||
476 | } | ||
477 | |||
478 | @Override | ||
479 | public Unsat_loopInInheritance.Match newMatch(final Object... parameters) { | ||
480 | return Unsat_loopInInheritance.Match.newMatch((org.eclipse.emf.ecore.EPackage) parameters[0]); | ||
481 | } | ||
482 | |||
483 | /** | ||
484 | * Inner class allowing the singleton instance of {@link Unsat_loopInInheritance} to be created | ||
485 | * <b>not</b> at the class load time of the outer class, | ||
486 | * but rather at the first call to {@link Unsat_loopInInheritance#instance()}. | ||
487 | * | ||
488 | * <p> This workaround is required e.g. to support recursion. | ||
489 | * | ||
490 | */ | ||
491 | private static class LazyHolder { | ||
492 | private static final Unsat_loopInInheritance INSTANCE = new Unsat_loopInInheritance(); | ||
493 | |||
494 | /** | ||
495 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
496 | * This initialization order is required to support indirect recursion. | ||
497 | * | ||
498 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
499 | * | ||
500 | */ | ||
501 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
502 | |||
503 | public static Object ensureInitialized() { | ||
504 | INSTANCE.ensureInitializedInternal(); | ||
505 | return null; | ||
506 | } | ||
507 | } | ||
508 | |||
509 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
510 | private static final Unsat_loopInInheritance.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
511 | |||
512 | private final PParameter parameter_p = new PParameter("p", "org.eclipse.emf.ecore.EPackage", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.eclipse.org/emf/2002/Ecore", "EPackage")), PParameterDirection.INOUT); | ||
513 | |||
514 | private final List<PParameter> parameters = Arrays.asList(parameter_p); | ||
515 | |||
516 | private GeneratedPQuery() { | ||
517 | super(PVisibility.PUBLIC); | ||
518 | } | ||
519 | |||
520 | @Override | ||
521 | public String getFullyQualifiedName() { | ||
522 | return "hu.bme.mit.inf.dslreasoner.domains.alloyexamples.unsat_loopInInheritance"; | ||
523 | } | ||
524 | |||
525 | @Override | ||
526 | public List<String> getParameterNames() { | ||
527 | return Arrays.asList("p"); | ||
528 | } | ||
529 | |||
530 | @Override | ||
531 | public List<PParameter> getParameters() { | ||
532 | return parameters; | ||
533 | } | ||
534 | |||
535 | @Override | ||
536 | public Set<PBody> doGetContainedBodies() { | ||
537 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
538 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
539 | { | ||
540 | PBody body = new PBody(this); | ||
541 | PVariable var_p = body.getOrCreateVariableByName("p"); | ||
542 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
543 | PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); | ||
544 | new TypeConstraint(body, Tuples.flatTupleOf(var_p), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EPackage"))); | ||
545 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
546 | new ExportedParameter(body, var_p, parameter_p) | ||
547 | )); | ||
548 | // neg find unsat_subpackage(_, p) | ||
549 | new NegativePatternCall(body, Tuples.flatTupleOf(var___0_, var_p), Unsat_subpackage.instance().getInternalQueryRepresentation()); | ||
550 | // neg find loopInInheritence(_) | ||
551 | new NegativePatternCall(body, Tuples.flatTupleOf(var___1_), LoopInInheritence.instance().getInternalQueryRepresentation()); | ||
552 | bodies.add(body); | ||
553 | } | ||
554 | { | ||
555 | PAnnotation annotation = new PAnnotation("Constraint"); | ||
556 | annotation.addAttribute("key", Arrays.asList(new Object[] { | ||
557 | new ParameterReference("p") | ||
558 | })); | ||
559 | annotation.addAttribute("severity", "error"); | ||
560 | annotation.addAttribute("message", "error"); | ||
561 | addAnnotation(annotation); | ||
562 | } | ||
563 | return bodies; | ||
564 | } | ||
565 | } | ||
566 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Unsat_subpackage.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Unsat_subpackage.java new file mode 100644 index 00000000..a9c8aed8 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Unsat_subpackage.java | |||
@@ -0,0 +1,704 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/patterns/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Ecore.vql | ||
3 | */ | ||
4 | package hu.bme.mit.inf.dslreasoner.domains.alloyexamples; | ||
5 | |||
6 | import java.util.Arrays; | ||
7 | import java.util.Collection; | ||
8 | import java.util.LinkedHashSet; | ||
9 | import java.util.List; | ||
10 | import java.util.Objects; | ||
11 | import java.util.Optional; | ||
12 | import java.util.Set; | ||
13 | import java.util.function.Consumer; | ||
14 | import java.util.stream.Collectors; | ||
15 | import java.util.stream.Stream; | ||
16 | import org.apache.log4j.Logger; | ||
17 | import org.eclipse.emf.ecore.EClass; | ||
18 | import org.eclipse.emf.ecore.EPackage; | ||
19 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
20 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
21 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
22 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
23 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; | ||
24 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | ||
25 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | ||
26 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
27 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
37 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; | ||
38 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
39 | import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | ||
40 | |||
41 | /** | ||
42 | * A pattern-specific query specification that can instantiate Matcher in a type-safe way. | ||
43 | * | ||
44 | * <p>Original source: | ||
45 | * <code><pre> | ||
46 | * pattern unsat_subpackage(a: EPackage, b: EPackage) { | ||
47 | * EPackage.eSubpackages(a, b); | ||
48 | * } | ||
49 | * </pre></code> | ||
50 | * | ||
51 | * @see Matcher | ||
52 | * @see Match | ||
53 | * | ||
54 | */ | ||
55 | @SuppressWarnings("all") | ||
56 | public final class Unsat_subpackage extends BaseGeneratedEMFQuerySpecification<Unsat_subpackage.Matcher> { | ||
57 | /** | ||
58 | * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.alloyexamples.unsat_subpackage pattern, | ||
59 | * to be used in conjunction with {@link Matcher}. | ||
60 | * | ||
61 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | ||
62 | * Each instance is a (possibly partial) substitution of pattern parameters, | ||
63 | * usable to represent a match of the pattern in the result of a query, | ||
64 | * or to specify the bound (fixed) input parameters when issuing a query. | ||
65 | * | ||
66 | * @see Matcher | ||
67 | * | ||
68 | */ | ||
69 | public static abstract class Match extends BasePatternMatch { | ||
70 | private EPackage fA; | ||
71 | |||
72 | private EPackage fB; | ||
73 | |||
74 | private static List<String> parameterNames = makeImmutableList("a", "b"); | ||
75 | |||
76 | private Match(final EPackage pA, final EPackage pB) { | ||
77 | this.fA = pA; | ||
78 | this.fB = pB; | ||
79 | } | ||
80 | |||
81 | @Override | ||
82 | public Object get(final String parameterName) { | ||
83 | switch(parameterName) { | ||
84 | case "a": return this.fA; | ||
85 | case "b": return this.fB; | ||
86 | default: return null; | ||
87 | } | ||
88 | } | ||
89 | |||
90 | @Override | ||
91 | public Object get(final int index) { | ||
92 | switch(index) { | ||
93 | case 0: return this.fA; | ||
94 | case 1: return this.fB; | ||
95 | default: return null; | ||
96 | } | ||
97 | } | ||
98 | |||
99 | public EPackage getA() { | ||
100 | return this.fA; | ||
101 | } | ||
102 | |||
103 | public EPackage getB() { | ||
104 | return this.fB; | ||
105 | } | ||
106 | |||
107 | @Override | ||
108 | public boolean set(final String parameterName, final Object newValue) { | ||
109 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
110 | if ("a".equals(parameterName) ) { | ||
111 | this.fA = (EPackage) newValue; | ||
112 | return true; | ||
113 | } | ||
114 | if ("b".equals(parameterName) ) { | ||
115 | this.fB = (EPackage) newValue; | ||
116 | return true; | ||
117 | } | ||
118 | return false; | ||
119 | } | ||
120 | |||
121 | public void setA(final EPackage pA) { | ||
122 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
123 | this.fA = pA; | ||
124 | } | ||
125 | |||
126 | public void setB(final EPackage pB) { | ||
127 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
128 | this.fB = pB; | ||
129 | } | ||
130 | |||
131 | @Override | ||
132 | public String patternName() { | ||
133 | return "hu.bme.mit.inf.dslreasoner.domains.alloyexamples.unsat_subpackage"; | ||
134 | } | ||
135 | |||
136 | @Override | ||
137 | public List<String> parameterNames() { | ||
138 | return Unsat_subpackage.Match.parameterNames; | ||
139 | } | ||
140 | |||
141 | @Override | ||
142 | public Object[] toArray() { | ||
143 | return new Object[]{fA, fB}; | ||
144 | } | ||
145 | |||
146 | @Override | ||
147 | public Unsat_subpackage.Match toImmutable() { | ||
148 | return isMutable() ? newMatch(fA, fB) : this; | ||
149 | } | ||
150 | |||
151 | @Override | ||
152 | public String prettyPrint() { | ||
153 | StringBuilder result = new StringBuilder(); | ||
154 | result.append("\"a\"=" + prettyPrintValue(fA) + ", "); | ||
155 | result.append("\"b\"=" + prettyPrintValue(fB)); | ||
156 | return result.toString(); | ||
157 | } | ||
158 | |||
159 | @Override | ||
160 | public int hashCode() { | ||
161 | return Objects.hash(fA, fB); | ||
162 | } | ||
163 | |||
164 | @Override | ||
165 | public boolean equals(final Object obj) { | ||
166 | if (this == obj) | ||
167 | return true; | ||
168 | if (obj == null) { | ||
169 | return false; | ||
170 | } | ||
171 | if ((obj instanceof Unsat_subpackage.Match)) { | ||
172 | Unsat_subpackage.Match other = (Unsat_subpackage.Match) obj; | ||
173 | return Objects.equals(fA, other.fA) && Objects.equals(fB, other.fB); | ||
174 | } else { | ||
175 | // this should be infrequent | ||
176 | if (!(obj instanceof IPatternMatch)) { | ||
177 | return false; | ||
178 | } | ||
179 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
180 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
181 | } | ||
182 | } | ||
183 | |||
184 | @Override | ||
185 | public Unsat_subpackage specification() { | ||
186 | return Unsat_subpackage.instance(); | ||
187 | } | ||
188 | |||
189 | /** | ||
190 | * Returns an empty, mutable match. | ||
191 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
192 | * | ||
193 | * @return the empty match. | ||
194 | * | ||
195 | */ | ||
196 | public static Unsat_subpackage.Match newEmptyMatch() { | ||
197 | return new Mutable(null, null); | ||
198 | } | ||
199 | |||
200 | /** | ||
201 | * Returns a mutable (partial) match. | ||
202 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
203 | * | ||
204 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
205 | * @param pB the fixed value of pattern parameter b, or null if not bound. | ||
206 | * @return the new, mutable (partial) match object. | ||
207 | * | ||
208 | */ | ||
209 | public static Unsat_subpackage.Match newMutableMatch(final EPackage pA, final EPackage pB) { | ||
210 | return new Mutable(pA, pB); | ||
211 | } | ||
212 | |||
213 | /** | ||
214 | * Returns a new (partial) match. | ||
215 | * This can be used e.g. to call the matcher with a partial match. | ||
216 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
217 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
218 | * @param pB the fixed value of pattern parameter b, or null if not bound. | ||
219 | * @return the (partial) match object. | ||
220 | * | ||
221 | */ | ||
222 | public static Unsat_subpackage.Match newMatch(final EPackage pA, final EPackage pB) { | ||
223 | return new Immutable(pA, pB); | ||
224 | } | ||
225 | |||
226 | private static final class Mutable extends Unsat_subpackage.Match { | ||
227 | Mutable(final EPackage pA, final EPackage pB) { | ||
228 | super(pA, pB); | ||
229 | } | ||
230 | |||
231 | @Override | ||
232 | public boolean isMutable() { | ||
233 | return true; | ||
234 | } | ||
235 | } | ||
236 | |||
237 | private static final class Immutable extends Unsat_subpackage.Match { | ||
238 | Immutable(final EPackage pA, final EPackage pB) { | ||
239 | super(pA, pB); | ||
240 | } | ||
241 | |||
242 | @Override | ||
243 | public boolean isMutable() { | ||
244 | return false; | ||
245 | } | ||
246 | } | ||
247 | } | ||
248 | |||
249 | /** | ||
250 | * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.alloyexamples.unsat_subpackage pattern, | ||
251 | * providing pattern-specific query methods. | ||
252 | * | ||
253 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
254 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
255 | * | ||
256 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
257 | * | ||
258 | * <p>Original source: | ||
259 | * <code><pre> | ||
260 | * pattern unsat_subpackage(a: EPackage, b: EPackage) { | ||
261 | * EPackage.eSubpackages(a, b); | ||
262 | * } | ||
263 | * </pre></code> | ||
264 | * | ||
265 | * @see Match | ||
266 | * @see Unsat_subpackage | ||
267 | * | ||
268 | */ | ||
269 | public static class Matcher extends BaseMatcher<Unsat_subpackage.Match> { | ||
270 | /** | ||
271 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
272 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
273 | * | ||
274 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
275 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
276 | * | ||
277 | */ | ||
278 | public static Unsat_subpackage.Matcher on(final ViatraQueryEngine engine) { | ||
279 | // check if matcher already exists | ||
280 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
281 | if (matcher == null) { | ||
282 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
283 | } | ||
284 | return matcher; | ||
285 | } | ||
286 | |||
287 | /** | ||
288 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
289 | * @return an initialized matcher | ||
290 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
291 | * | ||
292 | */ | ||
293 | public static Unsat_subpackage.Matcher create() { | ||
294 | return new Matcher(); | ||
295 | } | ||
296 | |||
297 | private static final int POSITION_A = 0; | ||
298 | |||
299 | private static final int POSITION_B = 1; | ||
300 | |||
301 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(Unsat_subpackage.Matcher.class); | ||
302 | |||
303 | /** | ||
304 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
305 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
306 | * | ||
307 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
308 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
309 | * | ||
310 | */ | ||
311 | private Matcher() { | ||
312 | super(querySpecification()); | ||
313 | } | ||
314 | |||
315 | /** | ||
316 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
317 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
318 | * @param pB the fixed value of pattern parameter b, or null if not bound. | ||
319 | * @return matches represented as a Match object. | ||
320 | * | ||
321 | */ | ||
322 | public Collection<Unsat_subpackage.Match> getAllMatches(final EPackage pA, final EPackage pB) { | ||
323 | return rawStreamAllMatches(new Object[]{pA, pB}).collect(Collectors.toSet()); | ||
324 | } | ||
325 | |||
326 | /** | ||
327 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
328 | * </p> | ||
329 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
330 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
331 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
332 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
333 | * @param pB the fixed value of pattern parameter b, or null if not bound. | ||
334 | * @return a stream of matches represented as a Match object. | ||
335 | * | ||
336 | */ | ||
337 | public Stream<Unsat_subpackage.Match> streamAllMatches(final EPackage pA, final EPackage pB) { | ||
338 | return rawStreamAllMatches(new Object[]{pA, pB}); | ||
339 | } | ||
340 | |||
341 | /** | ||
342 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
343 | * Neither determinism nor randomness of selection is guaranteed. | ||
344 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
345 | * @param pB the fixed value of pattern parameter b, or null if not bound. | ||
346 | * @return a match represented as a Match object, or null if no match is found. | ||
347 | * | ||
348 | */ | ||
349 | public Optional<Unsat_subpackage.Match> getOneArbitraryMatch(final EPackage pA, final EPackage pB) { | ||
350 | return rawGetOneArbitraryMatch(new Object[]{pA, pB}); | ||
351 | } | ||
352 | |||
353 | /** | ||
354 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
355 | * under any possible substitution of the unspecified parameters (if any). | ||
356 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
357 | * @param pB the fixed value of pattern parameter b, or null if not bound. | ||
358 | * @return true if the input is a valid (partial) match of the pattern. | ||
359 | * | ||
360 | */ | ||
361 | public boolean hasMatch(final EPackage pA, final EPackage pB) { | ||
362 | return rawHasMatch(new Object[]{pA, pB}); | ||
363 | } | ||
364 | |||
365 | /** | ||
366 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
367 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
368 | * @param pB the fixed value of pattern parameter b, or null if not bound. | ||
369 | * @return the number of pattern matches found. | ||
370 | * | ||
371 | */ | ||
372 | public int countMatches(final EPackage pA, final EPackage pB) { | ||
373 | return rawCountMatches(new Object[]{pA, pB}); | ||
374 | } | ||
375 | |||
376 | /** | ||
377 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
378 | * Neither determinism nor randomness of selection is guaranteed. | ||
379 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
380 | * @param pB the fixed value of pattern parameter b, or null if not bound. | ||
381 | * @param processor the action that will process the selected match. | ||
382 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
383 | * | ||
384 | */ | ||
385 | public boolean forOneArbitraryMatch(final EPackage pA, final EPackage pB, final Consumer<? super Unsat_subpackage.Match> processor) { | ||
386 | return rawForOneArbitraryMatch(new Object[]{pA, pB}, processor); | ||
387 | } | ||
388 | |||
389 | /** | ||
390 | * Returns a new (partial) match. | ||
391 | * This can be used e.g. to call the matcher with a partial match. | ||
392 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
393 | * @param pA the fixed value of pattern parameter a, or null if not bound. | ||
394 | * @param pB the fixed value of pattern parameter b, or null if not bound. | ||
395 | * @return the (partial) match object. | ||
396 | * | ||
397 | */ | ||
398 | public Unsat_subpackage.Match newMatch(final EPackage pA, final EPackage pB) { | ||
399 | return Unsat_subpackage.Match.newMatch(pA, pB); | ||
400 | } | ||
401 | |||
402 | /** | ||
403 | * Retrieve the set of values that occur in matches for a. | ||
404 | * @return the Set of all values or empty set if there are no matches | ||
405 | * | ||
406 | */ | ||
407 | protected Stream<EPackage> rawStreamAllValuesOfa(final Object[] parameters) { | ||
408 | return rawStreamAllValues(POSITION_A, parameters).map(EPackage.class::cast); | ||
409 | } | ||
410 | |||
411 | /** | ||
412 | * Retrieve the set of values that occur in matches for a. | ||
413 | * @return the Set of all values or empty set if there are no matches | ||
414 | * | ||
415 | */ | ||
416 | public Set<EPackage> getAllValuesOfa() { | ||
417 | return rawStreamAllValuesOfa(emptyArray()).collect(Collectors.toSet()); | ||
418 | } | ||
419 | |||
420 | /** | ||
421 | * Retrieve the set of values that occur in matches for a. | ||
422 | * @return the Set of all values or empty set if there are no matches | ||
423 | * | ||
424 | */ | ||
425 | public Stream<EPackage> streamAllValuesOfa() { | ||
426 | return rawStreamAllValuesOfa(emptyArray()); | ||
427 | } | ||
428 | |||
429 | /** | ||
430 | * Retrieve the set of values that occur in matches for a. | ||
431 | * </p> | ||
432 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
433 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
434 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
435 | * | ||
436 | * @return the Stream of all values or empty set if there are no matches | ||
437 | * | ||
438 | */ | ||
439 | public Stream<EPackage> streamAllValuesOfa(final Unsat_subpackage.Match partialMatch) { | ||
440 | return rawStreamAllValuesOfa(partialMatch.toArray()); | ||
441 | } | ||
442 | |||
443 | /** | ||
444 | * Retrieve the set of values that occur in matches for a. | ||
445 | * </p> | ||
446 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
447 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
448 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
449 | * | ||
450 | * @return the Stream of all values or empty set if there are no matches | ||
451 | * | ||
452 | */ | ||
453 | public Stream<EPackage> streamAllValuesOfa(final EPackage pB) { | ||
454 | return rawStreamAllValuesOfa(new Object[]{null, pB}); | ||
455 | } | ||
456 | |||
457 | /** | ||
458 | * Retrieve the set of values that occur in matches for a. | ||
459 | * @return the Set of all values or empty set if there are no matches | ||
460 | * | ||
461 | */ | ||
462 | public Set<EPackage> getAllValuesOfa(final Unsat_subpackage.Match partialMatch) { | ||
463 | return rawStreamAllValuesOfa(partialMatch.toArray()).collect(Collectors.toSet()); | ||
464 | } | ||
465 | |||
466 | /** | ||
467 | * Retrieve the set of values that occur in matches for a. | ||
468 | * @return the Set of all values or empty set if there are no matches | ||
469 | * | ||
470 | */ | ||
471 | public Set<EPackage> getAllValuesOfa(final EPackage pB) { | ||
472 | return rawStreamAllValuesOfa(new Object[]{null, pB}).collect(Collectors.toSet()); | ||
473 | } | ||
474 | |||
475 | /** | ||
476 | * Retrieve the set of values that occur in matches for b. | ||
477 | * @return the Set of all values or empty set if there are no matches | ||
478 | * | ||
479 | */ | ||
480 | protected Stream<EPackage> rawStreamAllValuesOfb(final Object[] parameters) { | ||
481 | return rawStreamAllValues(POSITION_B, parameters).map(EPackage.class::cast); | ||
482 | } | ||
483 | |||
484 | /** | ||
485 | * Retrieve the set of values that occur in matches for b. | ||
486 | * @return the Set of all values or empty set if there are no matches | ||
487 | * | ||
488 | */ | ||
489 | public Set<EPackage> getAllValuesOfb() { | ||
490 | return rawStreamAllValuesOfb(emptyArray()).collect(Collectors.toSet()); | ||
491 | } | ||
492 | |||
493 | /** | ||
494 | * Retrieve the set of values that occur in matches for b. | ||
495 | * @return the Set of all values or empty set if there are no matches | ||
496 | * | ||
497 | */ | ||
498 | public Stream<EPackage> streamAllValuesOfb() { | ||
499 | return rawStreamAllValuesOfb(emptyArray()); | ||
500 | } | ||
501 | |||
502 | /** | ||
503 | * Retrieve the set of values that occur in matches for b. | ||
504 | * </p> | ||
505 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
506 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
507 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
508 | * | ||
509 | * @return the Stream of all values or empty set if there are no matches | ||
510 | * | ||
511 | */ | ||
512 | public Stream<EPackage> streamAllValuesOfb(final Unsat_subpackage.Match partialMatch) { | ||
513 | return rawStreamAllValuesOfb(partialMatch.toArray()); | ||
514 | } | ||
515 | |||
516 | /** | ||
517 | * Retrieve the set of values that occur in matches for b. | ||
518 | * </p> | ||
519 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
520 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
521 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
522 | * | ||
523 | * @return the Stream of all values or empty set if there are no matches | ||
524 | * | ||
525 | */ | ||
526 | public Stream<EPackage> streamAllValuesOfb(final EPackage pA) { | ||
527 | return rawStreamAllValuesOfb(new Object[]{pA, null}); | ||
528 | } | ||
529 | |||
530 | /** | ||
531 | * Retrieve the set of values that occur in matches for b. | ||
532 | * @return the Set of all values or empty set if there are no matches | ||
533 | * | ||
534 | */ | ||
535 | public Set<EPackage> getAllValuesOfb(final Unsat_subpackage.Match partialMatch) { | ||
536 | return rawStreamAllValuesOfb(partialMatch.toArray()).collect(Collectors.toSet()); | ||
537 | } | ||
538 | |||
539 | /** | ||
540 | * Retrieve the set of values that occur in matches for b. | ||
541 | * @return the Set of all values or empty set if there are no matches | ||
542 | * | ||
543 | */ | ||
544 | public Set<EPackage> getAllValuesOfb(final EPackage pA) { | ||
545 | return rawStreamAllValuesOfb(new Object[]{pA, null}).collect(Collectors.toSet()); | ||
546 | } | ||
547 | |||
548 | @Override | ||
549 | protected Unsat_subpackage.Match tupleToMatch(final Tuple t) { | ||
550 | try { | ||
551 | return Unsat_subpackage.Match.newMatch((EPackage) t.get(POSITION_A), (EPackage) t.get(POSITION_B)); | ||
552 | } catch(ClassCastException e) { | ||
553 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
554 | return null; | ||
555 | } | ||
556 | } | ||
557 | |||
558 | @Override | ||
559 | protected Unsat_subpackage.Match arrayToMatch(final Object[] match) { | ||
560 | try { | ||
561 | return Unsat_subpackage.Match.newMatch((EPackage) match[POSITION_A], (EPackage) match[POSITION_B]); | ||
562 | } catch(ClassCastException e) { | ||
563 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
564 | return null; | ||
565 | } | ||
566 | } | ||
567 | |||
568 | @Override | ||
569 | protected Unsat_subpackage.Match arrayToMatchMutable(final Object[] match) { | ||
570 | try { | ||
571 | return Unsat_subpackage.Match.newMutableMatch((EPackage) match[POSITION_A], (EPackage) match[POSITION_B]); | ||
572 | } catch(ClassCastException e) { | ||
573 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
574 | return null; | ||
575 | } | ||
576 | } | ||
577 | |||
578 | /** | ||
579 | * @return the singleton instance of the query specification of this pattern | ||
580 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
581 | * | ||
582 | */ | ||
583 | public static IQuerySpecification<Unsat_subpackage.Matcher> querySpecification() { | ||
584 | return Unsat_subpackage.instance(); | ||
585 | } | ||
586 | } | ||
587 | |||
588 | private Unsat_subpackage() { | ||
589 | super(GeneratedPQuery.INSTANCE); | ||
590 | } | ||
591 | |||
592 | /** | ||
593 | * @return the singleton instance of the query specification | ||
594 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
595 | * | ||
596 | */ | ||
597 | public static Unsat_subpackage instance() { | ||
598 | try{ | ||
599 | return LazyHolder.INSTANCE; | ||
600 | } catch (ExceptionInInitializerError err) { | ||
601 | throw processInitializerError(err); | ||
602 | } | ||
603 | } | ||
604 | |||
605 | @Override | ||
606 | protected Unsat_subpackage.Matcher instantiate(final ViatraQueryEngine engine) { | ||
607 | return Unsat_subpackage.Matcher.on(engine); | ||
608 | } | ||
609 | |||
610 | @Override | ||
611 | public Unsat_subpackage.Matcher instantiate() { | ||
612 | return Unsat_subpackage.Matcher.create(); | ||
613 | } | ||
614 | |||
615 | @Override | ||
616 | public Unsat_subpackage.Match newEmptyMatch() { | ||
617 | return Unsat_subpackage.Match.newEmptyMatch(); | ||
618 | } | ||
619 | |||
620 | @Override | ||
621 | public Unsat_subpackage.Match newMatch(final Object... parameters) { | ||
622 | return Unsat_subpackage.Match.newMatch((org.eclipse.emf.ecore.EPackage) parameters[0], (org.eclipse.emf.ecore.EPackage) parameters[1]); | ||
623 | } | ||
624 | |||
625 | /** | ||
626 | * Inner class allowing the singleton instance of {@link Unsat_subpackage} to be created | ||
627 | * <b>not</b> at the class load time of the outer class, | ||
628 | * but rather at the first call to {@link Unsat_subpackage#instance()}. | ||
629 | * | ||
630 | * <p> This workaround is required e.g. to support recursion. | ||
631 | * | ||
632 | */ | ||
633 | private static class LazyHolder { | ||
634 | private static final Unsat_subpackage INSTANCE = new Unsat_subpackage(); | ||
635 | |||
636 | /** | ||
637 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
638 | * This initialization order is required to support indirect recursion. | ||
639 | * | ||
640 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
641 | * | ||
642 | */ | ||
643 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
644 | |||
645 | public static Object ensureInitialized() { | ||
646 | INSTANCE.ensureInitializedInternal(); | ||
647 | return null; | ||
648 | } | ||
649 | } | ||
650 | |||
651 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
652 | private static final Unsat_subpackage.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
653 | |||
654 | private final PParameter parameter_a = new PParameter("a", "org.eclipse.emf.ecore.EPackage", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.eclipse.org/emf/2002/Ecore", "EPackage")), PParameterDirection.INOUT); | ||
655 | |||
656 | private final PParameter parameter_b = new PParameter("b", "org.eclipse.emf.ecore.EPackage", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.eclipse.org/emf/2002/Ecore", "EPackage")), PParameterDirection.INOUT); | ||
657 | |||
658 | private final List<PParameter> parameters = Arrays.asList(parameter_a, parameter_b); | ||
659 | |||
660 | private GeneratedPQuery() { | ||
661 | super(PVisibility.PUBLIC); | ||
662 | } | ||
663 | |||
664 | @Override | ||
665 | public String getFullyQualifiedName() { | ||
666 | return "hu.bme.mit.inf.dslreasoner.domains.alloyexamples.unsat_subpackage"; | ||
667 | } | ||
668 | |||
669 | @Override | ||
670 | public List<String> getParameterNames() { | ||
671 | return Arrays.asList("a","b"); | ||
672 | } | ||
673 | |||
674 | @Override | ||
675 | public List<PParameter> getParameters() { | ||
676 | return parameters; | ||
677 | } | ||
678 | |||
679 | @Override | ||
680 | public Set<PBody> doGetContainedBodies() { | ||
681 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
682 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
683 | { | ||
684 | PBody body = new PBody(this); | ||
685 | PVariable var_a = body.getOrCreateVariableByName("a"); | ||
686 | PVariable var_b = body.getOrCreateVariableByName("b"); | ||
687 | new TypeConstraint(body, Tuples.flatTupleOf(var_a), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EPackage"))); | ||
688 | new TypeConstraint(body, Tuples.flatTupleOf(var_b), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EPackage"))); | ||
689 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
690 | new ExportedParameter(body, var_a, parameter_a), | ||
691 | new ExportedParameter(body, var_b, parameter_b) | ||
692 | )); | ||
693 | // EPackage.eSubpackages(a, b) | ||
694 | new TypeConstraint(body, Tuples.flatTupleOf(var_a), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EPackage"))); | ||
695 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
696 | new TypeConstraint(body, Tuples.flatTupleOf(var_a, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.eclipse.org/emf/2002/Ecore", "EPackage", "eSubpackages"))); | ||
697 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EPackage"))); | ||
698 | new Equality(body, var__virtual_0_, var_b); | ||
699 | bodies.add(body); | ||
700 | } | ||
701 | return bodies; | ||
702 | } | ||
703 | } | ||
704 | } | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/internal/.gitignore b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/internal/.gitignore new file mode 100644 index 00000000..995169ff --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/internal/.gitignore | |||
@@ -0,0 +1,4 @@ | |||
1 | /.EcoreAll.java._trace | ||
2 | /.SubpackageOrSelf.java._trace | ||
3 | /.Subpackage.java._trace | ||
4 | /.TopLevelPackageWithLoop.java._trace | ||
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/plugin.xml b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/plugin.xml index b0b77996..fe1af62e 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/plugin.xml +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/plugin.xml | |||
@@ -1,9 +1,12 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?><?eclipse version="3.0"?><!-- | 1 | <?xml version="1.0" encoding="UTF-8"?><?eclipse version="3.0"?><!-- |
2 | --><plugin> | 2 | --><plugin> |
3 | <extension point="org.eclipse.emf.ecore.generated_package"> | 3 | <extension point="org.eclipse.emf.ecore.generated_package"> |
4 | <!-- @generated satellite --> | 4 | <!-- @generated satellite --> |
5 | <package class="satellite.SatellitePackage" genModel="model/satellite.genmodel" uri="http://www.example.org/satellite"/> | 5 | <package |
6 | </extension> | 6 | uri="http://www.example.org/satellite" |
7 | class="satellite.SatellitePackage" | ||
8 | genModel="model/satellite.genmodel"/> | ||
9 | </extension> | ||
7 | <extension id="hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SatelliteQueries" point="org.eclipse.viatra.query.runtime.queryspecification"> | 10 | <extension id="hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SatelliteQueries" point="org.eclipse.viatra.query.runtime.queryspecification"> |
8 | <group group="org.eclipse.viatra.query.runtime.extensibility.SingletonExtensionFactory:hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SatelliteQueries" id="hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SatelliteQueries"> | 11 | <group group="org.eclipse.viatra.query.runtime.extensibility.SingletonExtensionFactory:hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SatelliteQueries" id="hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SatelliteQueries"> |
9 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.satellite.queries.communicationLinkDoesNotStartAtContainingElement"/> | 12 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.satellite.queries.communicationLinkDoesNotStartAtContainingElement"/> |
@@ -11,6 +14,7 @@ | |||
11 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.satellite.queries.roundStationNetworkUHF"/> | 14 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.satellite.queries.roundStationNetworkUHF"/> |
12 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.satellite.queries.notEnoughInterferometryPayloads"/> | 15 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.satellite.queries.notEnoughInterferometryPayloads"/> |
13 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.satellite.queries.noLinkToGroundStation"/> | 16 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.satellite.queries.noLinkToGroundStation"/> |
17 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.satellite.queries.unsat_linkToGroundStation"/> | ||
14 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.satellite.queries.noPotentialLinkToGroundStation"/> | 18 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.satellite.queries.noPotentialLinkToGroundStation"/> |
15 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.satellite.queries.communicationLoop"/> | 19 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.satellite.queries.communicationLoop"/> |
16 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.satellite.queries.incompatibleSourceAndTargetBand"/> | 20 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.domains.satellite.queries.incompatibleSourceAndTargetBand"/> |
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql index 1f83a3b0..ba12bbda 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql | |||
@@ -59,6 +59,19 @@ pattern noLinkToGroundStation(Spacecraft : Spacecraft) { | |||
59 | neg find indirectCommunicationLink(Spacecraft, GroundStation); | 59 | neg find indirectCommunicationLink(Spacecraft, GroundStation); |
60 | } | 60 | } |
61 | 61 | ||
62 | //@Constraint(severity = "error", key = {Spacecraft}, message = "UNSAT") | ||
63 | //pattern unsat_linkToGroundStation(Spacecraft : Spacecraft) { | ||
64 | // ConstellationMission.groundStationNetwork(Mission, GroundStation); | ||
65 | // ConstellationMission.spacecraft(Mission, Spacecraft); | ||
66 | // find indirectCommunicationLink(Spacecraft, GroundStation); | ||
67 | //} | ||
68 | |||
69 | @Constraint(severity = "error", key = {Mission}, message = "UNSAT") | ||
70 | pattern unsat_linkToGroundStation(Mission : InterferometryMission) { | ||
71 | InterferometryMission(Mission); | ||
72 | neg find noLinkToGroundStation(_); | ||
73 | } | ||
74 | |||
62 | @Constraint(severity = "error", key = {Spacecraft}, | 75 | @Constraint(severity = "error", key = {Spacecraft}, |
63 | message = "Spacecraft has no potential communication path to the ground station.") | 76 | message = "Spacecraft has no potential communication path to the ground station.") |
64 | pattern noPotentialLinkToGroundStation(Spacecraft : Spacecraft) { | 77 | pattern noPotentialLinkToGroundStation(Spacecraft : Spacecraft) { |
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph/plugin.xml b/Domains/hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph/plugin.xml index 7bf4a20b..d4ab204e 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph/plugin.xml +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph/plugin.xml | |||
@@ -8,6 +8,7 @@ | |||
8 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.entryInRegion"/> | 8 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.entryInRegion"/> |
9 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.noEntryInRegion"/> | 9 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.noEntryInRegion"/> |
10 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.multipleEntryInRegion"/> | 10 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.multipleEntryInRegion"/> |
11 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.unsat_multipleEntryInRegion"/> | ||
11 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.transition"/> | 12 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.transition"/> |
12 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.transitionFrom"/> | 13 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.transitionFrom"/> |
13 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.transitionTo"/> | 14 | <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.transitionTo"/> |
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph/queries/hu/bme/mit/inf/dslreasoner/partialsnapshot_mavo/yakindu/patterns.vql b/Domains/hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph/queries/hu/bme/mit/inf/dslreasoner/partialsnapshot_mavo/yakindu/patterns.vql index 98a10cde..49fb5b2f 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph/queries/hu/bme/mit/inf/dslreasoner/partialsnapshot_mavo/yakindu/patterns.vql +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph/queries/hu/bme/mit/inf/dslreasoner/partialsnapshot_mavo/yakindu/patterns.vql | |||
@@ -22,6 +22,12 @@ pattern multipleEntryInRegion(r : Region) { | |||
22 | e1 != e2; | 22 | e1 != e2; |
23 | } | 23 | } |
24 | 24 | ||
25 | @Constraint(severity="error", message="error", key = {sct}) | ||
26 | pattern unsat_multipleEntryInRegion(sct : Statechart) { | ||
27 | Statechart(sct); | ||
28 | neg find multipleEntryInRegion(_); | ||
29 | } | ||
30 | |||
25 | pattern transition(t : Transition, src : Vertex, trg : Vertex) { | 31 | pattern transition(t : Transition, src : Vertex, trg : Vertex) { |
26 | Transition.source(t, src); | 32 | Transition.source(t, src); |
27 | Transition.target(t, trg); | 33 | Transition.target(t, trg); |
@@ -197,6 +203,11 @@ pattern SynchronizedRegionDoesNotHaveMultipleRegions(s : Synchronization, v : Ve | |||
197 | neg find hasMultipleRegions(c); | 203 | neg find hasMultipleRegions(c); |
198 | } | 204 | } |
199 | 205 | ||
206 | //@Constraint(severity="error", message="error", key = {sct}) | ||
207 | //pattern unsat_SynchronizedRegionDoesNotHaveMultipleRegions(sct : Statechart) { | ||
208 | // Statechart(sct); | ||
209 | // neg find SynchronizedRegionDoesNotHaveMultipleRegions(_, _); | ||
210 | //} | ||
200 | 211 | ||
201 | pattern hasMultipleRegions(composite: CompositeElement) { | 212 | pattern hasMultipleRegions(composite: CompositeElement) { |
202 | CompositeElement.regions(composite,region1); | 213 | CompositeElement.regions(composite,region1); |
diff --git a/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/.classpath b/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/.classpath index de68b5f7..25b7f16f 100644 --- a/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/.classpath +++ b/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/.classpath | |||
@@ -1,11 +1,15 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <classpath> | 2 | <classpath> |
3 | <classpathentry kind="src" path="xtend-gen"/> | 3 | <classpathentry kind="src" path="xtend-gen"/> |
4 | <classpathentry kind="src" path="queries"/> | 4 | <classpathentry kind="src" path="queries"/> |
5 | <classpathentry kind="src" path="vql-gen"/> | 5 | <classpathentry kind="src" path="vql-gen"/> |
6 | <classpathentry exported="true" kind="lib" path="lib/alloy4.2_2015-02-22.jar"/> | 6 | <classpathentry exported="true" kind="lib" path="lib/alloy4.2_2015-02-22.jar"/> |
7 | <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> | 7 | <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> |
8 | <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> | 8 | <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> |
9 | <classpathentry kind="src" path="src"/> | 9 | <classpathentry kind="src" path="src"> |
10 | <classpathentry kind="output" path="bin"/> | 10 | <attributes> |
11 | </classpath> | 11 | <attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="hu.bme.mit.inf.dlsreasoner.alloy.reasoner/lib"/> |
12 | </attributes> | ||
13 | </classpathentry> | ||
14 | <classpathentry kind="output" path="bin"/> | ||
15 | </classpath> | ||
diff --git a/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/META-INF/MANIFEST.MF b/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/META-INF/MANIFEST.MF index b944302b..75581def 100644 --- a/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/META-INF/MANIFEST.MF +++ b/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/META-INF/MANIFEST.MF | |||
@@ -20,7 +20,8 @@ Require-Bundle: com.google.guava, | |||
20 | org.eclipse.viatra.query.runtime.base.itc;bundle-version="1.3.0", | 20 | org.eclipse.viatra.query.runtime.base.itc;bundle-version="1.3.0", |
21 | hu.bme.mit.inf.dslreasoner.ecore2logic;bundle-version="1.0.0", | 21 | hu.bme.mit.inf.dslreasoner.ecore2logic;bundle-version="1.0.0", |
22 | org.eclipse.viatra.query.runtime;bundle-version="2.0.0" | 22 | org.eclipse.viatra.query.runtime;bundle-version="2.0.0" |
23 | Import-Package: org.apache.log4j;version="1.2.15" | ||
24 | Automatic-Module-Name: hu.bme.mit.inf.dlsreasoner.alloy.reasoner | ||
25 | Bundle-ActivationPolicy: lazy | ||
26 | Bundle-RequiredExecutionEnvironment: JavaSE-1.8 | 23 | Bundle-RequiredExecutionEnvironment: JavaSE-1.8 |
24 | Bundle-ActivationPolicy: lazy | ||
25 | Bundle-NativeCode: libminisat.so;osname=Linux;processor=x86_64 | ||
26 | Automatic-Module-Name: hu.bme.mit.inf.dlsreasoner.alloy.reasoner | ||
27 | Import-Package: org.apache.log4j;version="1.2.15" | ||
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/statecoder/NeighbourhoodBasedStateCoderFactory.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/statecoder/NeighbourhoodBasedStateCoderFactory.xtend index 5e442ca7..f19ac30f 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/statecoder/NeighbourhoodBasedStateCoderFactory.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/statecoder/NeighbourhoodBasedStateCoderFactory.xtend | |||
@@ -59,15 +59,14 @@ class NeighbourhoodBasedPartialInterpretationStateCoder<ModelRep, NodeRep> exten | |||
59 | override doCreateActivationCode(IPatternMatch match) { | 59 | override doCreateActivationCode(IPatternMatch match) { |
60 | val size = match.specification.parameters.size | 60 | val size = match.specification.parameters.size |
61 | val res = new ArrayList(size) | 61 | val res = new ArrayList(size) |
62 | var int index = 0 | ||
63 | var int equivalenceHash = 0 | 62 | var int equivalenceHash = 0 |
64 | val prime = 31 | 63 | val prime = 31 |
65 | 64 | ||
66 | while (index < size) { | 65 | for (var int index = 0; index < size; index++) { |
67 | res.add(getCode(match.get(index))) | 66 | val matchArgument = match.get(index) |
68 | index++ | 67 | res.add(getCode(matchArgument)) |
69 | for (var i = 0; i < index; i++) { | 68 | for (var i = 0; i < index; i++) { |
70 | val number = if (match.get(index) === match.get(i)) { | 69 | val number = if (matchArgument === match.get(i)) { |
71 | 1 | 70 | 1 |
72 | } else { | 71 | } else { |
73 | 0 | 72 | 0 |
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasonerConfiguration.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasonerConfiguration.xtend index 6f38d261..c0a71c85 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasonerConfiguration.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasonerConfiguration.xtend | |||
@@ -55,7 +55,7 @@ class ViatraReasonerConfiguration extends LogicSolverConfiguration { | |||
55 | */ | 55 | */ |
56 | public var SearchSpaceConstraint searchSpaceConstraints = new SearchSpaceConstraint | 56 | public var SearchSpaceConstraint searchSpaceConstraints = new SearchSpaceConstraint |
57 | 57 | ||
58 | public var ScopePropagatorStrategy scopePropagatorStrategy = new ScopePropagatorStrategy.Polyhedral( | 58 | public var ScopePropagatorStrategy scopePropagatorStrategy = ScopePropagatorStrategy.Polyhedral( |
59 | PolyhedralScopePropagatorConstraints.Relational, PolyhedralScopePropagatorSolver.Clp) | 59 | PolyhedralScopePropagatorConstraints.Relational, PolyhedralScopePropagatorSolver.Clp) |
60 | 60 | ||
61 | public var List<LinearTypeConstraintHint> hints = newArrayList | 61 | public var List<LinearTypeConstraintHint> hints = newArrayList |
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/configs/FAM_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json b/Tests/hu.bme.mit.inf.dslreasoner.run/configs/FAM_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json deleted file mode 100644 index 1e2d4dd4..00000000 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/configs/FAM_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | { | ||
2 | "inputPath": "initialModels", | ||
3 | "outputPath": "outputModels", | ||
4 | "timeout": 1200, | ||
5 | "saveModels": true, | ||
6 | "warmupIterations": 0, | ||
7 | "iterations": 5, | ||
8 | "domain": "FAM", | ||
9 | "scope": "none", | ||
10 | "sizes": [500], | ||
11 | "solver": "ViatraSolver", | ||
12 | "scopePropagator": "polyhedral", | ||
13 | "propagatedConstraints": "hints", | ||
14 | "polyhedronSolver": "Clp", | ||
15 | "scopeHeuristics": "polyhedral" | ||
16 | } | ||
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/configs/Yakindu.json b/Tests/hu.bme.mit.inf.dslreasoner.run/configs/Yakindu.json new file mode 100644 index 00000000..b602f2fe --- /dev/null +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/configs/Yakindu.json | |||
@@ -0,0 +1,13 @@ | |||
1 | { | ||
2 | "inputPath": "initialModels", | ||
3 | "outputPath": "outputModels", | ||
4 | "timeout": 300, | ||
5 | "saveModels": true, | ||
6 | "saveTemporaryFiles": false, | ||
7 | "warmupIterations": 0, | ||
8 | "iterations": 30, | ||
9 | "domain": "Yakindu", | ||
10 | "scope": "unsat", | ||
11 | "sizes": [20], | ||
12 | "solver": "AlloySolver" | ||
13 | } | ||
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/configs/Yakindu_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json b/Tests/hu.bme.mit.inf.dslreasoner.run/configs/Yakindu_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json deleted file mode 100644 index b4d51684..00000000 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/configs/Yakindu_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | { | ||
2 | "inputPath": "initialModels", | ||
3 | "outputPath": "outputModels", | ||
4 | "timeout": 1200, | ||
5 | "saveModels": false, | ||
6 | "saveTemporaryFiles": true, | ||
7 | "warmupIterations": 0, | ||
8 | "iterations": 5, | ||
9 | "domain": "Yakindu", | ||
10 | "scope": "none", | ||
11 | "sizes": [100], | ||
12 | "solver": "ViatraSolver", | ||
13 | "scopePropagator": "polyhedral", | ||
14 | "propagatedConstraints": "hints", | ||
15 | "polyhedronSolver": "Clp", | ||
16 | "scopeHeuristic": "polyhedral" | ||
17 | } | ||
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/configs/fs_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json b/Tests/hu.bme.mit.inf.dslreasoner.run/configs/ecore.json index a7e29a22..36fb0ea2 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/configs/fs_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/configs/ecore.json | |||
@@ -1,13 +1,14 @@ | |||
1 | { | 1 | { |
2 | "inputPath": "initialModels", | 2 | "inputPath": "initialModels", |
3 | "outputPath": "outputModels", | 3 | "outputPath": "outputModels", |
4 | "timeout": 1200, | 4 | "timeout": 300, |
5 | "saveModels": true, | 5 | "saveModels": true, |
6 | "warmupIterations": 1, | 6 | "saveTemporaryFiles": false, |
7 | "warmupIterations": 0, | ||
7 | "iterations": 1, | 8 | "iterations": 1, |
8 | "domain": "fs", | 9 | "domain": "ecoreUnsat", |
9 | "scope": "none", | 10 | "scope": "none", |
10 | "sizes": [50, 100, 150, 200, 250, 300, 350, 400, 450, 500], | 11 | "sizes": [5, 10, 20, 30, 40, 50], |
11 | "solver": "ViatraSolver", | 12 | "solver": "ViatraSolver", |
12 | "scopePropagator": "polyhedral", | 13 | "scopePropagator": "polyhedral", |
13 | "propagatedConstraints": "hints", | 14 | "propagatedConstraints": "hints", |
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/configs/ecore_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json b/Tests/hu.bme.mit.inf.dslreasoner.run/configs/satellite.json index 72e97957..16abb5d0 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/configs/ecore_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/configs/satellite.json | |||
@@ -1,13 +1,14 @@ | |||
1 | { | 1 | { |
2 | "inputPath": "initialModels", | 2 | "inputPath": "initialModels", |
3 | "outputPath": "outputModels", | 3 | "outputPath": "outputModels", |
4 | "timeout": 1200, | 4 | "timeout": 300, |
5 | "saveModels": true, | 5 | "saveModels": true, |
6 | "saveTemporaryFiles": false, | ||
6 | "warmupIterations": 0, | 7 | "warmupIterations": 0, |
7 | "iterations": 5, | 8 | "iterations": 30, |
8 | "domain": "ecore", | 9 | "domain": "satelliteUnsat", |
9 | "scope": "quantiles", | 10 | "scope": "none", |
10 | "sizes": [50], | 11 | "sizes": [10], |
11 | "solver": "ViatraSolver", | 12 | "solver": "ViatraSolver", |
12 | "scopePropagator": "polyhedral", | 13 | "scopePropagator": "polyhedral", |
13 | "propagatedConstraints": "hints", | 14 | "propagatedConstraints": "hints", |
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/configs/satellite_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json b/Tests/hu.bme.mit.inf.dslreasoner.run/configs/satellite_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json deleted file mode 100644 index d5469948..00000000 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/configs/satellite_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | { | ||
2 | "inputPath": "initialModels", | ||
3 | "outputPath": "outputModels", | ||
4 | "timeout": 120, | ||
5 | "saveModels": true, | ||
6 | "saveTemporaryFiles": true, | ||
7 | "warmupIterations": 0, | ||
8 | "iterations": 1, | ||
9 | "domain": "Yakindu", | ||
10 | "scope": "quantiles", | ||
11 | "sizes": [10, 20, 30, 40, 50, 60, 70, 80, 90, 100], | ||
12 | "solver": "ViatraSolver", | ||
13 | "scopePropagator": "polyhedral", | ||
14 | "propagatedConstraints": "hints", | ||
15 | "polyhedronSolver": "Clp", | ||
16 | "scopeHeuristic": "polyhedral" | ||
17 | } | ||
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/MetamodelLoader.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/MetamodelLoader.xtend index 1be03eed..bf9ca274 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/MetamodelLoader.xtend +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/MetamodelLoader.xtend | |||
@@ -40,6 +40,8 @@ class TypeQuantiles { | |||
40 | } | 40 | } |
41 | 41 | ||
42 | abstract class MetamodelLoader { | 42 | abstract class MetamodelLoader { |
43 | public static val UNSAT_PREFIX = "unsat_" | ||
44 | |||
43 | protected val ReasonerWorkspace workspace | 45 | protected val ReasonerWorkspace workspace |
44 | 46 | ||
45 | new(ReasonerWorkspace workspace) { | 47 | new(ReasonerWorkspace workspace) { |
@@ -61,6 +63,10 @@ abstract class MetamodelLoader { | |||
61 | def Map<String, TypeQuantiles> getTypeQuantiles() { | 63 | def Map<String, TypeQuantiles> getTypeQuantiles() { |
62 | emptyMap | 64 | emptyMap |
63 | } | 65 | } |
66 | |||
67 | def Map<String, TypeQuantiles> getUnsatTypeQuantiles() { | ||
68 | throw new UnsupportedOperationException("This domain has no type quantiles for unsatisfiable problems") | ||
69 | } | ||
64 | 70 | ||
65 | def List<LinearTypeConstraintHint> getHints(Ecore2Logic ecore2Logic, Ecore2Logic_Trace trace) { | 71 | def List<LinearTypeConstraintHint> getHints(Ecore2Logic ecore2Logic, Ecore2Logic_Trace trace) { |
66 | emptyList | 72 | emptyList |
@@ -136,9 +142,15 @@ class YakinduLoader extends MetamodelLoader { | |||
136 | public static val patternsWithComplexStates = #["outgoingFromExit", "outgoingFromFinal", "choiceHasNoOutgoing", | 142 | public static val patternsWithComplexStates = #["outgoingFromExit", "outgoingFromFinal", "choiceHasNoOutgoing", |
137 | "choiceHasNoIncoming"] | 143 | "choiceHasNoIncoming"] |
138 | 144 | ||
145 | val boolean satisfiable | ||
146 | |||
139 | new(ReasonerWorkspace workspace) { | 147 | new(ReasonerWorkspace workspace) { |
148 | this(workspace, true) | ||
149 | } | ||
150 | |||
151 | new(ReasonerWorkspace workspace, boolean satisfiable) { | ||
140 | super(workspace) | 152 | super(workspace) |
141 | YakindummPackage.eINSTANCE.eClass | 153 | this.satisfiable = satisfiable |
142 | } | 154 | } |
143 | 155 | ||
144 | def setUseSynchronization(boolean useSynchronization) { | 156 | def setUseSynchronization(boolean useSynchronization) { |
@@ -173,6 +185,8 @@ class YakinduLoader extends MetamodelLoader { | |||
173 | useSynchInThisLoad || !patternsWithSynchronization.exists[spec.fullyQualifiedName.endsWith(it)] | 185 | useSynchInThisLoad || !patternsWithSynchronization.exists[spec.fullyQualifiedName.endsWith(it)] |
174 | ].filter [ spec | | 186 | ].filter [ spec | |
175 | useComplexStates || !patternsWithComplexStates.exists[spec.fullyQualifiedName.endsWith(it)] | 187 | useComplexStates || !patternsWithComplexStates.exists[spec.fullyQualifiedName.endsWith(it)] |
188 | ].filter [ | ||
189 | !satisfiable || !it.simpleName.startsWith(UNSAT_PREFIX) | ||
176 | ].toList | 190 | ].toList |
177 | val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name == "Constraint"]].toSet | 191 | val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name == "Constraint"]].toSet |
178 | val derivedFeatures = new LinkedHashMap | 192 | val derivedFeatures = new LinkedHashMap |
@@ -213,6 +227,19 @@ class YakinduLoader extends MetamodelLoader { | |||
213 | "Transition" -> new TypeQuantiles(0.581632653061224, 0.645161290322581) | 227 | "Transition" -> new TypeQuantiles(0.581632653061224, 0.645161290322581) |
214 | } | 228 | } |
215 | } | 229 | } |
230 | |||
231 | override getUnsatTypeQuantiles() { | ||
232 | #{ | ||
233 | "Choice" -> new TypeQuantiles(0.118279569892473, 0.154020979020979), | ||
234 | "Entry" -> new TypeQuantiles(0.2, 0.4), | ||
235 | "Exit" -> new TypeQuantiles(0, 0), | ||
236 | "FinalState" -> new TypeQuantiles(0, 0), | ||
237 | "Region" -> new TypeQuantiles(0.0294117647058824, 0.0633258678611422), | ||
238 | "State" -> new TypeQuantiles(0.132023636740618, 0.175925925925926), | ||
239 | // "Statechart" -> new TypeQuantiles(0.00961538461538462, 0.010752688172043), | ||
240 | "Transition" -> new TypeQuantiles(0.581632653061224, 0.645161290322581) | ||
241 | } | ||
242 | } | ||
216 | 243 | ||
217 | override getHints(Ecore2Logic ecore2Logic, Ecore2Logic_Trace trace) { | 244 | override getHints(Ecore2Logic ecore2Logic, Ecore2Logic_Trace trace) { |
218 | #[new SGraphHint(ecore2Logic, trace)] | 245 | #[new SGraphHint(ecore2Logic, trace)] |
@@ -276,9 +303,15 @@ class FileSystemLoader extends MetamodelLoader { | |||
276 | } | 303 | } |
277 | 304 | ||
278 | class EcoreLoader extends MetamodelLoader { | 305 | class EcoreLoader extends MetamodelLoader { |
306 | val boolean satisfiable | ||
279 | 307 | ||
280 | new(ReasonerWorkspace workspace) { | 308 | new(ReasonerWorkspace workspace) { |
309 | this(workspace, true) | ||
310 | } | ||
311 | |||
312 | new(ReasonerWorkspace workspace, boolean satisfiable) { | ||
281 | super(workspace) | 313 | super(workspace) |
314 | this.satisfiable = satisfiable | ||
282 | } | 315 | } |
283 | 316 | ||
284 | override loadMetamodel() { | 317 | override loadMetamodel() { |
@@ -307,7 +340,12 @@ class EcoreLoader extends MetamodelLoader { | |||
307 | override loadQueries(EcoreMetamodelDescriptor metamodel) { | 340 | override loadQueries(EcoreMetamodelDescriptor metamodel) { |
308 | val patternGroup = Ecore.instance | 341 | val patternGroup = Ecore.instance |
309 | val patterns = patternGroup.specifications.toList | 342 | val patterns = patternGroup.specifications.toList |
310 | val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name == "Constraint"]].toSet | 343 | val allWfPatterns = patterns.filter[it.allAnnotations.exists[it.name == "Constraint"]].toSet |
344 | val wfPatterns = if (satisfiable) { | ||
345 | allWfPatterns.filter[!it.simpleName.startsWith(UNSAT_PREFIX)].toSet | ||
346 | } else { | ||
347 | allWfPatterns | ||
348 | } | ||
311 | val derivedFeatures = new HashMap | 349 | val derivedFeatures = new HashMap |
312 | return new ViatraQuerySetDescriptor( | 350 | return new ViatraQuerySetDescriptor( |
313 | patterns, | 351 | patterns, |
@@ -346,9 +384,15 @@ class EcoreLoader extends MetamodelLoader { | |||
346 | } | 384 | } |
347 | 385 | ||
348 | class SatelliteLoader extends MetamodelLoader { | 386 | class SatelliteLoader extends MetamodelLoader { |
387 | val boolean satisfiable | ||
349 | 388 | ||
350 | new(ReasonerWorkspace workspace) { | 389 | new(ReasonerWorkspace workspace) { |
390 | this(workspace, true) | ||
391 | } | ||
392 | |||
393 | new(ReasonerWorkspace workspace, boolean satisfiable) { | ||
351 | super(workspace) | 394 | super(workspace) |
395 | this.satisfiable = satisfiable | ||
352 | } | 396 | } |
353 | 397 | ||
354 | override loadMetamodel() { | 398 | override loadMetamodel() { |
@@ -371,7 +415,9 @@ class SatelliteLoader extends MetamodelLoader { | |||
371 | 415 | ||
372 | override loadQueries(EcoreMetamodelDescriptor metamodel) { | 416 | override loadQueries(EcoreMetamodelDescriptor metamodel) { |
373 | val i = SatelliteQueriesAll.instance | 417 | val i = SatelliteQueriesAll.instance |
374 | val patterns = i.specifications.toList | 418 | val patterns = i.specifications.filter [ |
419 | !satisfiable || !it.simpleName.startsWith(UNSAT_PREFIX) | ||
420 | ].toList | ||
375 | val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name == "Constraint"]].toSet | 421 | val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name == "Constraint"]].toSet |
376 | val derivedFeatures = new LinkedHashMap | 422 | val derivedFeatures = new LinkedHashMap |
377 | val res = new ViatraQuerySetDescriptor( | 423 | val res = new ViatraQuerySetDescriptor( |
@@ -404,4 +450,15 @@ class SatelliteLoader extends MetamodelLoader { | |||
404 | } | 450 | } |
405 | } | 451 | } |
406 | 452 | ||
453 | override getUnsatTypeQuantiles() { | ||
454 | #{ | ||
455 | "CubeSat3U" -> new TypeQuantiles(0.1, 0.25), | ||
456 | "CubeSat6U" -> new TypeQuantiles(0.1, 0.25), | ||
457 | "SmallSat" -> new TypeQuantiles(0.1, 0.25), | ||
458 | "UHFCommSubsystem" -> new TypeQuantiles(0.08, 0.1), | ||
459 | "XCommSubsystem" -> new TypeQuantiles(0, 0.1), | ||
460 | "KaCommSubsystem" -> new TypeQuantiles(0, 0.05), | ||
461 | "InterferometryPayload" -> new TypeQuantiles(0.15, 0.25) | ||
462 | } | ||
463 | } | ||
407 | } | 464 | } |
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/script/MeasurementScript.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/script/MeasurementScript.xtend index 56a65091..f842afb5 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/script/MeasurementScript.xtend +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/script/MeasurementScript.xtend | |||
@@ -29,19 +29,26 @@ class MeasurementScript { | |||
29 | enum Domain { | 29 | enum Domain { |
30 | fs, | 30 | fs, |
31 | ecore, | 31 | ecore, |
32 | ecoreUnsat, | ||
32 | Yakindu, | 33 | Yakindu, |
34 | YakinduUnsat, | ||
33 | FAM, | 35 | FAM, |
34 | satellite | 36 | satellite, |
37 | satelliteUnsat | ||
35 | } | 38 | } |
36 | 39 | ||
37 | enum Scope { | 40 | enum Scope { |
38 | none, | 41 | none, |
39 | quantiles | 42 | quantiles, |
43 | upperOnly, | ||
44 | unsat, | ||
45 | exactly | ||
40 | } | 46 | } |
41 | 47 | ||
42 | enum Solver { | 48 | enum Solver { |
43 | ViatraSolver, | 49 | ViatraSolver, |
44 | AlloySolver | 50 | AlloySolver, |
51 | AlloyMiniSat | ||
45 | } | 52 | } |
46 | 53 | ||
47 | enum ScopePropagator { | 54 | enum ScopePropagator { |
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/script/MeasurementScriptRunner.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/script/MeasurementScriptRunner.xtend index 1127f01a..973c3d13 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/script/MeasurementScriptRunner.xtend +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/script/MeasurementScriptRunner.xtend | |||
@@ -54,6 +54,7 @@ import org.eclipse.viatra.query.patternlanguage.emf.EMFPatternLanguageStandalone | |||
54 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngineOptions | 54 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngineOptions |
55 | import org.eclipse.viatra.query.runtime.rete.matcher.ReteBackendFactory | 55 | import org.eclipse.viatra.query.runtime.rete.matcher.ReteBackendFactory |
56 | import org.eclipse.xtend.lib.annotations.Data | 56 | import org.eclipse.xtend.lib.annotations.Data |
57 | import hu.bme.mit.inf.dlsreasoner.alloy.reasoner.AlloyBackendSolver | ||
57 | 58 | ||
58 | class MeasurementScriptRunner { | 59 | class MeasurementScriptRunner { |
59 | static val MODEL_SIZE_GAP = 0 | 60 | static val MODEL_SIZE_GAP = 0 |
@@ -75,9 +76,12 @@ class MeasurementScriptRunner { | |||
75 | metamodelLoader = switch (script.domain) { | 76 | metamodelLoader = switch (script.domain) { |
76 | case fs: new FileSystemLoader(inputWorkspace) | 77 | case fs: new FileSystemLoader(inputWorkspace) |
77 | case ecore: new EcoreLoader(inputWorkspace) | 78 | case ecore: new EcoreLoader(inputWorkspace) |
79 | case ecoreUnsat: new EcoreLoader(inputWorkspace, false) | ||
78 | case Yakindu: new YakinduLoader(inputWorkspace) => [useSynchronization = false; useComplexStates = true] | 80 | case Yakindu: new YakinduLoader(inputWorkspace) => [useSynchronization = false; useComplexStates = true] |
81 | case YakinduUnsat: new YakinduLoader(inputWorkspace, false) => [useSynchronization = false; useComplexStates = true] | ||
79 | case FAM: new FAMLoader(inputWorkspace) | 82 | case FAM: new FAMLoader(inputWorkspace) |
80 | case satellite: new SatelliteLoader(inputWorkspace) | 83 | case satellite: new SatelliteLoader(inputWorkspace) |
84 | case satelliteUnsat: new SatelliteLoader(inputWorkspace, false) | ||
81 | default: throw new IllegalArgumentException("Unsupported domain: " + script.domain) | 85 | default: throw new IllegalArgumentException("Unsupported domain: " + script.domain) |
82 | } | 86 | } |
83 | } | 87 | } |
@@ -191,15 +195,17 @@ class MeasurementScriptRunner { | |||
191 | config | 195 | config |
192 | } | 196 | } |
193 | 197 | ||
194 | private def createAlloyConfig() { | 198 | private def createAlloyConfig(AlloyBackendSolver backendSolver) { |
195 | val config = new AlloySolverConfiguration | 199 | val config = new AlloySolverConfiguration |
200 | config.solver = backendSolver | ||
196 | config | 201 | config |
197 | } | 202 | } |
198 | 203 | ||
199 | private def createConfig(int modelSize) { | 204 | private def createConfig(int modelSize) { |
200 | val config = switch (solver : script.solver) { | 205 | val config = switch (solver : script.solver) { |
201 | case ViatraSolver: createViatraConfig() | 206 | case ViatraSolver: createViatraConfig() |
202 | case AlloySolver: createAlloyConfig() | 207 | case AlloySolver: createAlloyConfig(AlloyBackendSolver.SAT4J) |
208 | case AlloyMiniSat: createAlloyConfig(AlloyBackendSolver.MiniSatJNI) | ||
203 | default: throw new IllegalArgumentException("Unknown solver: " + solver) | 209 | default: throw new IllegalArgumentException("Unknown solver: " + solver) |
204 | } | 210 | } |
205 | config.solutionScope.numberOfRequiredSolutions = 1 | 211 | config.solutionScope.numberOfRequiredSolutions = 1 |
@@ -243,7 +249,8 @@ class MeasurementScriptRunner { | |||
243 | 249 | ||
244 | val solver = switch (solver : script.solver) { | 250 | val solver = switch (solver : script.solver) { |
245 | case ViatraSolver: new ViatraReasoner | 251 | case ViatraSolver: new ViatraReasoner |
246 | case AlloySolver: new AlloySolver | 252 | case AlloySolver, |
253 | case AlloyMiniSat: new AlloySolver | ||
247 | default: throw new IllegalArgumentException("Unknown solver: " + solver) | 254 | default: throw new IllegalArgumentException("Unknown solver: " + solver) |
248 | } | 255 | } |
249 | val result = solver.solve(problem, config, outputWorkspace) | 256 | val result = solver.solve(problem, config, outputWorkspace) |
@@ -284,14 +291,31 @@ class MeasurementScriptRunner { | |||
284 | } else { | 291 | } else { |
285 | val numberOfKnownElements = knownElements.values.flatten.toSet.size | 292 | val numberOfKnownElements = knownElements.values.flatten.toSet.size |
286 | val newElementCount = modelSize - numberOfKnownElements | 293 | val newElementCount = modelSize - numberOfKnownElements |
287 | config.typeScopes.minNewElements = newElementCount | 294 | switch (script.scope) { |
288 | config.typeScopes.maxNewElements = newElementCount + MODEL_SIZE_GAP | 295 | case upperOnly: |
296 | config.typeScopes.maxNewElements = newElementCount + MODEL_SIZE_GAP | ||
297 | case exactly: { | ||
298 | config.typeScopes.minNewElements = newElementCount | ||
299 | config.typeScopes.maxNewElements = newElementCount | ||
300 | } | ||
301 | default: { | ||
302 | config.typeScopes.minNewElements = newElementCount | ||
303 | config.typeScopes.maxNewElements = newElementCount + MODEL_SIZE_GAP | ||
304 | } | ||
305 | } | ||
289 | } | 306 | } |
290 | switch (script.scope) { | 307 | switch (scope : script.scope) { |
291 | case none: | 308 | case none, |
309 | case exactly: | ||
292 | return | 310 | return |
293 | case quantiles: { | 311 | case quantiles, |
294 | val quantiles = metamodelLoader.typeQuantiles | 312 | case unsat, |
313 | case upperOnly: { | ||
314 | val quantiles = if (scope == Scope.unsat) { | ||
315 | metamodelLoader.unsatTypeQuantiles | ||
316 | } else { | ||
317 | metamodelLoader.typeQuantiles | ||
318 | } | ||
295 | for (eClassInScope : eClassMapper.allClassesInScope(trace)) { | 319 | for (eClassInScope : eClassMapper.allClassesInScope(trace)) { |
296 | val quantile = quantiles.get(eClassInScope.name) | 320 | val quantile = quantiles.get(eClassInScope.name) |
297 | if (quantile !== null) { | 321 | if (quantile !== null) { |
@@ -301,7 +325,9 @@ class MeasurementScriptRunner { | |||
301 | val lowCount = Math.floor(modelSize * quantile.low) as int | 325 | val lowCount = Math.floor(modelSize * quantile.low) as int |
302 | val highCount = Math.ceil((modelSize + MODEL_SIZE_GAP) * quantile.high) as int | 326 | val highCount = Math.ceil((modelSize + MODEL_SIZE_GAP) * quantile.high) as int |
303 | // println('''«type.name» «lowCount» «highCount»''') | 327 | // println('''«type.name» «lowCount» «highCount»''') |
304 | config.typeScopes.minNewElementsByType.put(type, Math.max(lowCount - currentCount, 0)) | 328 | if (script.scope != Scope.upperOnly) { |
329 | config.typeScopes.minNewElementsByType.put(type, Math.max(lowCount - currentCount, 0)) | ||
330 | } | ||
305 | config.typeScopes.maxNewElementsByType.put(type, highCount - currentCount) | 331 | config.typeScopes.maxNewElementsByType.put(type, highCount - currentCount) |
306 | } | 332 | } |
307 | } | 333 | } |