aboutsummaryrefslogtreecommitdiffstats
path: root/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/Modes3ModelGenerator.java
diff options
context:
space:
mode:
Diffstat (limited to 'Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/Modes3ModelGenerator.java')
-rw-r--r--Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/Modes3ModelGenerator.java56
1 files changed, 34 insertions, 22 deletions
diff --git a/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/Modes3ModelGenerator.java b/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/Modes3ModelGenerator.java
index c7364257..f32a7172 100644
--- a/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/Modes3ModelGenerator.java
+++ b/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/Modes3ModelGenerator.java
@@ -12,7 +12,9 @@ import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor;
12import hu.bme.mit.inf.dslreasoner.ecore2logic.ecore2logicannotations.Ecore2logicannotationsFactory; 12import hu.bme.mit.inf.dslreasoner.ecore2logic.ecore2logicannotations.Ecore2logicannotationsFactory;
13import hu.bme.mit.inf.dslreasoner.ecore2logic.ecore2logicannotations.Ecore2logicannotationsPackage; 13import hu.bme.mit.inf.dslreasoner.ecore2logic.ecore2logicannotations.Ecore2logicannotationsPackage;
14import hu.bme.mit.inf.dslreasoner.ecore2logic.ecore2logicannotations.InverseRelationAssertion; 14import hu.bme.mit.inf.dslreasoner.ecore2logic.ecore2logicannotations.InverseRelationAssertion;
15import hu.bme.mit.inf.dslreasoner.logic.model.builder.DocumentationLevel;
15import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicProblemBuilder; 16import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicProblemBuilder;
17import hu.bme.mit.inf.dslreasoner.logic.model.builder.SolutionScope;
16import hu.bme.mit.inf.dslreasoner.logic.model.builder.TracedOutput; 18import hu.bme.mit.inf.dslreasoner.logic.model.builder.TracedOutput;
17import hu.bme.mit.inf.dslreasoner.logic.model.builder.TypeScopes; 19import hu.bme.mit.inf.dslreasoner.logic.model.builder.TypeScopes;
18import hu.bme.mit.inf.dslreasoner.logic.model.builder.VariableContext; 20import hu.bme.mit.inf.dslreasoner.logic.model.builder.VariableContext;
@@ -48,6 +50,7 @@ import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.par
48import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.RelationLink; 50import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.RelationLink;
49import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretation2Gml; 51import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretation2Gml;
50import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretationVisualisation; 52import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretationVisualisation;
53import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.DebugConfiguration;
51import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.StateCoderStrategy; 54import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.StateCoderStrategy;
52import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner; 55import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner;
53import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration; 56import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration;
@@ -57,12 +60,13 @@ import java.util.Collections;
57import java.util.List; 60import java.util.List;
58import java.util.Map; 61import java.util.Map;
59import java.util.Set; 62import java.util.Set;
60import java.util.function.Consumer;
61import java.util.function.Predicate; 63import java.util.function.Predicate;
62import modes3.Modes3Factory; 64import modes3.Modes3Factory;
63import modes3.Modes3ModelRoot; 65import modes3.Modes3ModelRoot;
64import modes3.Modes3Package; 66import modes3.Modes3Package;
65import modes3.queries.Modes3Queries; 67import modes3.queries.Modes3Queries;
68import modes3.run.Modes3TypeScopeHint;
69import modes3.run.Modes3UnitPropagationGenerator;
66import org.eclipse.emf.common.util.EList; 70import org.eclipse.emf.common.util.EList;
67import org.eclipse.emf.common.util.URI; 71import org.eclipse.emf.common.util.URI;
68import org.eclipse.emf.ecore.EAttribute; 72import org.eclipse.emf.ecore.EAttribute;
@@ -175,29 +179,47 @@ public class Modes3ModelGenerator {
175 it_1.minNewElements = this.modelSize; 179 it_1.minNewElements = this.modelSize;
176 it_1.maxNewElements = this.modelSize; 180 it_1.maxNewElements = this.modelSize;
177 final Procedure1<Map<Type, Integer>> _function_4 = (Map<Type, Integer> it_2) -> { 181 final Procedure1<Map<Type, Integer>> _function_4 = (Map<Type, Integer> it_2) -> {
178 it_2.put(this.ecore2Logic.TypeofEClass(metamodelLogic.getTrace(), Modes3Package.eINSTANCE.getTurnout()), Integer.valueOf(1));
179 }; 182 };
180 ObjectExtensions.<Map<Type, Integer>>operator_doubleArrow( 183 ObjectExtensions.<Map<Type, Integer>>operator_doubleArrow(
181 it_1.minNewElementsByType, _function_4); 184 it_1.minNewElementsByType, _function_4);
182 final Procedure1<Map<Type, Integer>> _function_5 = (Map<Type, Integer> it_2) -> { 185 final Procedure1<Map<Type, Integer>> _function_5 = (Map<Type, Integer> it_2) -> {
183 it_2.put(this.ecore2Logic.TypeofEClass(metamodelLogic.getTrace(), Modes3Package.eINSTANCE.getTrain()), Integer.valueOf(5)); 186 it_2.put(this.ecore2Logic.TypeofEClass(metamodelLogic.getTrace(), Modes3Package.eINSTANCE.getTrain()), Integer.valueOf(5));
187 it_2.put(this.ecore2Logic.TypeofEClass(metamodelLogic.getTrace(), Modes3Package.eINSTANCE.getTurnout()), Integer.valueOf(5));
184 }; 188 };
185 ObjectExtensions.<Map<Type, Integer>>operator_doubleArrow( 189 ObjectExtensions.<Map<Type, Integer>>operator_doubleArrow(
186 it_1.maxNewElementsByType, _function_5); 190 it_1.maxNewElementsByType, _function_5);
187 }; 191 };
188 ObjectExtensions.<TypeScopes>operator_doubleArrow( 192 ObjectExtensions.<TypeScopes>operator_doubleArrow(
189 it.typeScopes, _function_3); 193 it.typeScopes, _function_3);
190 it.solutionScope.numberOfRequiredSolutions = 1; 194 final Procedure1<SolutionScope> _function_4 = (SolutionScope it_1) -> {
195 it_1.numberOfRequiredSolutions = 1;
196 };
197 ObjectExtensions.<SolutionScope>operator_doubleArrow(
198 it.solutionScope, _function_4);
199 it.scopeWeight = 5;
191 it.nameNewElements = false; 200 it.nameNewElements = false;
192 it.typeInferenceMethod = TypeInferenceMethod.PreliminaryAnalysis; 201 it.typeInferenceMethod = TypeInferenceMethod.PreliminaryAnalysis;
193 it.stateCoderStrategy = StateCoderStrategy.Neighbourhood; 202 it.stateCoderStrategy = StateCoderStrategy.PairwiseNeighbourhood;
194 ScopePropagatorStrategy.Polyhedral _polyhedral = new ScopePropagatorStrategy.Polyhedral( 203 ScopePropagatorStrategy.Polyhedral _polyhedral = new ScopePropagatorStrategy.Polyhedral(
195 PolyhedralScopePropagatorConstraints.Relational, PolyhedralScopePropagatorSolver.Clp); 204 PolyhedralScopePropagatorConstraints.Relational, PolyhedralScopePropagatorSolver.Clp);
196 it.scopePropagatorStrategy = _polyhedral; 205 it.scopePropagatorStrategy = _polyhedral;
197 it.debugConfiguration.partialInterpretatioVisualiser = null; 206 Ecore2Logic_Trace _trace = metamodelLogic.getTrace();
207 Modes3TypeScopeHint _modes3TypeScopeHint = new Modes3TypeScopeHint(this.ecore2Logic, _trace);
208 it.hints.add(_modes3TypeScopeHint);
209 Ecore2Logic_Trace _trace_1 = metamodelLogic.getTrace();
210 Modes3UnitPropagationGenerator _modes3UnitPropagationGenerator = new Modes3UnitPropagationGenerator(this.ecore2Logic, _trace_1);
211 it.unitPropagationPatternGenerators.add(_modes3UnitPropagationGenerator);
212 final Procedure1<DebugConfiguration> _function_5 = (DebugConfiguration it_1) -> {
213 GraphvizVisualiser _graphvizVisualiser = new GraphvizVisualiser();
214 it_1.partialInterpretatioVisualiser = _graphvizVisualiser;
215 };
216 ObjectExtensions.<DebugConfiguration>operator_doubleArrow(
217 it.debugConfiguration, _function_5);
218 it.documentationLevel = DocumentationLevel.NORMAL;
198 }; 219 };
199 final ViatraReasonerConfiguration config = ObjectExtensions.<ViatraReasonerConfiguration>operator_doubleArrow(_viatraReasonerConfiguration, _function_2); 220 final ViatraReasonerConfiguration config = ObjectExtensions.<ViatraReasonerConfiguration>operator_doubleArrow(_viatraReasonerConfiguration, _function_2);
200 final FileSystemWorkspace workspace = new FileSystemWorkspace("output/", ""); 221 final FileSystemWorkspace workspace = new FileSystemWorkspace("output/", "");
222 workspace.writeModel(logic.getOutput(), "problem.logicproblem");
201 final LogicResult solution = this.solver.solve(logic.getOutput(), config, workspace); 223 final LogicResult solution = this.solver.solve(logic.getOutput(), config, workspace);
202 URI _xifexpression = null; 224 URI _xifexpression = null;
203 if ((solution instanceof ModelResult)) { 225 if ((solution instanceof ModelResult)) {
@@ -226,27 +248,23 @@ public class Modes3ModelGenerator {
226 boolean _lessThan = (_size_1 < 160); 248 boolean _lessThan = (_size_1 < 160);
227 if (_lessThan) { 249 if (_lessThan) {
228 if ((representation instanceof PartialInterpretation)) { 250 if ((representation instanceof PartialInterpretation)) {
229 final Consumer<Type> _function_3 = (Type it) -> { 251 final Function1<Type, Boolean> _function_3 = (Type it) -> {
230 InputOutput.<String>println(it.getName());
231 };
232 ((PartialInterpretation)representation).getProblem().getTypes().forEach(_function_3);
233 final Function1<Type, Boolean> _function_4 = (Type it) -> {
234 String _name_2 = it.getName(); 252 String _name_2 = it.getName();
235 return Boolean.valueOf(Objects.equal(_name_2, "Modes3ModelRoot class DefinedPart")); 253 return Boolean.valueOf(Objects.equal(_name_2, "Modes3ModelRoot class DefinedPart"));
236 }; 254 };
237 Type _findFirst = IterableExtensions.<Type>findFirst(((PartialInterpretation)representation).getProblem().getTypes(), _function_4); 255 Type _findFirst = IterableExtensions.<Type>findFirst(((PartialInterpretation)representation).getProblem().getTypes(), _function_3);
238 final TypeDefinition rootType = ((TypeDefinition) _findFirst); 256 final TypeDefinition rootType = ((TypeDefinition) _findFirst);
239 final Function1<PartialComplexTypeInterpretation, Boolean> _function_5 = (PartialComplexTypeInterpretation it) -> { 257 final Function1<PartialComplexTypeInterpretation, Boolean> _function_4 = (PartialComplexTypeInterpretation it) -> {
240 String _name_2 = it.getInterpretationOf().getName(); 258 String _name_2 = it.getInterpretationOf().getName();
241 return Boolean.valueOf(Objects.equal(_name_2, "Modes3ModelRoot class")); 259 return Boolean.valueOf(Objects.equal(_name_2, "Modes3ModelRoot class"));
242 }; 260 };
243 final PartialComplexTypeInterpretation rootIntepretation = IterableExtensions.<PartialComplexTypeInterpretation>findFirst(Iterables.<PartialComplexTypeInterpretation>filter(((PartialInterpretation)representation).getPartialtypeinterpratation(), 261 final PartialComplexTypeInterpretation rootIntepretation = IterableExtensions.<PartialComplexTypeInterpretation>findFirst(Iterables.<PartialComplexTypeInterpretation>filter(((PartialInterpretation)representation).getPartialtypeinterpratation(),
244 PartialComplexTypeInterpretation.class), _function_5); 262 PartialComplexTypeInterpretation.class), _function_4);
245 rootIntepretation.getElements().removeAll(rootType.getElements()); 263 rootIntepretation.getElements().removeAll(rootType.getElements());
246 ((PartialInterpretation)representation).getProblem().getElements().removeAll(rootType.getElements()); 264 ((PartialInterpretation)representation).getProblem().getElements().removeAll(rootType.getElements());
247 EList<PartialRelationInterpretation> _partialrelationinterpretation = ((PartialInterpretation)representation).getPartialrelationinterpretation(); 265 EList<PartialRelationInterpretation> _partialrelationinterpretation = ((PartialInterpretation)representation).getPartialrelationinterpretation();
248 for (final PartialRelationInterpretation relationInterpretation : _partialrelationinterpretation) { 266 for (final PartialRelationInterpretation relationInterpretation : _partialrelationinterpretation) {
249 final Predicate<RelationLink> _function_6 = (RelationLink link) -> { 267 final Predicate<RelationLink> _function_5 = (RelationLink link) -> {
250 boolean _xifexpression_1 = false; 268 boolean _xifexpression_1 = false;
251 if ((link instanceof BinaryElementRelationLink)) { 269 if ((link instanceof BinaryElementRelationLink)) {
252 _xifexpression_1 = (rootType.getElements().contains(((BinaryElementRelationLink)link).getParam1()) || rootType.getElements().contains(((BinaryElementRelationLink)link).getParam2())); 270 _xifexpression_1 = (rootType.getElements().contains(((BinaryElementRelationLink)link).getParam1()) || rootType.getElements().contains(((BinaryElementRelationLink)link).getParam2()));
@@ -255,7 +273,7 @@ public class Modes3ModelGenerator {
255 } 273 }
256 return _xifexpression_1; 274 return _xifexpression_1;
257 }; 275 };
258 relationInterpretation.getRelationlinks().removeIf(_function_6); 276 relationInterpretation.getRelationlinks().removeIf(_function_5);
259 } 277 }
260 rootType.getElements().clear(); 278 rootType.getElements().clear();
261 } 279 }
@@ -349,13 +367,7 @@ public class Modes3ModelGenerator {
349 Viatra2LogicAnnotationsPackage.eINSTANCE.getClass(); 367 Viatra2LogicAnnotationsPackage.eINSTANCE.getClass();
350 Map<String, Object> _extensionToFactoryMap = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap(); 368 Map<String, Object> _extensionToFactoryMap = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap();
351 XMIResourceFactoryImpl _xMIResourceFactoryImpl = new XMIResourceFactoryImpl(); 369 XMIResourceFactoryImpl _xMIResourceFactoryImpl = new XMIResourceFactoryImpl();
352 _extensionToFactoryMap.put("ecore", _xMIResourceFactoryImpl); 370 _xblockexpression = _extensionToFactoryMap.put("*", _xMIResourceFactoryImpl);
353 Map<String, Object> _extensionToFactoryMap_1 = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap();
354 XMIResourceFactoryImpl _xMIResourceFactoryImpl_1 = new XMIResourceFactoryImpl();
355 _extensionToFactoryMap_1.put("logicproblem", _xMIResourceFactoryImpl_1);
356 Map<String, Object> _extensionToFactoryMap_2 = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap();
357 XMIResourceFactoryImpl _xMIResourceFactoryImpl_2 = new XMIResourceFactoryImpl();
358 _xblockexpression = _extensionToFactoryMap_2.put("partialinterpretation", _xMIResourceFactoryImpl_2);
359 } 371 }
360 return _xblockexpression; 372 return _xblockexpression;
361 } 373 }