diff options
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.java | 305 |
1 files changed, 255 insertions, 50 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 f32a7172..16db7053 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 | |||
@@ -13,6 +13,7 @@ import hu.bme.mit.inf.dslreasoner.ecore2logic.ecore2logicannotations.Ecore2logic | |||
13 | import hu.bme.mit.inf.dslreasoner.ecore2logic.ecore2logicannotations.Ecore2logicannotationsPackage; | 13 | import hu.bme.mit.inf.dslreasoner.ecore2logic.ecore2logicannotations.Ecore2logicannotationsPackage; |
14 | import hu.bme.mit.inf.dslreasoner.ecore2logic.ecore2logicannotations.InverseRelationAssertion; | 14 | import hu.bme.mit.inf.dslreasoner.ecore2logic.ecore2logicannotations.InverseRelationAssertion; |
15 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.DocumentationLevel; | 15 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.DocumentationLevel; |
16 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicModelInterpretation; | ||
16 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicProblemBuilder; | 17 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicProblemBuilder; |
17 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.SolutionScope; | 18 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.SolutionScope; |
18 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.TracedOutput; | 19 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.TracedOutput; |
@@ -32,6 +33,7 @@ import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem; | |||
32 | import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicproblemPackage; | 33 | import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicproblemPackage; |
33 | import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.LogicResult; | 34 | import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.LogicResult; |
34 | import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.ModelResult; | 35 | import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.ModelResult; |
36 | import hu.bme.mit.inf.dslreasoner.logic2ecore.Logic2Ecore; | ||
35 | import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2Logic; | 37 | import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2Logic; |
36 | import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2LogicConfiguration; | 38 | import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2LogicConfiguration; |
37 | import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2LogicTrace; | 39 | import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2LogicTrace; |
@@ -50,10 +52,15 @@ import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.par | |||
50 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.RelationLink; | 52 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.RelationLink; |
51 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretation2Gml; | 53 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretation2Gml; |
52 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretationVisualisation; | 54 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretationVisualisation; |
55 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.CostObjectiveConfiguration; | ||
56 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.CostObjectiveElementConfiguration; | ||
53 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.DebugConfiguration; | 57 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.DebugConfiguration; |
54 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.StateCoderStrategy; | 58 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.StateCoderStrategy; |
55 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner; | 59 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner; |
56 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration; | 60 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration; |
61 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.dse.PartialModelAsLogicInterpretation; | ||
62 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.optimization.ObjectiveKind; | ||
63 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.optimization.ObjectiveThreshold; | ||
57 | import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualiser; | 64 | import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualiser; |
58 | import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace; | 65 | import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace; |
59 | import java.util.Collections; | 66 | import java.util.Collections; |
@@ -64,10 +71,31 @@ import java.util.function.Predicate; | |||
64 | import modes3.Modes3Factory; | 71 | import modes3.Modes3Factory; |
65 | import modes3.Modes3ModelRoot; | 72 | import modes3.Modes3ModelRoot; |
66 | import modes3.Modes3Package; | 73 | import modes3.Modes3Package; |
74 | import modes3.queries.CloseTrains_step_2; | ||
75 | import modes3.queries.CloseTrains_step_3; | ||
76 | import modes3.queries.CloseTrains_step_4; | ||
77 | import modes3.queries.CloseTrains_step_5; | ||
78 | import modes3.queries.CloseTrains_step_6; | ||
79 | import modes3.queries.CloseTrains_step_7; | ||
80 | import modes3.queries.EndOfSiding_step_2; | ||
81 | import modes3.queries.EndOfSiding_step_3; | ||
82 | import modes3.queries.EndOfSiding_step_4; | ||
83 | import modes3.queries.EndOfSiding_step_5; | ||
84 | import modes3.queries.MisalignedTurnout_step_2; | ||
85 | import modes3.queries.MisalignedTurnout_step_3; | ||
86 | import modes3.queries.MisalignedTurnout_step_4; | ||
87 | import modes3.queries.MisalignedTurnout_step_5; | ||
67 | import modes3.queries.Modes3Queries; | 88 | import modes3.queries.Modes3Queries; |
89 | import modes3.queries.TrainLocations_step_2; | ||
90 | import modes3.queries.TrainLocations_step_3; | ||
91 | import modes3.run.CloseTrainsObjectiveHint; | ||
92 | import modes3.run.EndOfSidingObjectiveHint; | ||
93 | import modes3.run.MisalignedTurnoutObjectiveHint; | ||
68 | import modes3.run.Modes3TypeScopeHint; | 94 | import modes3.run.Modes3TypeScopeHint; |
69 | import modes3.run.Modes3UnitPropagationGenerator; | 95 | import modes3.run.Modes3UnitPropagationGenerator; |
96 | import modes3.run.TrainLocationsObjectiveHint; | ||
70 | import org.eclipse.emf.common.util.EList; | 97 | import org.eclipse.emf.common.util.EList; |
98 | import org.eclipse.emf.common.util.TreeIterator; | ||
71 | import org.eclipse.emf.common.util.URI; | 99 | import org.eclipse.emf.common.util.URI; |
72 | import org.eclipse.emf.ecore.EAttribute; | 100 | import org.eclipse.emf.ecore.EAttribute; |
73 | import org.eclipse.emf.ecore.EClass; | 101 | import org.eclipse.emf.ecore.EClass; |
@@ -102,6 +130,10 @@ public class Modes3ModelGenerator { | |||
102 | private enum MonitoringQuery { | 130 | private enum MonitoringQuery { |
103 | closeTrains, | 131 | closeTrains, |
104 | 132 | ||
133 | trainLocations, | ||
134 | |||
135 | endOfSiding, | ||
136 | |||
105 | misalignedTurnout; | 137 | misalignedTurnout; |
106 | } | 138 | } |
107 | 139 | ||
@@ -183,8 +215,9 @@ public class Modes3ModelGenerator { | |||
183 | ObjectExtensions.<Map<Type, Integer>>operator_doubleArrow( | 215 | ObjectExtensions.<Map<Type, Integer>>operator_doubleArrow( |
184 | it_1.minNewElementsByType, _function_4); | 216 | it_1.minNewElementsByType, _function_4); |
185 | final Procedure1<Map<Type, Integer>> _function_5 = (Map<Type, Integer> it_2) -> { | 217 | final Procedure1<Map<Type, Integer>> _function_5 = (Map<Type, Integer> it_2) -> { |
186 | it_2.put(this.ecore2Logic.TypeofEClass(metamodelLogic.getTrace(), Modes3Package.eINSTANCE.getTrain()), Integer.valueOf(5)); | 218 | it_2.put(this.ecore2Logic.TypeofEClass(metamodelLogic.getTrace(), Modes3Package.eINSTANCE.getTrain()), Integer.valueOf((this.modelSize / 5))); |
187 | it_2.put(this.ecore2Logic.TypeofEClass(metamodelLogic.getTrace(), Modes3Package.eINSTANCE.getTurnout()), Integer.valueOf(5)); | 219 | it_2.put(this.ecore2Logic.TypeofEClass(metamodelLogic.getTrace(), Modes3Package.eINSTANCE.getTurnout()), Integer.valueOf((this.modelSize / 5))); |
220 | it_2.put(this.ecore2Logic.TypeofEClass(metamodelLogic.getTrace(), Modes3Package.eINSTANCE.getSimpleSegment()), Integer.valueOf(((3 * this.modelSize) / 5))); | ||
188 | }; | 221 | }; |
189 | ObjectExtensions.<Map<Type, Integer>>operator_doubleArrow( | 222 | ObjectExtensions.<Map<Type, Integer>>operator_doubleArrow( |
190 | it_1.maxNewElementsByType, _function_5); | 223 | it_1.maxNewElementsByType, _function_5); |
@@ -196,7 +229,9 @@ public class Modes3ModelGenerator { | |||
196 | }; | 229 | }; |
197 | ObjectExtensions.<SolutionScope>operator_doubleArrow( | 230 | ObjectExtensions.<SolutionScope>operator_doubleArrow( |
198 | it.solutionScope, _function_4); | 231 | it.solutionScope, _function_4); |
199 | it.scopeWeight = 5; | 232 | CostObjectiveConfiguration _objective = this.getObjective(this.ecore2Logic, metamodelLogic.getTrace()); |
233 | it.costObjectives.add(_objective); | ||
234 | it.scopeWeight = 6; | ||
200 | it.nameNewElements = false; | 235 | it.nameNewElements = false; |
201 | it.typeInferenceMethod = TypeInferenceMethod.PreliminaryAnalysis; | 236 | it.typeInferenceMethod = TypeInferenceMethod.PreliminaryAnalysis; |
202 | it.stateCoderStrategy = StateCoderStrategy.PairwiseNeighbourhood; | 237 | it.stateCoderStrategy = StateCoderStrategy.PairwiseNeighbourhood; |
@@ -224,80 +259,103 @@ public class Modes3ModelGenerator { | |||
224 | URI _xifexpression = null; | 259 | URI _xifexpression = null; |
225 | if ((solution instanceof ModelResult)) { | 260 | if ((solution instanceof ModelResult)) { |
226 | InputOutput.<String>println("Saving generated solutions"); | 261 | InputOutput.<String>println("Saving generated solutions"); |
227 | final EList<Object> representations = ((ModelResult)solution).getRepresentation(); | 262 | final Logic2Ecore logic2Ecore = new Logic2Ecore(this.ecore2Logic); |
228 | int _size = representations.size(); | 263 | final List<? extends LogicModelInterpretation> interpretations = this.solver.getInterpretations(((ModelResult)solution)); |
264 | int _size = interpretations.size(); | ||
229 | ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _size, true); | 265 | ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _size, true); |
230 | for (final Integer representationIndex : _doubleDotLessThan) { | 266 | for (final Integer representationIndex : _doubleDotLessThan) { |
231 | { | 267 | { |
232 | final Object representation = representations.get((representationIndex).intValue()); | 268 | final LogicModelInterpretation interpretation = interpretations.get((representationIndex).intValue()); |
233 | final int representationNumber = ((representationIndex).intValue() + 1); | 269 | final int representationNumber = ((representationIndex).intValue() + 1); |
234 | if ((representation instanceof PartialInterpretation)) { | 270 | if ((interpretation instanceof PartialModelAsLogicInterpretation)) { |
271 | final PartialInterpretation representation = ((PartialModelAsLogicInterpretation)interpretation).getPartialInterpretation(); | ||
235 | StringConcatenation _builder_1 = new StringConcatenation(); | 272 | StringConcatenation _builder_1 = new StringConcatenation(); |
236 | _builder_1.append("solution"); | 273 | _builder_1.append("solution"); |
237 | _builder_1.append(representationNumber); | 274 | _builder_1.append(representationNumber); |
238 | _builder_1.append(".partialinterpretation"); | 275 | _builder_1.append(".partialinterpretation"); |
239 | workspace.writeModel(((EObject)representation), _builder_1.toString()); | 276 | workspace.writeModel(representation, _builder_1.toString()); |
240 | final PartialInterpretation2Gml partialInterpretation2GML = new PartialInterpretation2Gml(); | 277 | final PartialInterpretation2Gml partialInterpretation2GML = new PartialInterpretation2Gml(); |
241 | final String gml = partialInterpretation2GML.transform(((PartialInterpretation)representation)); | 278 | final String gml = partialInterpretation2GML.transform(representation); |
242 | StringConcatenation _builder_2 = new StringConcatenation(); | 279 | StringConcatenation _builder_2 = new StringConcatenation(); |
243 | _builder_2.append("solution"); | 280 | _builder_2.append("solution"); |
244 | _builder_2.append(representationNumber); | 281 | _builder_2.append(representationNumber); |
245 | _builder_2.append(".gml"); | 282 | _builder_2.append(".gml"); |
246 | workspace.writeText(_builder_2.toString(), gml); | 283 | workspace.writeText(_builder_2.toString(), gml); |
247 | int _size_1 = ((PartialInterpretation)representation).getNewElements().size(); | 284 | final EObject model = logic2Ecore.transformInterpretation(interpretation, metamodelLogic.getTrace()); |
248 | boolean _lessThan = (_size_1 < 160); | 285 | final TreeIterator<EObject> iterator = model.eAllContents(); |
249 | if (_lessThan) { | 286 | int id = 0; |
250 | if ((representation instanceof PartialInterpretation)) { | 287 | while (iterator.hasNext()) { |
251 | final Function1<Type, Boolean> _function_3 = (Type it) -> { | 288 | { |
289 | final EObject obj = iterator.next(); | ||
290 | final Function1<EAttribute, Boolean> _function_3 = (EAttribute it) -> { | ||
252 | String _name_2 = it.getName(); | 291 | String _name_2 = it.getName(); |
253 | return Boolean.valueOf(Objects.equal(_name_2, "Modes3ModelRoot class DefinedPart")); | 292 | return Boolean.valueOf(Objects.equal(_name_2, "id")); |
254 | }; | 293 | }; |
255 | Type _findFirst = IterableExtensions.<Type>findFirst(((PartialInterpretation)representation).getProblem().getTypes(), _function_3); | 294 | final EAttribute idFeature = IterableExtensions.<EAttribute>findFirst(obj.eClass().getEAllAttributes(), _function_3); |
256 | final TypeDefinition rootType = ((TypeDefinition) _findFirst); | 295 | if ((idFeature != null)) { |
257 | final Function1<PartialComplexTypeInterpretation, Boolean> _function_4 = (PartialComplexTypeInterpretation it) -> { | 296 | obj.eSet(idFeature, Integer.valueOf(id)); |
258 | String _name_2 = it.getInterpretationOf().getName(); | 297 | id++; |
259 | return Boolean.valueOf(Objects.equal(_name_2, "Modes3ModelRoot class")); | ||
260 | }; | ||
261 | final PartialComplexTypeInterpretation rootIntepretation = IterableExtensions.<PartialComplexTypeInterpretation>findFirst(Iterables.<PartialComplexTypeInterpretation>filter(((PartialInterpretation)representation).getPartialtypeinterpratation(), | ||
262 | PartialComplexTypeInterpretation.class), _function_4); | ||
263 | rootIntepretation.getElements().removeAll(rootType.getElements()); | ||
264 | ((PartialInterpretation)representation).getProblem().getElements().removeAll(rootType.getElements()); | ||
265 | EList<PartialRelationInterpretation> _partialrelationinterpretation = ((PartialInterpretation)representation).getPartialrelationinterpretation(); | ||
266 | for (final PartialRelationInterpretation relationInterpretation : _partialrelationinterpretation) { | ||
267 | final Predicate<RelationLink> _function_5 = (RelationLink link) -> { | ||
268 | boolean _xifexpression_1 = false; | ||
269 | if ((link instanceof BinaryElementRelationLink)) { | ||
270 | _xifexpression_1 = (rootType.getElements().contains(((BinaryElementRelationLink)link).getParam1()) || rootType.getElements().contains(((BinaryElementRelationLink)link).getParam2())); | ||
271 | } else { | ||
272 | _xifexpression_1 = false; | ||
273 | } | ||
274 | return _xifexpression_1; | ||
275 | }; | ||
276 | relationInterpretation.getRelationlinks().removeIf(_function_5); | ||
277 | } | 298 | } |
278 | rootType.getElements().clear(); | ||
279 | } | 299 | } |
300 | } | ||
301 | StringConcatenation _builder_3 = new StringConcatenation(); | ||
302 | _builder_3.append("solution"); | ||
303 | _builder_3.append(representationNumber); | ||
304 | _builder_3.append(".modes3"); | ||
305 | workspace.writeModel(model, _builder_3.toString()); | ||
306 | int _size_1 = representation.getNewElements().size(); | ||
307 | boolean _lessThan = (_size_1 < 160); | ||
308 | if (_lessThan) { | ||
309 | final Function1<Type, Boolean> _function_3 = (Type it) -> { | ||
310 | String _name_2 = it.getName(); | ||
311 | return Boolean.valueOf(Objects.equal(_name_2, "Modes3ModelRoot class DefinedPart")); | ||
312 | }; | ||
313 | Type _findFirst = IterableExtensions.<Type>findFirst(representation.getProblem().getTypes(), _function_3); | ||
314 | final TypeDefinition rootType = ((TypeDefinition) _findFirst); | ||
315 | final Function1<PartialComplexTypeInterpretation, Boolean> _function_4 = (PartialComplexTypeInterpretation it) -> { | ||
316 | String _name_2 = it.getInterpretationOf().getName(); | ||
317 | return Boolean.valueOf(Objects.equal(_name_2, "Modes3ModelRoot class")); | ||
318 | }; | ||
319 | final PartialComplexTypeInterpretation rootIntepretation = IterableExtensions.<PartialComplexTypeInterpretation>findFirst(Iterables.<PartialComplexTypeInterpretation>filter(representation.getPartialtypeinterpratation(), | ||
320 | PartialComplexTypeInterpretation.class), _function_4); | ||
321 | rootIntepretation.getElements().removeAll(rootType.getElements()); | ||
322 | representation.getProblem().getElements().removeAll(rootType.getElements()); | ||
323 | EList<PartialRelationInterpretation> _partialrelationinterpretation = representation.getPartialrelationinterpretation(); | ||
324 | for (final PartialRelationInterpretation relationInterpretation : _partialrelationinterpretation) { | ||
325 | final Predicate<RelationLink> _function_5 = (RelationLink link) -> { | ||
326 | boolean _xifexpression_1 = false; | ||
327 | if ((link instanceof BinaryElementRelationLink)) { | ||
328 | _xifexpression_1 = (rootType.getElements().contains(((BinaryElementRelationLink)link).getParam1()) || | ||
329 | rootType.getElements().contains(((BinaryElementRelationLink)link).getParam2())); | ||
330 | } else { | ||
331 | _xifexpression_1 = false; | ||
332 | } | ||
333 | return _xifexpression_1; | ||
334 | }; | ||
335 | relationInterpretation.getRelationlinks().removeIf(_function_5); | ||
336 | } | ||
337 | rootType.getElements().clear(); | ||
280 | final GraphvizVisualiser visualiser = new GraphvizVisualiser(); | 338 | final GraphvizVisualiser visualiser = new GraphvizVisualiser(); |
281 | final PartialInterpretationVisualisation visualisation = visualiser.visualiseConcretization(((PartialInterpretation)representation)); | 339 | final PartialInterpretationVisualisation visualisation = visualiser.visualiseConcretization(representation); |
282 | StringConcatenation _builder_3 = new StringConcatenation(); | 340 | StringConcatenation _builder_4 = new StringConcatenation(); |
283 | _builder_3.append("solution"); | 341 | _builder_4.append("solution"); |
284 | _builder_3.append(representationNumber); | 342 | _builder_4.append(representationNumber); |
285 | _builder_3.append(".png"); | 343 | _builder_4.append(".png"); |
286 | visualisation.writeToFile(workspace, _builder_3.toString()); | 344 | visualisation.writeToFile(workspace, _builder_4.toString()); |
287 | } | 345 | } |
288 | } else { | 346 | } else { |
289 | StringConcatenation _builder_4 = new StringConcatenation(); | 347 | StringConcatenation _builder_5 = new StringConcatenation(); |
290 | _builder_4.append("solution"); | 348 | _builder_5.append("solution"); |
291 | _builder_4.append(representationNumber); | 349 | _builder_5.append(representationNumber); |
292 | _builder_4.append(".txt"); | 350 | _builder_5.append(".txt"); |
293 | workspace.writeText(_builder_4.toString(), representation.toString()); | 351 | workspace.writeText(_builder_5.toString(), interpretation.toString()); |
294 | } | 352 | } |
295 | } | 353 | } |
296 | } | 354 | } |
297 | } else { | 355 | } else { |
298 | URI _xblockexpression_1 = null; | 356 | URI _xblockexpression_1 = null; |
299 | { | 357 | { |
300 | InputOutput.<String>println("Failed to solver problem"); | 358 | InputOutput.<String>println("Failed to solve problem"); |
301 | final LogicProblem partial = logic.getOutput(); | 359 | final LogicProblem partial = logic.getOutput(); |
302 | _xblockexpression_1 = workspace.writeModel(partial, "solution.partialinterpretation"); | 360 | _xblockexpression_1 = workspace.writeModel(partial, "solution.partialinterpretation"); |
303 | } | 361 | } |
@@ -354,6 +412,153 @@ public class Modes3ModelGenerator { | |||
354 | return _xblockexpression; | 412 | return _xblockexpression; |
355 | } | 413 | } |
356 | 414 | ||
415 | public CostObjectiveConfiguration getObjective(final Ecore2Logic ecore2Logic, final Ecore2Logic_Trace ecore2LogicTrace) { | ||
416 | CostObjectiveConfiguration _costObjectiveConfiguration = new CostObjectiveConfiguration(); | ||
417 | final Procedure1<CostObjectiveConfiguration> _function = (CostObjectiveConfiguration it) -> { | ||
418 | final Modes3ModelGenerator.MonitoringQuery monitoringQuery = this.monitoringQuery; | ||
419 | if (monitoringQuery != null) { | ||
420 | switch (monitoringQuery) { | ||
421 | case closeTrains: | ||
422 | CostObjectiveElementConfiguration _costObjectiveElementConfiguration = new CostObjectiveElementConfiguration(); | ||
423 | final Procedure1<CostObjectiveElementConfiguration> _function_1 = (CostObjectiveElementConfiguration it_1) -> { | ||
424 | it_1.patternQualifiedName = CloseTrains_step_2.instance().getFullyQualifiedName(); | ||
425 | it_1.weight = ((14 + 53) + 11); | ||
426 | }; | ||
427 | CostObjectiveElementConfiguration _doubleArrow = ObjectExtensions.<CostObjectiveElementConfiguration>operator_doubleArrow(_costObjectiveElementConfiguration, _function_1); | ||
428 | it.elements.add(_doubleArrow); | ||
429 | CostObjectiveElementConfiguration _costObjectiveElementConfiguration_1 = new CostObjectiveElementConfiguration(); | ||
430 | final Procedure1<CostObjectiveElementConfiguration> _function_2 = (CostObjectiveElementConfiguration it_1) -> { | ||
431 | it_1.patternQualifiedName = CloseTrains_step_3.instance().getFullyQualifiedName(); | ||
432 | it_1.weight = (21 + 14); | ||
433 | }; | ||
434 | CostObjectiveElementConfiguration _doubleArrow_1 = ObjectExtensions.<CostObjectiveElementConfiguration>operator_doubleArrow(_costObjectiveElementConfiguration_1, _function_2); | ||
435 | it.elements.add(_doubleArrow_1); | ||
436 | CostObjectiveElementConfiguration _costObjectiveElementConfiguration_2 = new CostObjectiveElementConfiguration(); | ||
437 | final Procedure1<CostObjectiveElementConfiguration> _function_3 = (CostObjectiveElementConfiguration it_1) -> { | ||
438 | it_1.patternQualifiedName = CloseTrains_step_4.instance().getFullyQualifiedName(); | ||
439 | it_1.weight = (((14 + 44) + 14) + 9); | ||
440 | }; | ||
441 | CostObjectiveElementConfiguration _doubleArrow_2 = ObjectExtensions.<CostObjectiveElementConfiguration>operator_doubleArrow(_costObjectiveElementConfiguration_2, _function_3); | ||
442 | it.elements.add(_doubleArrow_2); | ||
443 | CostObjectiveElementConfiguration _costObjectiveElementConfiguration_3 = new CostObjectiveElementConfiguration(); | ||
444 | final Procedure1<CostObjectiveElementConfiguration> _function_4 = (CostObjectiveElementConfiguration it_1) -> { | ||
445 | it_1.patternQualifiedName = CloseTrains_step_5.instance().getFullyQualifiedName(); | ||
446 | it_1.weight = ((14 + 41) + 11); | ||
447 | }; | ||
448 | CostObjectiveElementConfiguration _doubleArrow_3 = ObjectExtensions.<CostObjectiveElementConfiguration>operator_doubleArrow(_costObjectiveElementConfiguration_3, _function_4); | ||
449 | it.elements.add(_doubleArrow_3); | ||
450 | CostObjectiveElementConfiguration _costObjectiveElementConfiguration_4 = new CostObjectiveElementConfiguration(); | ||
451 | final Procedure1<CostObjectiveElementConfiguration> _function_5 = (CostObjectiveElementConfiguration it_1) -> { | ||
452 | it_1.patternQualifiedName = CloseTrains_step_6.instance().getFullyQualifiedName(); | ||
453 | it_1.weight = 27; | ||
454 | }; | ||
455 | CostObjectiveElementConfiguration _doubleArrow_4 = ObjectExtensions.<CostObjectiveElementConfiguration>operator_doubleArrow(_costObjectiveElementConfiguration_4, _function_5); | ||
456 | it.elements.add(_doubleArrow_4); | ||
457 | CostObjectiveElementConfiguration _costObjectiveElementConfiguration_5 = new CostObjectiveElementConfiguration(); | ||
458 | final Procedure1<CostObjectiveElementConfiguration> _function_6 = (CostObjectiveElementConfiguration it_1) -> { | ||
459 | it_1.patternQualifiedName = CloseTrains_step_7.instance().getFullyQualifiedName(); | ||
460 | it_1.weight = 48; | ||
461 | }; | ||
462 | CostObjectiveElementConfiguration _doubleArrow_5 = ObjectExtensions.<CostObjectiveElementConfiguration>operator_doubleArrow(_costObjectiveElementConfiguration_5, _function_6); | ||
463 | it.elements.add(_doubleArrow_5); | ||
464 | CloseTrainsObjectiveHint _closeTrainsObjectiveHint = new CloseTrainsObjectiveHint(ecore2Logic, ecore2LogicTrace); | ||
465 | it.hint = _closeTrainsObjectiveHint; | ||
466 | break; | ||
467 | case trainLocations: | ||
468 | CostObjectiveElementConfiguration _costObjectiveElementConfiguration_6 = new CostObjectiveElementConfiguration(); | ||
469 | final Procedure1<CostObjectiveElementConfiguration> _function_7 = (CostObjectiveElementConfiguration it_1) -> { | ||
470 | it_1.patternQualifiedName = TrainLocations_step_2.instance().getFullyQualifiedName(); | ||
471 | it_1.weight = ((14 + 53) + 11); | ||
472 | }; | ||
473 | CostObjectiveElementConfiguration _doubleArrow_6 = ObjectExtensions.<CostObjectiveElementConfiguration>operator_doubleArrow(_costObjectiveElementConfiguration_6, _function_7); | ||
474 | it.elements.add(_doubleArrow_6); | ||
475 | CostObjectiveElementConfiguration _costObjectiveElementConfiguration_7 = new CostObjectiveElementConfiguration(); | ||
476 | final Procedure1<CostObjectiveElementConfiguration> _function_8 = (CostObjectiveElementConfiguration it_1) -> { | ||
477 | it_1.patternQualifiedName = TrainLocations_step_3.instance().getFullyQualifiedName(); | ||
478 | it_1.weight = 48; | ||
479 | }; | ||
480 | CostObjectiveElementConfiguration _doubleArrow_7 = ObjectExtensions.<CostObjectiveElementConfiguration>operator_doubleArrow(_costObjectiveElementConfiguration_7, _function_8); | ||
481 | it.elements.add(_doubleArrow_7); | ||
482 | TrainLocationsObjectiveHint _trainLocationsObjectiveHint = new TrainLocationsObjectiveHint(ecore2Logic, ecore2LogicTrace); | ||
483 | it.hint = _trainLocationsObjectiveHint; | ||
484 | break; | ||
485 | case misalignedTurnout: | ||
486 | CostObjectiveElementConfiguration _costObjectiveElementConfiguration_8 = new CostObjectiveElementConfiguration(); | ||
487 | final Procedure1<CostObjectiveElementConfiguration> _function_9 = (CostObjectiveElementConfiguration it_1) -> { | ||
488 | it_1.patternQualifiedName = MisalignedTurnout_step_2.instance().getFullyQualifiedName(); | ||
489 | it_1.weight = ((14 + 53) + 11); | ||
490 | }; | ||
491 | CostObjectiveElementConfiguration _doubleArrow_8 = ObjectExtensions.<CostObjectiveElementConfiguration>operator_doubleArrow(_costObjectiveElementConfiguration_8, _function_9); | ||
492 | it.elements.add(_doubleArrow_8); | ||
493 | CostObjectiveElementConfiguration _costObjectiveElementConfiguration_9 = new CostObjectiveElementConfiguration(); | ||
494 | final Procedure1<CostObjectiveElementConfiguration> _function_10 = (CostObjectiveElementConfiguration it_1) -> { | ||
495 | it_1.patternQualifiedName = MisalignedTurnout_step_3.instance().getFullyQualifiedName(); | ||
496 | it_1.weight = 108; | ||
497 | }; | ||
498 | CostObjectiveElementConfiguration _doubleArrow_9 = ObjectExtensions.<CostObjectiveElementConfiguration>operator_doubleArrow(_costObjectiveElementConfiguration_9, _function_10); | ||
499 | it.elements.add(_doubleArrow_9); | ||
500 | CostObjectiveElementConfiguration _costObjectiveElementConfiguration_10 = new CostObjectiveElementConfiguration(); | ||
501 | final Procedure1<CostObjectiveElementConfiguration> _function_11 = (CostObjectiveElementConfiguration it_1) -> { | ||
502 | it_1.patternQualifiedName = MisalignedTurnout_step_4.instance().getFullyQualifiedName(); | ||
503 | it_1.weight = 27; | ||
504 | }; | ||
505 | CostObjectiveElementConfiguration _doubleArrow_10 = ObjectExtensions.<CostObjectiveElementConfiguration>operator_doubleArrow(_costObjectiveElementConfiguration_10, _function_11); | ||
506 | it.elements.add(_doubleArrow_10); | ||
507 | CostObjectiveElementConfiguration _costObjectiveElementConfiguration_11 = new CostObjectiveElementConfiguration(); | ||
508 | final Procedure1<CostObjectiveElementConfiguration> _function_12 = (CostObjectiveElementConfiguration it_1) -> { | ||
509 | it_1.patternQualifiedName = MisalignedTurnout_step_5.instance().getFullyQualifiedName(); | ||
510 | it_1.weight = 48; | ||
511 | }; | ||
512 | CostObjectiveElementConfiguration _doubleArrow_11 = ObjectExtensions.<CostObjectiveElementConfiguration>operator_doubleArrow(_costObjectiveElementConfiguration_11, _function_12); | ||
513 | it.elements.add(_doubleArrow_11); | ||
514 | MisalignedTurnoutObjectiveHint _misalignedTurnoutObjectiveHint = new MisalignedTurnoutObjectiveHint(ecore2Logic, ecore2LogicTrace); | ||
515 | it.hint = _misalignedTurnoutObjectiveHint; | ||
516 | break; | ||
517 | case endOfSiding: | ||
518 | CostObjectiveElementConfiguration _costObjectiveElementConfiguration_12 = new CostObjectiveElementConfiguration(); | ||
519 | final Procedure1<CostObjectiveElementConfiguration> _function_13 = (CostObjectiveElementConfiguration it_1) -> { | ||
520 | it_1.patternQualifiedName = EndOfSiding_step_2.instance().getFullyQualifiedName(); | ||
521 | it_1.weight = ((14 + 53) + 11); | ||
522 | }; | ||
523 | CostObjectiveElementConfiguration _doubleArrow_12 = ObjectExtensions.<CostObjectiveElementConfiguration>operator_doubleArrow(_costObjectiveElementConfiguration_12, _function_13); | ||
524 | it.elements.add(_doubleArrow_12); | ||
525 | CostObjectiveElementConfiguration _costObjectiveElementConfiguration_13 = new CostObjectiveElementConfiguration(); | ||
526 | final Procedure1<CostObjectiveElementConfiguration> _function_14 = (CostObjectiveElementConfiguration it_1) -> { | ||
527 | it_1.patternQualifiedName = EndOfSiding_step_3.instance().getFullyQualifiedName(); | ||
528 | it_1.weight = (21 + 14); | ||
529 | }; | ||
530 | CostObjectiveElementConfiguration _doubleArrow_13 = ObjectExtensions.<CostObjectiveElementConfiguration>operator_doubleArrow(_costObjectiveElementConfiguration_13, _function_14); | ||
531 | it.elements.add(_doubleArrow_13); | ||
532 | CostObjectiveElementConfiguration _costObjectiveElementConfiguration_14 = new CostObjectiveElementConfiguration(); | ||
533 | final Procedure1<CostObjectiveElementConfiguration> _function_15 = (CostObjectiveElementConfiguration it_1) -> { | ||
534 | it_1.patternQualifiedName = EndOfSiding_step_4.instance().getFullyQualifiedName(); | ||
535 | it_1.weight = (((((((14 + 35) + 21) + 15) + 14) + 21) + 15) + 11); | ||
536 | }; | ||
537 | CostObjectiveElementConfiguration _doubleArrow_14 = ObjectExtensions.<CostObjectiveElementConfiguration>operator_doubleArrow(_costObjectiveElementConfiguration_14, _function_15); | ||
538 | it.elements.add(_doubleArrow_14); | ||
539 | CostObjectiveElementConfiguration _costObjectiveElementConfiguration_15 = new CostObjectiveElementConfiguration(); | ||
540 | final Procedure1<CostObjectiveElementConfiguration> _function_16 = (CostObjectiveElementConfiguration it_1) -> { | ||
541 | it_1.patternQualifiedName = EndOfSiding_step_5.instance().getFullyQualifiedName(); | ||
542 | it_1.weight = 48; | ||
543 | }; | ||
544 | CostObjectiveElementConfiguration _doubleArrow_15 = ObjectExtensions.<CostObjectiveElementConfiguration>operator_doubleArrow(_costObjectiveElementConfiguration_15, _function_16); | ||
545 | it.elements.add(_doubleArrow_15); | ||
546 | EndOfSidingObjectiveHint _endOfSidingObjectiveHint = new EndOfSidingObjectiveHint(ecore2Logic, ecore2LogicTrace); | ||
547 | it.hint = _endOfSidingObjectiveHint; | ||
548 | break; | ||
549 | default: | ||
550 | throw new IllegalArgumentException(("Unknown monitoring query: " + this.monitoringQuery)); | ||
551 | } | ||
552 | } else { | ||
553 | throw new IllegalArgumentException(("Unknown monitoring query: " + this.monitoringQuery)); | ||
554 | } | ||
555 | it.kind = ObjectiveKind.HIGHER_IS_BETTER; | ||
556 | it.threshold = ObjectiveThreshold.NO_THRESHOLD; | ||
557 | it.findExtremum = true; | ||
558 | }; | ||
559 | return ObjectExtensions.<CostObjectiveConfiguration>operator_doubleArrow(_costObjectiveConfiguration, _function); | ||
560 | } | ||
561 | |||
357 | public static Object init() { | 562 | public static Object init() { |
358 | Object _xblockexpression = null; | 563 | Object _xblockexpression = null; |
359 | { | 564 | { |