From 30617bc0afc7eb9ce0e7f703e8b4296749d2c3aa Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Thu, 1 Aug 2019 18:38:43 +0200 Subject: Ensure that experiment runner code compiles --- Tests/hu.bme.mit.inf.dslreasoner.run/.classpath | 21 +++--- .../META-INF/MANIFEST.MF | 5 +- .../dslreasoner/run/DiverseMeasurementRunner.xtend | 13 ++-- .../mit/inf/dslreasoner/run/MetamodelLoader.xtend | 30 ++++---- .../mit/inf/dslreasoner/run/RunMeasurements.xtend | 17 ++--- .../inf/dslreasoner/run/RunModelExtension.xtend | 18 ++--- .../hu/bme/mit/inf/dslreasoner/run/SimpleRun.xtend | 84 ++++++++++------------ .../run/VisualiseAllModelInDirectory.xtend | 12 ++-- 8 files changed, 88 insertions(+), 112 deletions(-) (limited to 'Tests/hu.bme.mit.inf.dslreasoner.run') diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/.classpath b/Tests/hu.bme.mit.inf.dslreasoner.run/.classpath index 29ba3981..e7847821 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/.classpath +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/.classpath @@ -1,9 +1,12 @@ - - - - - - - - - + + + + + + + + + + + + diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/META-INF/MANIFEST.MF b/Tests/hu.bme.mit.inf.dslreasoner.run/META-INF/MANIFEST.MF index e2918491..548d3608 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/META-INF/MANIFEST.MF +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/META-INF/MANIFEST.MF @@ -17,15 +17,12 @@ Require-Bundle: hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlan org.eclipse.viatra.query.tooling.core;bundle-version="1.5.0", org.eclipse.viatra.query.runtime.base.itc;bundle-version="1.5.0", hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner;bundle-version="1.0.0", - org.eclipse.viatra.query.patternlanguage;bundle-version="1.5.0", - org.eclipse.viatra.query.patternlanguage.emf;bundle-version="1.5.0", hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatraquery;bundle-version="1.0.0", org.junit;bundle-version="4.12.0", - hu.bme.mit.inf.dslreasoner.domains.transima.fam;bundle-version="1.0.0", + ModelGenExampleFAM_plugin;bundle-version="1.0.0", hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph;bundle-version="1.0.0", org.eclipse.viatra.dse;bundle-version="0.15.0", hu.bme.mit.inf.dlsreasoner.alloy.reasoner;bundle-version="1.0.0", - hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic;bundle-version="1.0.0", org.eclipse.viatra.query.runtime.localsearch;bundle-version="1.5.0", hu.bme.mit.inf.dslreasoner.logic2ecore;bundle-version="1.0.0", hu.bme.mit.inf.dslreasoner.visualisation;bundle-version="1.0.0", diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/DiverseMeasurementRunner.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/DiverseMeasurementRunner.xtend index daa932fd..e15dbf3f 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/DiverseMeasurementRunner.xtend +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/DiverseMeasurementRunner.xtend @@ -24,7 +24,7 @@ import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.DiversityDescriptor import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.StateCoderStrategy import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration -import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualisation +import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualiser import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace import java.util.LinkedList import java.util.List @@ -32,9 +32,6 @@ import org.eclipse.emf.ecore.EObject import org.eclipse.emf.ecore.resource.Resource import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl import org.eclipse.xtend.lib.annotations.Data -import org.eclipse.viatra.query.runtime.api.IQuerySpecification -import java.util.Set -import java.util.Comparator enum Metamodel { FAM, YakinduWOSynch, Yakindu @@ -187,8 +184,7 @@ class ScenarioRunner { it.runtimeLimit = 300 it.typeScopes.maxNewElements = scenario.size it.typeScopes.minNewElements = scenario.size - it.solutionScope.numberOfRequiredSolution = scenario.number - it.existingQueries = vq.patterns.map[it.internalQueryRepresentation] + it.solutionScope.numberOfRequiredSolutions = scenario.number it.nameNewElements = false it.typeInferenceMethod = TypeInferenceMethod.PreliminaryAnalysis it.searchSpaceConstraints.additionalGlobalConstraints += loader.additionalConstraints @@ -223,9 +219,8 @@ class ScenarioRunner { it.runtimeLimit = 300 it.typeScopes.maxNewElements = scenario.size it.typeScopes.minNewElements = scenario.size - it.solutionScope.numberOfRequiredSolution = scenario.number + it.solutionScope.numberOfRequiredSolutions = scenario.number it.typeScopes.maxNewIntegers = 0 - it.writeToFile=true it.randomise = run-1 ] } @@ -259,7 +254,7 @@ class ScenarioRunner { // ecore2GML.transform(root) // workspace.writeText('''solutionVisualisation«representationNumber».gml''',gml) // - val visualiser = new GraphvizVisualisation + val visualiser = new GraphvizVisualiser val visualisation = visualiser.visualiseConcretization(representation) visualisation.writeToFile(workspace,'''solutionVisualisation«representationNumber»''') 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 43d145d3..34f3c267 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 @@ -1,9 +1,10 @@ package hu.bme.mit.inf.dslreasoner.run -import hu.bme.mit.inf.dslreasomer.domains.transima.fam.FunctionalArchitecture.FunctionalArchitecturePackage +import functionalarchitecture.FunctionalarchitecturePackage +import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Ecore import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.FileSystem import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FilesystemPackage -import hu.bme.mit.inf.dslreasoner.domains.transima.fam.patterns.Pattern +import hu.bme.mit.inf.dslreasoner.domains.transima.fam.FamPatterns import hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph.yakindumm.YakindummPackage import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor import hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.Patterns @@ -12,6 +13,7 @@ import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.ModelGenerationMetho import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ModelGenerationMethodBasedGlobalConstraint import hu.bme.mit.inf.dslreasoner.workspace.ReasonerWorkspace import java.util.Collection +import java.util.HashMap import java.util.LinkedHashMap import java.util.List import java.util.Set @@ -21,14 +23,14 @@ import org.eclipse.emf.ecore.EEnum import org.eclipse.emf.ecore.EEnumLiteral import org.eclipse.emf.ecore.EObject import org.eclipse.emf.ecore.EReference -import org.eclipse.xtext.xbase.lib.Functions.Function1 -import java.util.HashMap import org.eclipse.emf.ecore.EcorePackage -import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Ecore +import org.eclipse.xtext.xbase.lib.Functions.Function1 +import hu.bme.mit.inf.dslreasoner.domains.transima.fam.Type +import hu.bme.mit.inf.dslreasoner.domains.transima.fam.Model abstract class MetamodelLoader { protected val ReasonerWorkspace workspace - public new(ReasonerWorkspace workspace) { + new(ReasonerWorkspace workspace) { this.workspace = workspace } def EcoreMetamodelDescriptor loadMetamodel() @@ -53,7 +55,7 @@ class FAMLoader extends MetamodelLoader{ } override loadMetamodel() { - val package = FunctionalArchitecturePackage.eINSTANCE + val package = FunctionalarchitecturePackage.eINSTANCE val List classes = package.EClassifiers.filter(EClass).toList val List enums = package.EClassifiers.filter(EEnum).toList val List literals = enums.map[ELiterals].flatten.toList @@ -70,12 +72,12 @@ class FAMLoader extends MetamodelLoader{ } override loadQueries(EcoreMetamodelDescriptor metamodel) { - val i = Pattern.instance + val i = FamPatterns.instance val patterns = i.specifications.toList val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name== "Constraint"]].toSet val derivedFeatures = new LinkedHashMap - derivedFeatures.put(i.type,metamodel.attributes.filter[it.name == "type"].head) - derivedFeatures.put(i.model,metamodel.references.filter[it.name == "model"].head) + derivedFeatures.put(Type.instance,metamodel.attributes.filter[it.name == "type"].head) + derivedFeatures.put(Model.instance,metamodel.references.filter[it.name == "model"].head) val res = new ViatraQuerySetDescriptor( patterns, wfPatterns, @@ -92,8 +94,8 @@ class FAMLoader extends MetamodelLoader{ class YakinduLoader extends MetamodelLoader{ - private var useSynchronization = true; - private var useComplexStates = false; + var useSynchronization = true; + var useComplexStates = false; public static val patternsWithSynchronization = #[ "synchHasNoOutgoing", "synchHasNoIncoming", "SynchronizedIncomingInSameRegion", "notSynchronizingStates", "hasMultipleOutgoingTrainsition", "hasMultipleIncomingTrainsition", "SynchronizedRegionsAreNotSiblings", @@ -104,10 +106,10 @@ class YakinduLoader extends MetamodelLoader{ YakindummPackage.eINSTANCE.eClass } - public def setUseSynchronization(boolean useSynchronization) { + def setUseSynchronization(boolean useSynchronization) { this.useSynchronization = useSynchronization } - public def setUseComplexStates(boolean useComplexStates) { + def setUseComplexStates(boolean useComplexStates) { this.useComplexStates = useComplexStates } diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/RunMeasurements.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/RunMeasurements.xtend index 8d96958d..ae810a9b 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/RunMeasurements.xtend +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/RunMeasurements.xtend @@ -25,10 +25,12 @@ import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.TypeInferenceMethod import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.InstanceModel2Logic import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationPackage +import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretation2Gml import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.DiversityDescriptor import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.StateCoderStrategy import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration +import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualiser import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace import java.io.BufferedReader import java.io.InputStreamReader @@ -37,9 +39,6 @@ import org.eclipse.emf.ecore.EObject import org.eclipse.emf.ecore.resource.Resource import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl import org.junit.Test -import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualisation -import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretationSizePrinter -import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretation2Gml enum UseSolver{Viatra, Smt, ViatraWithSmt, Alloy} enum Domain{FAM, Yakindu, FileSystem,Ecore} @@ -129,7 +128,7 @@ class RunMeasurements { val smtConfig = new SmtSolverConfiguration() => [ it.typeScopes.maxNewElements = size it.typeScopes.minNewElements = size - it.solutionScope.numberOfRequiredSolution = number + it.solutionScope.numberOfRequiredSolutions = number it.solverPath = '''"D:/Programs/Z3/4.3/z3.exe"''' ] val solution = this.smtSolver.solve( @@ -142,9 +141,8 @@ class RunMeasurements { val alloyConfig = new AlloySolverConfiguration => [ it.typeScopes.maxNewElements = size it.typeScopes.minNewElements = size - it.solutionScope.numberOfRequiredSolution = number + it.solutionScope.numberOfRequiredSolutions = number it.typeScopes.maxNewIntegers = 0 - it.writeToFile = true ] val solution = this.alloyReasoner.solve( problem, @@ -157,13 +155,12 @@ class RunMeasurements { it.runtimeLimit = 400 it.typeScopes.maxNewElements = size it.typeScopes.minNewElements = size - it.solutionScope.numberOfRequiredSolution = number - it.existingQueries = vq.patterns.map[it.internalQueryRepresentation] + it.solutionScope.numberOfRequiredSolutions = number it.nameNewElements = false it.typeInferenceMethod = TypeInferenceMethod.PreliminaryAnalysis it.searchSpaceConstraints.additionalGlobalConstraints += loader.additionalConstraints it.stateCoderStrategy = StateCoderStrategy::Neighbourhood - it.debugCongiguration.partalInterpretationVisualisationFrequency = 100 + it.debugConfiguration.partalInterpretationVisualisationFrequency = 100 //it.debugCongiguration.partialInterpretatioVisualiser = //new GraphvizVisualisation //new PartialInterpretationSizePrinter @@ -267,7 +264,7 @@ class RunMeasurements { val gml = partialInterpretation2GML.transform(representation) r.workspace.writeText('''solution«representationNumber».gml''',gml) if(representation.newElements.size <160) { - val visualiser = new GraphvizVisualisation + val visualiser = new GraphvizVisualiser val visualisation = visualiser.visualiseConcretization(representation) visualisation.writeToFile(r.workspace,'''solution«representationNumber»''') } diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/RunModelExtension.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/RunModelExtension.xtend index d8f75b89..1b8fe3e9 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/RunModelExtension.xtend +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/RunModelExtension.xtend @@ -30,7 +30,7 @@ import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.DiversityDescriptor import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.StateCoderStrategy import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration -import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualisation +import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualiser import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace import java.io.BufferedReader import java.io.InputStreamReader @@ -44,7 +44,6 @@ import org.eclipse.emf.ecore.resource.Resource import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine import org.eclipse.viatra.query.runtime.emf.EMFScope -import java.lang.invoke.VolatileCallSite enum PartialModelSource { Homeworks, Random } enum ValidationTechique {Alloy, Viatra} @@ -116,7 +115,7 @@ class RunModelExtensionMeasurements { val smtConfig = new SmtSolverConfiguration() => [ it.typeScopes.maxNewElements = size it.typeScopes.minNewElements = size - it.solutionScope.numberOfRequiredSolution = 1 + it.solutionScope.numberOfRequiredSolutions = 1 it.solverPath = '''"D:/Programs/Z3/4.3/z3.exe"''' ] val solution = this.smtSolver.solve( @@ -129,9 +128,8 @@ class RunModelExtensionMeasurements { val alloyConfig = new AlloySolverConfiguration => [ it.typeScopes.maxNewElements = size it.typeScopes.minNewElements = size - it.solutionScope.numberOfRequiredSolution = 1 + it.solutionScope.numberOfRequiredSolutions = 1 it.typeScopes.maxNewIntegers = 0 - it.writeToFile = true ] val solution = this.alloyReasoner.solve( problem, @@ -144,16 +142,12 @@ class RunModelExtensionMeasurements { it.runtimeLimit = 400 it.typeScopes.maxNewElements = size it.typeScopes.minNewElements = size - it.solutionScope.numberOfRequiredSolution = 1 - it.existingQueries = vq.patterns.map[it.internalQueryRepresentation] + it.solutionScope.numberOfRequiredSolutions = 1 it.nameNewElements = false it.typeInferenceMethod = TypeInferenceMethod.PreliminaryAnalysis it.searchSpaceConstraints.additionalGlobalConstraints += loader.additionalConstraints it.stateCoderStrategy = StateCoderStrategy::Neighbourhood - it.debugCongiguration.partalInterpretationVisualisationFrequency = 100 - //it.debugCongiguration.partialInterpretatioVisualiser = - //new GraphvizVisualisation - //new PartialInterpretationSizePrinter + it.debugConfiguration.partalInterpretationVisualisationFrequency = 100 ] viatraConfig.diversityRequirement = diversityRequirement if (solver == UseSolver.Viatra) { @@ -314,7 +308,7 @@ class RunModelExtensionMeasurements { val gml = partialInterpretation2GML.transform(representation) r.workspace.writeText('''solution«representationNumber».gml''',gml) if(representation.newElements.size <160) { - val visualiser = new GraphvizVisualisation + val visualiser = new GraphvizVisualiser val visualisation = visualiser.visualiseConcretization(representation) visualisation.writeToFile(r.workspace,'''solution«representationNumber»''') } diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SimpleRun.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SimpleRun.xtend index 863a91c8..91c46dd6 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SimpleRun.xtend +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SimpleRun.xtend @@ -1,41 +1,39 @@ package hu.bme.mit.inf.dslreasoner.run +import functionalarchitecture.FunctionalarchitecturePackage +import hu.bme.mit.inf.dslreasoner.domains.transima.fam.FamPatterns +import hu.bme.mit.inf.dslreasoner.domains.transima.fam.Model +import hu.bme.mit.inf.dslreasoner.domains.transima.fam.Type +import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic +import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2LogicConfiguration +import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor +import hu.bme.mit.inf.dslreasoner.logic.model.builder.DocumentationLevel +import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicReasoner +import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.LogicResult +import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.ModelResult +import hu.bme.mit.inf.dslreasoner.logic2ecore.Logic2Ecore +import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2Logic +import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2LogicConfiguration +import hu.bme.mit.inf.dslreasoner.viatra2logic.ViatraQuerySetDescriptor +import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.InstanceModel2Logic +import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation +import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretation2Gml +import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner +import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration +import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualiser import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace -import hu.bme.mit.inf.dslreasomer.domains.transima.fam.FunctionalArchitecture.FunctionalArchitecturePackage +import hu.bme.mit.inf.dslreasoner.workspace.ReasonerWorkspace +import java.util.LinkedHashMap +import java.util.LinkedList import java.util.List +import org.eclipse.emf.ecore.EAttribute import org.eclipse.emf.ecore.EClass -import org.eclipse.emf.ecore.EEnumLiteral -import org.eclipse.emf.ecore.EReference import org.eclipse.emf.ecore.EEnum -import org.eclipse.emf.ecore.EAttribute -import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor -import hu.bme.mit.inf.dslreasoner.workspace.ReasonerWorkspace +import org.eclipse.emf.ecore.EEnumLiteral import org.eclipse.emf.ecore.EObject -import java.util.LinkedHashMap -import hu.bme.mit.inf.dslreasoner.viatra2logic.ViatraQuerySetDescriptor -import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic -import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2Logic -import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.InstanceModel2Logic -import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2LogicConfiguration -import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2LogicConfiguration -import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration -import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.TypeInferenceMethod -import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.StateCoderStrategy -import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner -import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.ModelResult -import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation -import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.LogicResult +import org.eclipse.emf.ecore.EReference import org.eclipse.emf.ecore.resource.Resource import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl -import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretation2Gml -import hu.bme.mit.inf.dlsreasoner.alloy.reasoner.AlloySolverConfiguration -import hu.bme.mit.inf.dlsreasoner.alloy.reasoner.AlloySolver -import hu.bme.mit.inf.dslreasoner.logic2ecore.Logic2Ecore -import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicReasoner -import java.util.LinkedList -import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualisation -import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicStructureBuilder -import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicProblemBuilder class SimpleRun { @@ -59,7 +57,7 @@ class SimpleRun { val modelGenerationProblem = ecore2Logic.transformMetamodel(metamodel,new Ecore2LogicConfiguration()) val modelExtensionProblem = instanceModel2Logic.transform(modelGenerationProblem,partialModel) - val validModelExtensionProblem = viatra2Logic.transformQueries(queries,modelGenerationProblem,new Viatra2LogicConfiguration) + val validModelExtensionProblem = viatra2Logic.transformQueries(queries,modelExtensionProblem,new Viatra2LogicConfiguration) val logicProblem = validModelExtensionProblem.output @@ -71,11 +69,10 @@ class SimpleRun { val viatraConfig = new ViatraReasonerConfiguration => [ it.typeScopes.maxNewElements = 40 it.typeScopes.minNewElements = 40 - it.solutionScope.numberOfRequiredSolution = 1 - it.existingQueries = queries.patterns.map[it.internalQueryRepresentation] - it.debugCongiguration.logging = false - it.debugCongiguration.partalInterpretationVisualisationFrequency = 1 - it.debugCongiguration.partialInterpretatioVisualiser = new GraphvizVisualisation + it.solutionScope.numberOfRequiredSolutions = 1 + it.documentationLevel = DocumentationLevel.NONE + it.debugConfiguration.partalInterpretationVisualisationFrequency = 1 + it.debugConfiguration.partialInterpretatioVisualiser = new GraphvizVisualiser ] solution = reasoner.solve(logicProblem,viatraConfig,workspace) /*/ @@ -95,11 +92,6 @@ class SimpleRun { val interpretations = reasoner.getInterpretations(solution as ModelResult) val models = new LinkedList for(interpretation : interpretations) { - val extension b = new LogicStructureBuilder - val extension a = new LogicProblemBuilder - - - val instanceModel = logic2Ecore.transformInterpretation(interpretation,modelGenerationProblem.trace) models+=instanceModel } @@ -108,7 +100,7 @@ class SimpleRun { } def private static loadMetamodel() { - val pckg = FunctionalArchitecturePackage.eINSTANCE + val pckg = FunctionalarchitecturePackage.eINSTANCE val List classes = pckg.EClassifiers.filter(EClass).toList val List enums = pckg.EClassifiers.filter(EEnum).toList val List literals = enums.map[ELiterals].flatten.toList @@ -118,12 +110,12 @@ class SimpleRun { } def private static loadQueries(EcoreMetamodelDescriptor metamodel) { - val i = hu.bme.mit.inf.dslreasoner.domains.transima.fam.patterns.Pattern.instance + val i = FamPatterns.instance val patterns = i.specifications.toList val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name== "Constraint"]].toSet val derivedFeatures = new LinkedHashMap - derivedFeatures.put(i.type,metamodel.attributes.filter[it.name == "type"].head) - derivedFeatures.put(i.model,metamodel.references.filter[it.name == "model"].head) + derivedFeatures.put(Type.instance,metamodel.attributes.filter[it.name == "type"].head) + derivedFeatures.put(Model.instance,metamodel.references.filter[it.name == "model"].head) val res = new ViatraQuerySetDescriptor( patterns, wfPatterns, @@ -160,8 +152,4 @@ class SimpleRun { println("Solution saved and visualised") } } - - def static visualizeSolution() { - - } } \ No newline at end of file diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/VisualiseAllModelInDirectory.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/VisualiseAllModelInDirectory.xtend index 6b74d161..3a100ace 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/VisualiseAllModelInDirectory.xtend +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/VisualiseAllModelInDirectory.xtend @@ -1,16 +1,16 @@ package hu.bme.mit.inf.dslreasoner.run +import hu.bme.mit.inf.dslreasoner.ecore2logic.ecore2logicannotations.Ecore2logicannotationsPackage +import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.LogiclanguagePackage import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicproblemPackage +import hu.bme.mit.inf.dslreasoner.viatra2logic.viatra2logicannotations.Viatra2LogicAnnotationsPackage import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationPackage +import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretation2Gml +import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualiser import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace import java.io.File -import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.LogiclanguagePackage -import hu.bme.mit.inf.dslreasoner.ecore2logic.ecore2logicannotations.Ecore2logicannotationsPackage -import hu.bme.mit.inf.dslreasoner.viatra2logic.viatra2logicannotations.Viatra2LogicAnnotationsPackage import org.eclipse.emf.ecore.resource.Resource -import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretation2Gml -import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualisation import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl class VisualiseAllModelInDirectory { @@ -62,7 +62,7 @@ class VisualiseAllModelInDirectory { } if(!hasPng && model.newElements.size <160) { - val visualiser = new GraphvizVisualisation + val visualiser = new GraphvizVisualiser val visualisation = visualiser.visualiseConcretization(model) visualisation.writeToFile(workspace,fileNameWithoutExtension) println('''«fileNameWithoutExtension».png''') -- cgit v1.2.3-54-g00ecf From 4d5cf58cbf0d104dd03b6bcc6d155448995b861b Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Thu, 1 Aug 2019 20:07:31 +0200 Subject: Trying to run generator in measurement environment --- .../functionalarchitecture/FunctionType.java | 3 ++ .../functionalarchitecture/FunctionalData.java | 6 +-- .../functionalarchitecture/FunctionalElement.java | 6 +-- .../impl/FAMTerminatorImpl.java | 2 + .../functionalarchitecture/impl/FunctionImpl.java | 2 + .../impl/FunctionalArchitectureModelImpl.java | 1 + .../impl/FunctionalDataImpl.java | 23 ++++---- .../impl/FunctionalElementImpl.java | 27 ++++++---- .../impl/FunctionalInputImpl.java | 1 + .../impl/FunctionalInterfaceImpl.java | 6 ++- .../impl/FunctionalOutputImpl.java | 1 + .../impl/FunctionalarchitectureFactoryImpl.java | 22 ++++++-- .../impl/FunctionalarchitecturePackageImpl.java | 63 +++++++++++++++------- .../impl/InformationLinkImpl.java | 4 ++ .../util/FunctionalarchitectureAdapterFactory.java | 14 +++-- .../util/FunctionalarchitectureSwitch.java | 16 ++++-- .../Examples/ModelGenExampleFAM_plugin/plugin.xml | 11 ++-- .../patterns/RelationDefinitionIndexer.xtend | 6 ++- .../META-INF/MANIFEST.MF | 6 ++- .../initialModels/FAM.xmi | 2 +- .../hu/bme/mit/inf/dslreasoner/run/SimpleRun.xtend | 6 ++- 21 files changed, 159 insertions(+), 69 deletions(-) (limited to 'Tests/hu.bme.mit.inf.dslreasoner.run') diff --git a/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/FunctionType.java b/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/FunctionType.java index 59fe3fb2..9f2316a0 100644 --- a/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/FunctionType.java +++ b/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/FunctionType.java @@ -205,6 +205,7 @@ public enum FunctionType implements Enumerator { * * @generated */ + @Override public int getValue() { return value; } @@ -214,6 +215,7 @@ public enum FunctionType implements Enumerator { * * @generated */ + @Override public String getName() { return name; } @@ -223,6 +225,7 @@ public enum FunctionType implements Enumerator { * * @generated */ + @Override public String getLiteral() { return literal; } diff --git a/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/FunctionalData.java b/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/FunctionalData.java index 39639f99..59fa0fd4 100644 --- a/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/FunctionalData.java +++ b/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/FunctionalData.java @@ -60,13 +60,13 @@ public interface FunctionalData extends EObject { *

* * @return the value of the 'Interface' container reference. - * @see #setInterface(FunctionalInterface) + * @see #setInterface(functionalarchitecture.FunctionalInterface) * @see functionalarchitecture.FunctionalarchitecturePackage#getFunctionalData_Interface() * @see functionalarchitecture.FunctionalInterface#getData * @model opposite="data" transient="false" * @generated */ - FunctionalInterface getInterface(); + functionalarchitecture.FunctionalInterface getInterface(); /** * Sets the value of the '{@link functionalarchitecture.FunctionalData#getInterface Interface}' container reference. @@ -76,6 +76,6 @@ public interface FunctionalData extends EObject { * @see #getInterface() * @generated */ - void setInterface(FunctionalInterface value); + void setInterface(functionalarchitecture.FunctionalInterface value); } // FunctionalData diff --git a/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/FunctionalElement.java b/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/FunctionalElement.java index f5a2ff19..5d1d3254 100644 --- a/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/FunctionalElement.java +++ b/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/FunctionalElement.java @@ -33,13 +33,13 @@ public interface FunctionalElement extends EObject { *

* * @return the value of the 'Interface' containment reference. - * @see #setInterface(FunctionalInterface) + * @see #setInterface(functionalarchitecture.FunctionalInterface) * @see functionalarchitecture.FunctionalarchitecturePackage#getFunctionalElement_Interface() * @see functionalarchitecture.FunctionalInterface#getElement * @model opposite="element" containment="true" * @generated */ - FunctionalInterface getInterface(); + functionalarchitecture.FunctionalInterface getInterface(); /** * Sets the value of the '{@link functionalarchitecture.FunctionalElement#getInterface Interface}' containment reference. @@ -49,7 +49,7 @@ public interface FunctionalElement extends EObject { * @see #getInterface() * @generated */ - void setInterface(FunctionalInterface value); + void setInterface(functionalarchitecture.FunctionalInterface value); /** * Returns the value of the 'Model' reference. diff --git a/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FAMTerminatorImpl.java b/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FAMTerminatorImpl.java index 382e0170..94cd240a 100644 --- a/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FAMTerminatorImpl.java +++ b/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FAMTerminatorImpl.java @@ -55,6 +55,7 @@ public class FAMTerminatorImpl extends MinimalEObjectImpl.Container implements F * * @generated */ + @Override public FunctionalData getData() { if (eContainerFeatureID() != FunctionalarchitecturePackage.FAM_TERMINATOR__DATA) return null; return (FunctionalData)eInternalContainer(); @@ -75,6 +76,7 @@ public class FAMTerminatorImpl extends MinimalEObjectImpl.Container implements F * * @generated */ + @Override public void setData(FunctionalData newData) { if (newData != eInternalContainer() || (eContainerFeatureID() != FunctionalarchitecturePackage.FAM_TERMINATOR__DATA && newData != null)) { if (EcoreUtil.isAncestor(this, newData)) diff --git a/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FunctionImpl.java b/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FunctionImpl.java index 46736c8c..6e89bc65 100644 --- a/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FunctionImpl.java +++ b/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FunctionImpl.java @@ -79,6 +79,7 @@ public class FunctionImpl extends FunctionalElementImpl implements Function { * * @generated */ + @Override public EList getSubElements() { if (subElements == null) { subElements = new EObjectContainmentWithInverseEList(FunctionalElement.class, this, FunctionalarchitecturePackage.FUNCTION__SUB_ELEMENTS, FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__PARENT); @@ -91,6 +92,7 @@ public class FunctionImpl extends FunctionalElementImpl implements Function { * * @generated */ + @Override public FunctionType getType() { return (FunctionType)TYPE__ESETTING_DELEGATE.dynamicGet(this, null, 0, true, false); } diff --git a/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FunctionalArchitectureModelImpl.java b/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FunctionalArchitectureModelImpl.java index 78f6d6f2..a7d6c919 100644 --- a/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FunctionalArchitectureModelImpl.java +++ b/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FunctionalArchitectureModelImpl.java @@ -68,6 +68,7 @@ public class FunctionalArchitectureModelImpl extends MinimalEObjectImpl.Containe * * @generated */ + @Override public EList getRootElements() { if (rootElements == null) { rootElements = new EObjectContainmentEList(FunctionalElement.class, this, FunctionalarchitecturePackage.FUNCTIONAL_ARCHITECTURE_MODEL__ROOT_ELEMENTS); diff --git a/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FunctionalDataImpl.java b/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FunctionalDataImpl.java index 10937e8d..ec8f2cef 100644 --- a/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FunctionalDataImpl.java +++ b/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FunctionalDataImpl.java @@ -4,7 +4,6 @@ package functionalarchitecture.impl; import functionalarchitecture.FAMTerminator; import functionalarchitecture.FunctionalData; -import functionalarchitecture.FunctionalInterface; import functionalarchitecture.FunctionalarchitecturePackage; import org.eclipse.emf.common.notify.Notification; @@ -67,6 +66,7 @@ public abstract class FunctionalDataImpl extends MinimalEObjectImpl.Container im * * @generated */ + @Override public FAMTerminator getTerminator() { return terminator; } @@ -91,6 +91,7 @@ public abstract class FunctionalDataImpl extends MinimalEObjectImpl.Container im * * @generated */ + @Override public void setTerminator(FAMTerminator newTerminator) { if (newTerminator != terminator) { NotificationChain msgs = null; @@ -110,9 +111,10 @@ public abstract class FunctionalDataImpl extends MinimalEObjectImpl.Container im * * @generated */ - public FunctionalInterface getInterface() { + @Override + public functionalarchitecture.FunctionalInterface getInterface() { if (eContainerFeatureID() != FunctionalarchitecturePackage.FUNCTIONAL_DATA__INTERFACE) return null; - return (FunctionalInterface)eInternalContainer(); + return (functionalarchitecture.FunctionalInterface)eInternalContainer(); } /** @@ -120,7 +122,7 @@ public abstract class FunctionalDataImpl extends MinimalEObjectImpl.Container im * * @generated */ - public NotificationChain basicSetInterface(FunctionalInterface newInterface, NotificationChain msgs) { + public NotificationChain basicSetInterface(functionalarchitecture.FunctionalInterface newInterface, NotificationChain msgs) { msgs = eBasicSetContainer((InternalEObject)newInterface, FunctionalarchitecturePackage.FUNCTIONAL_DATA__INTERFACE, msgs); return msgs; } @@ -130,7 +132,8 @@ public abstract class FunctionalDataImpl extends MinimalEObjectImpl.Container im * * @generated */ - public void setInterface(FunctionalInterface newInterface) { + @Override + public void setInterface(functionalarchitecture.FunctionalInterface newInterface) { if (newInterface != eInternalContainer() || (eContainerFeatureID() != FunctionalarchitecturePackage.FUNCTIONAL_DATA__INTERFACE && newInterface != null)) { if (EcoreUtil.isAncestor(this, newInterface)) throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); @@ -138,7 +141,7 @@ public abstract class FunctionalDataImpl extends MinimalEObjectImpl.Container im if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); if (newInterface != null) - msgs = ((InternalEObject)newInterface).eInverseAdd(this, FunctionalarchitecturePackage.FUNCTIONAL_INTERFACE__DATA, FunctionalInterface.class, msgs); + msgs = ((InternalEObject)newInterface).eInverseAdd(this, FunctionalarchitecturePackage.FUNCTIONAL_INTERFACE__DATA, functionalarchitecture.FunctionalInterface.class, msgs); msgs = basicSetInterface(newInterface, msgs); if (msgs != null) msgs.dispatch(); } @@ -161,7 +164,7 @@ public abstract class FunctionalDataImpl extends MinimalEObjectImpl.Container im case FunctionalarchitecturePackage.FUNCTIONAL_DATA__INTERFACE: if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); - return basicSetInterface((FunctionalInterface)otherEnd, msgs); + return basicSetInterface((functionalarchitecture.FunctionalInterface)otherEnd, msgs); } return super.eInverseAdd(otherEnd, featureID, msgs); } @@ -191,7 +194,7 @@ public abstract class FunctionalDataImpl extends MinimalEObjectImpl.Container im public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { switch (eContainerFeatureID()) { case FunctionalarchitecturePackage.FUNCTIONAL_DATA__INTERFACE: - return eInternalContainer().eInverseRemove(this, FunctionalarchitecturePackage.FUNCTIONAL_INTERFACE__DATA, FunctionalInterface.class, msgs); + return eInternalContainer().eInverseRemove(this, FunctionalarchitecturePackage.FUNCTIONAL_INTERFACE__DATA, functionalarchitecture.FunctionalInterface.class, msgs); } return super.eBasicRemoveFromContainerFeature(msgs); } @@ -224,7 +227,7 @@ public abstract class FunctionalDataImpl extends MinimalEObjectImpl.Container im setTerminator((FAMTerminator)newValue); return; case FunctionalarchitecturePackage.FUNCTIONAL_DATA__INTERFACE: - setInterface((FunctionalInterface)newValue); + setInterface((functionalarchitecture.FunctionalInterface)newValue); return; } super.eSet(featureID, newValue); @@ -242,7 +245,7 @@ public abstract class FunctionalDataImpl extends MinimalEObjectImpl.Container im setTerminator((FAMTerminator)null); return; case FunctionalarchitecturePackage.FUNCTIONAL_DATA__INTERFACE: - setInterface((FunctionalInterface)null); + setInterface((functionalarchitecture.FunctionalInterface)null); return; } super.eUnset(featureID); diff --git a/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FunctionalElementImpl.java b/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FunctionalElementImpl.java index 809e9ed5..c923caae 100644 --- a/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FunctionalElementImpl.java +++ b/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FunctionalElementImpl.java @@ -5,7 +5,6 @@ package functionalarchitecture.impl; import functionalarchitecture.Function; import functionalarchitecture.FunctionalArchitectureModel; import functionalarchitecture.FunctionalElement; -import functionalarchitecture.FunctionalInterface; import functionalarchitecture.FunctionalarchitecturePackage; import org.eclipse.emf.common.notify.Notification; @@ -44,7 +43,7 @@ public abstract class FunctionalElementImpl extends MinimalEObjectImpl.Container * @generated * @ordered */ - protected FunctionalInterface interface_; + protected functionalarchitecture.FunctionalInterface interface_; /** * The cached setting delegate for the '{@link #getModel() Model}' reference. @@ -80,7 +79,8 @@ public abstract class FunctionalElementImpl extends MinimalEObjectImpl.Container * * @generated */ - public FunctionalInterface getInterface() { + @Override + public functionalarchitecture.FunctionalInterface getInterface() { return interface_; } @@ -89,8 +89,8 @@ public abstract class FunctionalElementImpl extends MinimalEObjectImpl.Container * * @generated */ - public NotificationChain basicSetInterface(FunctionalInterface newInterface, NotificationChain msgs) { - FunctionalInterface oldInterface = interface_; + public NotificationChain basicSetInterface(functionalarchitecture.FunctionalInterface newInterface, NotificationChain msgs) { + functionalarchitecture.FunctionalInterface oldInterface = interface_; interface_ = newInterface; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__INTERFACE, oldInterface, newInterface); @@ -104,13 +104,14 @@ public abstract class FunctionalElementImpl extends MinimalEObjectImpl.Container * * @generated */ - public void setInterface(FunctionalInterface newInterface) { + @Override + public void setInterface(functionalarchitecture.FunctionalInterface newInterface) { if (newInterface != interface_) { NotificationChain msgs = null; if (interface_ != null) - msgs = ((InternalEObject)interface_).eInverseRemove(this, FunctionalarchitecturePackage.FUNCTIONAL_INTERFACE__ELEMENT, FunctionalInterface.class, msgs); + msgs = ((InternalEObject)interface_).eInverseRemove(this, FunctionalarchitecturePackage.FUNCTIONAL_INTERFACE__ELEMENT, functionalarchitecture.FunctionalInterface.class, msgs); if (newInterface != null) - msgs = ((InternalEObject)newInterface).eInverseAdd(this, FunctionalarchitecturePackage.FUNCTIONAL_INTERFACE__ELEMENT, FunctionalInterface.class, msgs); + msgs = ((InternalEObject)newInterface).eInverseAdd(this, FunctionalarchitecturePackage.FUNCTIONAL_INTERFACE__ELEMENT, functionalarchitecture.FunctionalInterface.class, msgs); msgs = basicSetInterface(newInterface, msgs); if (msgs != null) msgs.dispatch(); } @@ -123,6 +124,7 @@ public abstract class FunctionalElementImpl extends MinimalEObjectImpl.Container * * @generated */ + @Override public FunctionalArchitectureModel getModel() { return (FunctionalArchitectureModel)MODEL__ESETTING_DELEGATE.dynamicGet(this, null, 0, true, false); } @@ -141,6 +143,7 @@ public abstract class FunctionalElementImpl extends MinimalEObjectImpl.Container * * @generated */ + @Override public void setModel(FunctionalArchitectureModel newModel) { MODEL__ESETTING_DELEGATE.dynamicSet(this, null, 0, newModel); } @@ -150,6 +153,7 @@ public abstract class FunctionalElementImpl extends MinimalEObjectImpl.Container * * @generated */ + @Override public Function getParent() { if (eContainerFeatureID() != FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__PARENT) return null; return (Function)eInternalContainer(); @@ -170,6 +174,7 @@ public abstract class FunctionalElementImpl extends MinimalEObjectImpl.Container * * @generated */ + @Override public void setParent(Function newParent) { if (newParent != eInternalContainer() || (eContainerFeatureID() != FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__PARENT && newParent != null)) { if (EcoreUtil.isAncestor(this, newParent)) @@ -197,7 +202,7 @@ public abstract class FunctionalElementImpl extends MinimalEObjectImpl.Container case FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__INTERFACE: if (interface_ != null) msgs = ((InternalEObject)interface_).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__INTERFACE, null, msgs); - return basicSetInterface((FunctionalInterface)otherEnd, msgs); + return basicSetInterface((functionalarchitecture.FunctionalInterface)otherEnd, msgs); case FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__PARENT: if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); @@ -264,7 +269,7 @@ public abstract class FunctionalElementImpl extends MinimalEObjectImpl.Container public void eSet(int featureID, Object newValue) { switch (featureID) { case FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__INTERFACE: - setInterface((FunctionalInterface)newValue); + setInterface((functionalarchitecture.FunctionalInterface)newValue); return; case FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__MODEL: setModel((FunctionalArchitectureModel)newValue); @@ -285,7 +290,7 @@ public abstract class FunctionalElementImpl extends MinimalEObjectImpl.Container public void eUnset(int featureID) { switch (featureID) { case FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__INTERFACE: - setInterface((FunctionalInterface)null); + setInterface((functionalarchitecture.FunctionalInterface)null); return; case FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__MODEL: setModel((FunctionalArchitectureModel)null); diff --git a/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FunctionalInputImpl.java b/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FunctionalInputImpl.java index 9df1ec0c..33a136ed 100644 --- a/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FunctionalInputImpl.java +++ b/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FunctionalInputImpl.java @@ -66,6 +66,7 @@ public class FunctionalInputImpl extends FunctionalDataImpl implements Functiona * * @generated */ + @Override public EList getIncomingLinks() { if (incomingLinks == null) { incomingLinks = new EObjectWithInverseResolvingEList(InformationLink.class, this, FunctionalarchitecturePackage.FUNCTIONAL_INPUT__INCOMING_LINKS, FunctionalarchitecturePackage.INFORMATION_LINK__TO); diff --git a/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FunctionalInterfaceImpl.java b/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FunctionalInterfaceImpl.java index 20151886..53aa2dac 100644 --- a/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FunctionalInterfaceImpl.java +++ b/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FunctionalInterfaceImpl.java @@ -4,7 +4,6 @@ package functionalarchitecture.impl; import functionalarchitecture.FunctionalData; import functionalarchitecture.FunctionalElement; -import functionalarchitecture.FunctionalInterface; import functionalarchitecture.FunctionalarchitecturePackage; import java.util.Collection; @@ -38,7 +37,7 @@ import org.eclipse.emf.ecore.util.InternalEList; * * @generated */ -public class FunctionalInterfaceImpl extends MinimalEObjectImpl.Container implements FunctionalInterface { +public class FunctionalInterfaceImpl extends MinimalEObjectImpl.Container implements functionalarchitecture.FunctionalInterface { /** * The cached value of the '{@link #getData() Data}' containment reference list. * @@ -73,6 +72,7 @@ public class FunctionalInterfaceImpl extends MinimalEObjectImpl.Container implem * * @generated */ + @Override public EList getData() { if (data == null) { data = new EObjectContainmentWithInverseEList(FunctionalData.class, this, FunctionalarchitecturePackage.FUNCTIONAL_INTERFACE__DATA, FunctionalarchitecturePackage.FUNCTIONAL_DATA__INTERFACE); @@ -85,6 +85,7 @@ public class FunctionalInterfaceImpl extends MinimalEObjectImpl.Container implem * * @generated */ + @Override public FunctionalElement getElement() { if (eContainerFeatureID() != FunctionalarchitecturePackage.FUNCTIONAL_INTERFACE__ELEMENT) return null; return (FunctionalElement)eInternalContainer(); @@ -105,6 +106,7 @@ public class FunctionalInterfaceImpl extends MinimalEObjectImpl.Container implem * * @generated */ + @Override public void setElement(FunctionalElement newElement) { if (newElement != eInternalContainer() || (eContainerFeatureID() != FunctionalarchitecturePackage.FUNCTIONAL_INTERFACE__ELEMENT && newElement != null)) { if (EcoreUtil.isAncestor(this, newElement)) diff --git a/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FunctionalOutputImpl.java b/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FunctionalOutputImpl.java index 1ae2a964..061af113 100644 --- a/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FunctionalOutputImpl.java +++ b/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FunctionalOutputImpl.java @@ -66,6 +66,7 @@ public class FunctionalOutputImpl extends FunctionalDataImpl implements Function * * @generated */ + @Override public EList getOutgoingLinks() { if (outgoingLinks == null) { outgoingLinks = new EObjectContainmentWithInverseEList(InformationLink.class, this, FunctionalarchitecturePackage.FUNCTIONAL_OUTPUT__OUTGOING_LINKS, FunctionalarchitecturePackage.INFORMATION_LINK__FROM); diff --git a/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FunctionalarchitectureFactoryImpl.java b/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FunctionalarchitectureFactoryImpl.java index 56ecfa25..9c9f495a 100644 --- a/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FunctionalarchitectureFactoryImpl.java +++ b/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FunctionalarchitectureFactoryImpl.java @@ -2,9 +2,15 @@ */ package functionalarchitecture.impl; -import functionalarchitecture.*; -import functionalarchitecture.FunctionalInterface; - +import functionalarchitecture.FAMTerminator; +import functionalarchitecture.Function; +import functionalarchitecture.FunctionType; +import functionalarchitecture.FunctionalArchitectureModel; +import functionalarchitecture.FunctionalInput; +import functionalarchitecture.FunctionalOutput; +import functionalarchitecture.FunctionalarchitectureFactory; +import functionalarchitecture.FunctionalarchitecturePackage; +import functionalarchitecture.InformationLink; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EDataType; import org.eclipse.emf.ecore.EObject; @@ -105,6 +111,7 @@ public class FunctionalarchitectureFactoryImpl extends EFactoryImpl implements F * * @generated */ + @Override public FunctionalArchitectureModel createFunctionalArchitectureModel() { FunctionalArchitectureModelImpl functionalArchitectureModel = new FunctionalArchitectureModelImpl(); return functionalArchitectureModel; @@ -115,6 +122,7 @@ public class FunctionalarchitectureFactoryImpl extends EFactoryImpl implements F * * @generated */ + @Override public Function createFunction() { FunctionImpl function = new FunctionImpl(); return function; @@ -125,6 +133,7 @@ public class FunctionalarchitectureFactoryImpl extends EFactoryImpl implements F * * @generated */ + @Override public FAMTerminator createFAMTerminator() { FAMTerminatorImpl famTerminator = new FAMTerminatorImpl(); return famTerminator; @@ -135,6 +144,7 @@ public class FunctionalarchitectureFactoryImpl extends EFactoryImpl implements F * * @generated */ + @Override public InformationLink createInformationLink() { InformationLinkImpl informationLink = new InformationLinkImpl(); return informationLink; @@ -145,7 +155,8 @@ public class FunctionalarchitectureFactoryImpl extends EFactoryImpl implements F * * @generated */ - public FunctionalInterface createFunctionalInterface() { + @Override + public functionalarchitecture.FunctionalInterface createFunctionalInterface() { FunctionalInterfaceImpl functionalInterface = new FunctionalInterfaceImpl(); return functionalInterface; } @@ -155,6 +166,7 @@ public class FunctionalarchitectureFactoryImpl extends EFactoryImpl implements F * * @generated */ + @Override public FunctionalInput createFunctionalInput() { FunctionalInputImpl functionalInput = new FunctionalInputImpl(); return functionalInput; @@ -165,6 +177,7 @@ public class FunctionalarchitectureFactoryImpl extends EFactoryImpl implements F * * @generated */ + @Override public FunctionalOutput createFunctionalOutput() { FunctionalOutputImpl functionalOutput = new FunctionalOutputImpl(); return functionalOutput; @@ -195,6 +208,7 @@ public class FunctionalarchitectureFactoryImpl extends EFactoryImpl implements F * * @generated */ + @Override public FunctionalarchitecturePackage getFunctionalarchitecturePackage() { return (FunctionalarchitecturePackage)getEPackage(); } diff --git a/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FunctionalarchitecturePackageImpl.java b/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FunctionalarchitecturePackageImpl.java index 22c15533..04945f1c 100644 --- a/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FunctionalarchitecturePackageImpl.java +++ b/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/FunctionalarchitecturePackageImpl.java @@ -9,7 +9,6 @@ import functionalarchitecture.FunctionalArchitectureModel; import functionalarchitecture.FunctionalData; import functionalarchitecture.FunctionalElement; import functionalarchitecture.FunctionalInput; -import functionalarchitecture.FunctionalInterface; import functionalarchitecture.FunctionalOutput; import functionalarchitecture.FunctionalarchitectureFactory; import functionalarchitecture.FunctionalarchitecturePackage; @@ -128,7 +127,7 @@ public class FunctionalarchitecturePackageImpl extends EPackageImpl implements F /** * Creates, registers, and initializes the Package for this model, and for any others upon which it depends. - * + * *

This method is used to initialize {@link FunctionalarchitecturePackage#eINSTANCE} when that field is accessed. * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. * @@ -142,7 +141,8 @@ public class FunctionalarchitecturePackageImpl extends EPackageImpl implements F if (isInited) return (FunctionalarchitecturePackage)EPackage.Registry.INSTANCE.getEPackage(FunctionalarchitecturePackage.eNS_URI); // Obtain or create and register package - FunctionalarchitecturePackageImpl theFunctionalarchitecturePackage = (FunctionalarchitecturePackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof FunctionalarchitecturePackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new FunctionalarchitecturePackageImpl()); + Object registeredFunctionalarchitecturePackage = EPackage.Registry.INSTANCE.get(eNS_URI); + FunctionalarchitecturePackageImpl theFunctionalarchitecturePackage = registeredFunctionalarchitecturePackage instanceof FunctionalarchitecturePackageImpl ? (FunctionalarchitecturePackageImpl)registeredFunctionalarchitecturePackage : new FunctionalarchitecturePackageImpl(); isInited = true; @@ -155,7 +155,6 @@ public class FunctionalarchitecturePackageImpl extends EPackageImpl implements F // Mark meta-data to indicate it can't be changed theFunctionalarchitecturePackage.freeze(); - // Update the registry and return the package EPackage.Registry.INSTANCE.put(FunctionalarchitecturePackage.eNS_URI, theFunctionalarchitecturePackage); return theFunctionalarchitecturePackage; @@ -166,6 +165,7 @@ public class FunctionalarchitecturePackageImpl extends EPackageImpl implements F * * @generated */ + @Override public EClass getFunctionalElement() { return functionalElementEClass; } @@ -175,6 +175,7 @@ public class FunctionalarchitecturePackageImpl extends EPackageImpl implements F * * @generated */ + @Override public EReference getFunctionalElement_Interface() { return (EReference)functionalElementEClass.getEStructuralFeatures().get(0); } @@ -184,6 +185,7 @@ public class FunctionalarchitecturePackageImpl extends EPackageImpl implements F * * @generated */ + @Override public EReference getFunctionalElement_Model() { return (EReference)functionalElementEClass.getEStructuralFeatures().get(1); } @@ -193,6 +195,7 @@ public class FunctionalarchitecturePackageImpl extends EPackageImpl implements F * * @generated */ + @Override public EReference getFunctionalElement_Parent() { return (EReference)functionalElementEClass.getEStructuralFeatures().get(2); } @@ -202,6 +205,7 @@ public class FunctionalarchitecturePackageImpl extends EPackageImpl implements F * * @generated */ + @Override public EClass getFunctionalArchitectureModel() { return functionalArchitectureModelEClass; } @@ -211,6 +215,7 @@ public class FunctionalarchitecturePackageImpl extends EPackageImpl implements F * * @generated */ + @Override public EReference getFunctionalArchitectureModel_RootElements() { return (EReference)functionalArchitectureModelEClass.getEStructuralFeatures().get(0); } @@ -220,6 +225,7 @@ public class FunctionalarchitecturePackageImpl extends EPackageImpl implements F * * @generated */ + @Override public EClass getFunction() { return functionEClass; } @@ -229,6 +235,7 @@ public class FunctionalarchitecturePackageImpl extends EPackageImpl implements F * * @generated */ + @Override public EReference getFunction_SubElements() { return (EReference)functionEClass.getEStructuralFeatures().get(0); } @@ -238,6 +245,7 @@ public class FunctionalarchitecturePackageImpl extends EPackageImpl implements F * * @generated */ + @Override public EAttribute getFunction_Type() { return (EAttribute)functionEClass.getEStructuralFeatures().get(1); } @@ -247,6 +255,7 @@ public class FunctionalarchitecturePackageImpl extends EPackageImpl implements F * * @generated */ + @Override public EClass getFAMTerminator() { return famTerminatorEClass; } @@ -256,6 +265,7 @@ public class FunctionalarchitecturePackageImpl extends EPackageImpl implements F * * @generated */ + @Override public EReference getFAMTerminator_Data() { return (EReference)famTerminatorEClass.getEStructuralFeatures().get(0); } @@ -265,6 +275,7 @@ public class FunctionalarchitecturePackageImpl extends EPackageImpl implements F * * @generated */ + @Override public EClass getInformationLink() { return informationLinkEClass; } @@ -274,6 +285,7 @@ public class FunctionalarchitecturePackageImpl extends EPackageImpl implements F * * @generated */ + @Override public EReference getInformationLink_From() { return (EReference)informationLinkEClass.getEStructuralFeatures().get(0); } @@ -283,6 +295,7 @@ public class FunctionalarchitecturePackageImpl extends EPackageImpl implements F * * @generated */ + @Override public EReference getInformationLink_To() { return (EReference)informationLinkEClass.getEStructuralFeatures().get(1); } @@ -292,6 +305,7 @@ public class FunctionalarchitecturePackageImpl extends EPackageImpl implements F * * @generated */ + @Override public EClass getFunctionalInterface() { return functionalInterfaceEClass; } @@ -301,6 +315,7 @@ public class FunctionalarchitecturePackageImpl extends EPackageImpl implements F * * @generated */ + @Override public EReference getFunctionalInterface_Data() { return (EReference)functionalInterfaceEClass.getEStructuralFeatures().get(0); } @@ -310,6 +325,7 @@ public class FunctionalarchitecturePackageImpl extends EPackageImpl implements F * * @generated */ + @Override public EReference getFunctionalInterface_Element() { return (EReference)functionalInterfaceEClass.getEStructuralFeatures().get(1); } @@ -319,6 +335,7 @@ public class FunctionalarchitecturePackageImpl extends EPackageImpl implements F * * @generated */ + @Override public EClass getFunctionalInput() { return functionalInputEClass; } @@ -328,6 +345,7 @@ public class FunctionalarchitecturePackageImpl extends EPackageImpl implements F * * @generated */ + @Override public EReference getFunctionalInput_IncomingLinks() { return (EReference)functionalInputEClass.getEStructuralFeatures().get(0); } @@ -337,6 +355,7 @@ public class FunctionalarchitecturePackageImpl extends EPackageImpl implements F * * @generated */ + @Override public EClass getFunctionalOutput() { return functionalOutputEClass; } @@ -346,6 +365,7 @@ public class FunctionalarchitecturePackageImpl extends EPackageImpl implements F * * @generated */ + @Override public EReference getFunctionalOutput_OutgoingLinks() { return (EReference)functionalOutputEClass.getEStructuralFeatures().get(0); } @@ -355,6 +375,7 @@ public class FunctionalarchitecturePackageImpl extends EPackageImpl implements F * * @generated */ + @Override public EClass getFunctionalData() { return functionalDataEClass; } @@ -364,6 +385,7 @@ public class FunctionalarchitecturePackageImpl extends EPackageImpl implements F * * @generated */ + @Override public EReference getFunctionalData_Terminator() { return (EReference)functionalDataEClass.getEStructuralFeatures().get(0); } @@ -373,6 +395,7 @@ public class FunctionalarchitecturePackageImpl extends EPackageImpl implements F * * @generated */ + @Override public EReference getFunctionalData_Interface() { return (EReference)functionalDataEClass.getEStructuralFeatures().get(1); } @@ -382,6 +405,7 @@ public class FunctionalarchitecturePackageImpl extends EPackageImpl implements F * * @generated */ + @Override public EEnum getFunctionType() { return functionTypeEEnum; } @@ -391,6 +415,7 @@ public class FunctionalarchitecturePackageImpl extends EPackageImpl implements F * * @generated */ + @Override public FunctionalarchitectureFactory getFunctionalarchitectureFactory() { return (FunctionalarchitectureFactory)getEFactoryInstance(); } @@ -503,9 +528,9 @@ public class FunctionalarchitecturePackageImpl extends EPackageImpl implements F initEReference(getInformationLink_From(), this.getFunctionalOutput(), this.getFunctionalOutput_OutgoingLinks(), "from", null, 0, 1, InformationLink.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getInformationLink_To(), this.getFunctionalInput(), this.getFunctionalInput_IncomingLinks(), "to", null, 1, 1, InformationLink.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEClass(functionalInterfaceEClass, FunctionalInterface.class, "FunctionalInterface", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getFunctionalInterface_Data(), this.getFunctionalData(), this.getFunctionalData_Interface(), "data", null, 0, -1, FunctionalInterface.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getFunctionalInterface_Element(), this.getFunctionalElement(), this.getFunctionalElement_Interface(), "element", null, 0, 1, FunctionalInterface.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEClass(functionalInterfaceEClass, functionalarchitecture.FunctionalInterface.class, "FunctionalInterface", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getFunctionalInterface_Data(), this.getFunctionalData(), this.getFunctionalData_Interface(), "data", null, 0, -1, functionalarchitecture.FunctionalInterface.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getFunctionalInterface_Element(), this.getFunctionalElement(), this.getFunctionalElement_Interface(), "element", null, 0, 1, functionalarchitecture.FunctionalInterface.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(functionalInputEClass, FunctionalInput.class, "FunctionalInput", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getFunctionalInput_IncomingLinks(), this.getInformationLink(), this.getInformationLink_To(), "IncomingLinks", null, 0, -1, FunctionalInput.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); @@ -540,12 +565,12 @@ public class FunctionalarchitecturePackageImpl extends EPackageImpl implements F * @generated */ protected void createEcoreAnnotations() { - String source = "http://www.eclipse.org/emf/2002/Ecore"; + String source = "http://www.eclipse.org/emf/2002/Ecore"; addAnnotation - (this, - source, + (this, + source, new String[] { - "settingDelegates", "org.eclipse.viatra.query.querybasedfeature" + "settingDelegates", "org.eclipse.viatra.query.querybasedfeature" }); } @@ -556,18 +581,18 @@ public class FunctionalarchitecturePackageImpl extends EPackageImpl implements F * @generated */ protected void createOrgAnnotations() { - String source = "org.eclipse.viatra.query.querybasedfeature"; + String source = "org.eclipse.viatra.query.querybasedfeature"; addAnnotation - (getFunctionalElement_Model(), - source, + (getFunctionalElement_Model(), + source, new String[] { - "patternFQN", "hu.bme.mit.inf.dslreasoner.domains.transima.fam.model" - }); + "patternFQN", "hu.bme.mit.inf.dslreasoner.domains.transima.fam.model" + }); addAnnotation - (getFunction_Type(), - source, + (getFunction_Type(), + source, new String[] { - "patternFQN", "hu.bme.mit.inf.dslreasoner.domains.transima.fam.type" + "patternFQN", "hu.bme.mit.inf.dslreasoner.domains.transima.fam.type" }); } diff --git a/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/InformationLinkImpl.java b/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/InformationLinkImpl.java index 4b46fef8..ead4f9e9 100644 --- a/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/InformationLinkImpl.java +++ b/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/impl/InformationLinkImpl.java @@ -67,6 +67,7 @@ public class InformationLinkImpl extends MinimalEObjectImpl.Container implements * * @generated */ + @Override public FunctionalOutput getFrom() { if (eContainerFeatureID() != FunctionalarchitecturePackage.INFORMATION_LINK__FROM) return null; return (FunctionalOutput)eInternalContainer(); @@ -87,6 +88,7 @@ public class InformationLinkImpl extends MinimalEObjectImpl.Container implements * * @generated */ + @Override public void setFrom(FunctionalOutput newFrom) { if (newFrom != eInternalContainer() || (eContainerFeatureID() != FunctionalarchitecturePackage.INFORMATION_LINK__FROM && newFrom != null)) { if (EcoreUtil.isAncestor(this, newFrom)) @@ -108,6 +110,7 @@ public class InformationLinkImpl extends MinimalEObjectImpl.Container implements * * @generated */ + @Override public FunctionalInput getTo() { if (to != null && to.eIsProxy()) { InternalEObject oldTo = (InternalEObject)to; @@ -149,6 +152,7 @@ public class InformationLinkImpl extends MinimalEObjectImpl.Container implements * * @generated */ + @Override public void setTo(FunctionalInput newTo) { if (newTo != to) { NotificationChain msgs = null; diff --git a/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/util/FunctionalarchitectureAdapterFactory.java b/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/util/FunctionalarchitectureAdapterFactory.java index f990a7a4..9846bd62 100644 --- a/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/util/FunctionalarchitectureAdapterFactory.java +++ b/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/util/FunctionalarchitectureAdapterFactory.java @@ -2,9 +2,15 @@ */ package functionalarchitecture.util; -import functionalarchitecture.*; -import functionalarchitecture.FunctionalInterface; - +import functionalarchitecture.FAMTerminator; +import functionalarchitecture.Function; +import functionalarchitecture.FunctionalArchitectureModel; +import functionalarchitecture.FunctionalData; +import functionalarchitecture.FunctionalElement; +import functionalarchitecture.FunctionalInput; +import functionalarchitecture.FunctionalOutput; +import functionalarchitecture.FunctionalarchitecturePackage; +import functionalarchitecture.InformationLink; import org.eclipse.emf.common.notify.Adapter; import org.eclipse.emf.common.notify.Notifier; @@ -89,7 +95,7 @@ public class FunctionalarchitectureAdapterFactory extends AdapterFactoryImpl { return createInformationLinkAdapter(); } @Override - public Adapter caseFunctionalInterface(FunctionalInterface object) { + public Adapter caseFunctionalInterface(functionalarchitecture.FunctionalInterface object) { return createFunctionalInterfaceAdapter(); } @Override diff --git a/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/util/FunctionalarchitectureSwitch.java b/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/util/FunctionalarchitectureSwitch.java index b481a978..a1bbb480 100644 --- a/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/util/FunctionalarchitectureSwitch.java +++ b/Domains/Examples/ModelGenExampleFAM_plugin/ecore-gen/functionalarchitecture/util/FunctionalarchitectureSwitch.java @@ -2,9 +2,15 @@ */ package functionalarchitecture.util; -import functionalarchitecture.*; -import functionalarchitecture.FunctionalInterface; - +import functionalarchitecture.FAMTerminator; +import functionalarchitecture.Function; +import functionalarchitecture.FunctionalArchitectureModel; +import functionalarchitecture.FunctionalData; +import functionalarchitecture.FunctionalElement; +import functionalarchitecture.FunctionalInput; +import functionalarchitecture.FunctionalOutput; +import functionalarchitecture.FunctionalarchitecturePackage; +import functionalarchitecture.InformationLink; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EPackage; @@ -99,7 +105,7 @@ public class FunctionalarchitectureSwitch extends Switch { return result; } case FunctionalarchitecturePackage.FUNCTIONAL_INTERFACE: { - FunctionalInterface functionalInterface = (FunctionalInterface)theEObject; + functionalarchitecture.FunctionalInterface functionalInterface = (functionalarchitecture.FunctionalInterface)theEObject; T result = caseFunctionalInterface(functionalInterface); if (result == null) result = defaultCase(theEObject); return result; @@ -214,7 +220,7 @@ public class FunctionalarchitectureSwitch extends Switch { * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ - public T caseFunctionalInterface(FunctionalInterface object) { + public T caseFunctionalInterface(functionalarchitecture.FunctionalInterface object) { return null; } diff --git a/Domains/Examples/ModelGenExampleFAM_plugin/plugin.xml b/Domains/Examples/ModelGenExampleFAM_plugin/plugin.xml index 213ec0ed..c117a28e 100644 --- a/Domains/Examples/ModelGenExampleFAM_plugin/plugin.xml +++ b/Domains/Examples/ModelGenExampleFAM_plugin/plugin.xml @@ -5,10 +5,13 @@ - - - - + + + + diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/RelationDefinitionIndexer.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/RelationDefinitionIndexer.xtend index cedcec5a..9845560c 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/RelationDefinitionIndexer.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/RelationDefinitionIndexer.xtend @@ -5,6 +5,7 @@ import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem import hu.bme.mit.inf.dslreasoner.viatra2logic.viatra2logicannotations.TransfomedViatraQuery import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.Modality import java.util.Map +import org.eclipse.emf.common.util.Enumerator import org.eclipse.emf.ecore.EAttribute import org.eclipse.emf.ecore.EEnumLiteral import org.eclipse.emf.ecore.EReference @@ -17,6 +18,7 @@ import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Inequality import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall +import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.BinaryTransitiveClosure import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall @@ -24,7 +26,6 @@ import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeCo import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PQuery import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint class RelationDefinitionIndexer { val PatternGenerator base; @@ -228,6 +229,9 @@ class RelationDefinitionIndexer { if(target instanceof EEnumLiteral) { targetString = '''const_«target.name»_«target.EEnum.name»''' additionalDefinition = '''DefinedElement.name(«targetString»,"«target.name» «target.EEnum.name»"); //LogicProblem.elements(problem,«targetString»);''' + } else if(target instanceof Enumerator) { + targetString = '''const_«target.name»_«target.class.simpleName»''' + additionalDefinition = '''DefinedElement.name(«targetString»,"«target.name» «target.class.simpleName»"); //LogicProblem.elements(problem,«targetString»);''' } else if(target instanceof Integer) { targetString = '''const_«target»_Integer''' additionalDefinition = '''IntegerElement.value(«targetString»,«target»);''' diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/META-INF/MANIFEST.MF b/Tests/hu.bme.mit.inf.dslreasoner.run/META-INF/MANIFEST.MF index 548d3608..cc274c7c 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/META-INF/MANIFEST.MF +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/META-INF/MANIFEST.MF @@ -26,6 +26,10 @@ Require-Bundle: hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlan org.eclipse.viatra.query.runtime.localsearch;bundle-version="1.5.0", hu.bme.mit.inf.dslreasoner.logic2ecore;bundle-version="1.0.0", hu.bme.mit.inf.dslreasoner.visualisation;bundle-version="1.0.0", - hu.bme.mit.inf.dslreasoner.domains.alloyexamples;bundle-version="1.0.0" + hu.bme.mit.inf.dslreasoner.domains.alloyexamples;bundle-version="1.0.0", + org.eclipse.collections;bundle-version="9.2.0", + org.eclipse.viatra.query.patternlanguage.emf;bundle-version="2.2.0", + org.eclipse.viatra.query.runtime.rete;bundle-version="2.2.0", + org.objectweb.asm;bundle-version="7.0.0" Import-Package: org.apache.log4j Bundle-RequiredExecutionEnvironment: JavaSE-1.8 diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/initialModels/FAM.xmi b/Tests/hu.bme.mit.inf.dslreasoner.run/initialModels/FAM.xmi index d2797166..e4115194 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/initialModels/FAM.xmi +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/initialModels/FAM.xmi @@ -1,3 +1,3 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:fam="http://www.inf.mit.bme.hu/viatrasolver/example/fam"/> diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SimpleRun.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SimpleRun.xtend index 91c46dd6..fe4dcadd 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SimpleRun.xtend +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SimpleRun.xtend @@ -34,6 +34,8 @@ import org.eclipse.emf.ecore.EObject import org.eclipse.emf.ecore.EReference import org.eclipse.emf.ecore.resource.Resource import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl +import org.eclipse.viatra.query.patternlanguage.emf.EMFPatternLanguageStandaloneSetup +import org.eclipse.viatra.query.runtime.rete.matcher.ReteEngine class SimpleRun { @@ -125,7 +127,9 @@ class SimpleRun { } def static loadPartialModel(ReasonerWorkspace inputs) { - Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("*", new XMIResourceFactoryImpl()); + EMFPatternLanguageStandaloneSetup.doSetup + ReteEngine.getClass + Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("xmi", new XMIResourceFactoryImpl()); inputs.readModel(EObject,"FAM.xmi").eResource.allContents.toList } -- cgit v1.2.3-54-g00ecf From 8d5377ccb1c89668d1c95314910455c12c9c4554 Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Fri, 2 Aug 2019 01:24:28 +0200 Subject: Fix enum literal support for FAM --- Domains/Examples/ModelGenExampleFAM_plugin/.project | 6 ------ .../logic2viatra/patterns/RelationDefinitionIndexer.xtend | 9 +++++---- .../src/hu/bme/mit/inf/dslreasoner/run/SimpleRun.xtend | 9 +++++++-- 3 files changed, 12 insertions(+), 12 deletions(-) (limited to 'Tests/hu.bme.mit.inf.dslreasoner.run') diff --git a/Domains/Examples/ModelGenExampleFAM_plugin/.project b/Domains/Examples/ModelGenExampleFAM_plugin/.project index 70920828..6e1b3a06 100644 --- a/Domains/Examples/ModelGenExampleFAM_plugin/.project +++ b/Domains/Examples/ModelGenExampleFAM_plugin/.project @@ -10,11 +10,6 @@ - - org.eclipse.xtext.ui.shared.xtextBuilder - - - org.eclipse.jdt.core.javabuilder @@ -33,7 +28,6 @@ org.eclipse.jdt.core.javanature - org.eclipse.xtext.ui.shared.xtextNature org.eclipse.viatra.query.projectnature org.eclipse.pde.PluginNature diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/RelationDefinitionIndexer.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/RelationDefinitionIndexer.xtend index 9845560c..0ae28b66 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/RelationDefinitionIndexer.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/RelationDefinitionIndexer.xtend @@ -34,7 +34,7 @@ class RelationDefinitionIndexer { this.base = base } - public def generateRelationDefinitions( + def generateRelationDefinitions( LogicProblem problem, Iterable relations, Map fqn2PQuery) { @@ -110,7 +110,7 @@ class RelationDefinitionIndexer { else return Modality::MUST } - def public referPattern(PQuery p, String[] variables, Modality modality, boolean positive, boolean transitive) ''' + def referPattern(PQuery p, String[] variables, Modality modality, boolean positive, boolean transitive) ''' «IF !positive»neg «ENDIF»find «IF transitive»twoParam_«ENDIF»«modality.name.toLowerCase»InRelation_pattern_«p.fullyQualifiedName.replace('.','_')»«IF transitive»+«ENDIF»(«IF !transitive»problem,interpretation,«ENDIF»«variables.join(',')»); ''' @@ -228,10 +228,11 @@ class RelationDefinitionIndexer { var String additionalDefinition; if(target instanceof EEnumLiteral) { targetString = '''const_«target.name»_«target.EEnum.name»''' - additionalDefinition = '''DefinedElement.name(«targetString»,"«target.name» «target.EEnum.name»"); //LogicProblem.elements(problem,«targetString»);''' + additionalDefinition = '''DefinedElement.name(«targetString»,"«target.name» literal «target.EEnum.name»"); //LogicProblem.elements(problem,«targetString»);''' } else if(target instanceof Enumerator) { + // XXX We should get the corresponding EEnum name instead of the java class name. targetString = '''const_«target.name»_«target.class.simpleName»''' - additionalDefinition = '''DefinedElement.name(«targetString»,"«target.name» «target.class.simpleName»"); //LogicProblem.elements(problem,«targetString»);''' + additionalDefinition = '''DefinedElement.name(«targetString»,"«target.name» literal «target.class.simpleName»"); //LogicProblem.elements(problem,«targetString»);''' } else if(target instanceof Integer) { targetString = '''const_«target»_Integer''' additionalDefinition = '''IntegerElement.value(«targetString»,«target»);''' diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SimpleRun.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SimpleRun.xtend index fe4dcadd..b65826ad 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SimpleRun.xtend +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SimpleRun.xtend @@ -15,6 +15,7 @@ import hu.bme.mit.inf.dslreasoner.logic2ecore.Logic2Ecore import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2Logic import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2LogicConfiguration import hu.bme.mit.inf.dslreasoner.viatra2logic.ViatraQuerySetDescriptor +import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.ScopePropagatorStrategy import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.InstanceModel2Logic import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretation2Gml @@ -60,6 +61,7 @@ class SimpleRun { val modelGenerationProblem = ecore2Logic.transformMetamodel(metamodel,new Ecore2LogicConfiguration()) val modelExtensionProblem = instanceModel2Logic.transform(modelGenerationProblem,partialModel) val validModelExtensionProblem = viatra2Logic.transformQueries(queries,modelExtensionProblem,new Viatra2LogicConfiguration) +// workspace.writeModel(validModelExtensionProblem.output, "generation.logicproblem") val logicProblem = validModelExtensionProblem.output @@ -72,6 +74,7 @@ class SimpleRun { it.typeScopes.maxNewElements = 40 it.typeScopes.minNewElements = 40 it.solutionScope.numberOfRequiredSolutions = 1 +// it.scopePropagatorStrategy = ScopePropagatorStrategy.BasicTypeHierarchy it.documentationLevel = DocumentationLevel.NONE it.debugConfiguration.partalInterpretationVisualisationFrequency = 1 it.debugConfiguration.partialInterpretatioVisualiser = new GraphvizVisualiser @@ -91,12 +94,14 @@ class SimpleRun { println("Problem solved") - val interpretations = reasoner.getInterpretations(solution as ModelResult) + val result = solution as ModelResult + val interpretations = reasoner.getInterpretations(result) val models = new LinkedList for(interpretation : interpretations) { val instanceModel = logic2Ecore.transformInterpretation(interpretation,modelGenerationProblem.trace) models+=instanceModel } + println(result.statistics.solverTime) solution.writeSolution(workspace, #[]) } @@ -129,7 +134,7 @@ class SimpleRun { def static loadPartialModel(ReasonerWorkspace inputs) { EMFPatternLanguageStandaloneSetup.doSetup ReteEngine.getClass - Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("xmi", new XMIResourceFactoryImpl()); + Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("*", new XMIResourceFactoryImpl()); inputs.readModel(EObject,"FAM.xmi").eResource.allContents.toList } -- cgit v1.2.3-54-g00ecf From fc84d3fe670331bc89fb1e4c44104bc1fc811438 Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Wed, 14 Aug 2019 18:26:33 +0200 Subject: Measurements WIP --- .../.ApplicationConfigurationIdeModule.xtendbin | Bin 1701 -> 1701 bytes .../ide/.ApplicationConfigurationIdeSetup.xtendbin | Bin 2570 -> 2570 bytes .../domains/transima/fam/FamPatterns.vql | 2 +- .../domains/cps/dse/RuleBasedCpsSolver.xtend | 6 +- .../.classpath | 7 +- .../.project | 1 + .../.settings/org.eclipse.core.resources.prefs | 3 - .../META-INF/MANIFEST.MF | 16 +- .../configs/generation.vsconfig | 2 +- .../ecore-gen/satellite/CommSubsystem.java | 20 +- .../ecore-gen/satellite/ConstellationMission.java | 2 +- .../ecore-gen/satellite/InterferometryMission.java | 28 -- .../ecore-gen/satellite/SatellitePackage.java | 88 +----- .../satellite/impl/CommSubsystemImpl.java | 115 +------ .../satellite/impl/InterferometryMissionImpl.java | 130 -------- .../satellite/impl/SatellitePackageImpl.java | 37 +-- .../inputs/SatelliteInstance.xmi | 9 +- .../model/satellite.ecore | 12 +- .../model/satellite.genmodel | 5 +- .../model/satellite.henshin | 61 ---- .../model/satellite.henshin_diagram | 131 -------- .../model/satellite_fixup.henshin | 61 ---- .../plugin.xml | 1 + .../representations.aird | 2 + .../domains/satellite/mdeo/CostObjective.xtend | 13 - .../satellite/mdeo/LocalSearchEngineManager.xtend | 31 -- .../mdeo/MetricBasedGuidanceFunction.xtend | 47 --- .../satellite/mdeo/PatternMatchConstraint.xtend | 29 -- .../satellite/mdeo/SatelliteMdeOptimiserMain.xtend | 51 --- .../domains/satellite/mdeo/satellite.mopt | 36 --- .../domains/satellite/queries/SatelliteQueries.vql | 11 +- .../META-INF/MANIFEST.MF | 3 +- .../plugin.xml | 74 +---- .../yakindu/mutated/mutated.vql | 270 ---------------- .../partialsnapshot_mavo/yakindu/patterns.vql | 64 ++-- .../ModelGenerationMethodProvider.xtend | 35 +- .../cardinality/LinearTypeConstraintHint.xtend | 30 ++ .../cardinality/PolyhedronScopePropagator.xtend | 106 +++++-- .../cardinality/PolyhedronSolver.xtend | 72 ++++- .../cardinality/RelationConstraintCalculator.xtend | 5 +- .../logic2viatra/cardinality/ScopePropagator.xtend | 25 +- .../cardinality/ScopePropagatorStrategy.xtend | 11 +- .../cardinality/TypeHierarchyScopePropagator.xtend | 20 +- .../cardinality/Z3PolyhedronSolver.xtend | 32 +- .../logic2viatra/patterns/PatternGenerator.xtend | 18 +- .../logic2viatra/patterns/PatternProvider.xtend | 6 +- .../patterns/RelationRefinementGenerator.xtend | 2 +- .../logic2viatra/patterns/UnfinishedIndexer.xtend | 26 +- .../rules/RefinementRuleProvider.xtend | 15 +- .../PartialInterpretation.java | 24 ++ .../PartialinterpretationPackage.java | 60 +++- .../partialinterpretation/Scope.java | 24 ++ .../impl/BinaryElementRelationLinkImpl.java | 4 + .../impl/BooleanElementImpl.java | 4 +- .../impl/IntegerElementImpl.java | 4 +- .../impl/NaryRelationLinkElementImpl.java | 6 +- .../impl/NaryRelationLinkImpl.java | 1 + .../impl/PartialComplexTypeInterpretationImpl.java | 3 + .../impl/PartialConstantInterpretationImpl.java | 2 + .../impl/PartialFunctionInterpretationImpl.java | 2 + .../impl/PartialInterpretationImpl.java | 73 ++++- .../impl/PartialRelationInterpretationImpl.java | 7 + .../impl/PartialTypeInterpratationImpl.java | 2 + .../impl/PartialinterpretationFactoryImpl.java | 19 ++ .../impl/PartialinterpretationPackageImpl.java | 88 +++++- .../impl/PrimitiveElementImpl.java | 4 +- .../impl/RealElementImpl.java | 4 +- .../partialinterpretation/impl/ScopeImpl.java | 64 +++- .../impl/StringElementImpl.java | 4 +- .../impl/UnaryElementRelationLinkImpl.java | 2 + .../model/PartialInterpretation.ecore | 6 + .../model/PartialInterpretation.genmodel | 14 +- .../neighbourhood/Descriptor.xtend | 8 + .../neighbourhood/NeighbourhoodOptions.xtend | 4 +- .../neighbourhood/PartialInterpretation2Hash.xtend | 2 +- ...nterpretation2NeighbourhoodRepresentation.xtend | 4 +- .../NeighbourhoodBasedStateCoderFactory.xtend | 29 +- .../viatrasolver/reasoner/ViatraReasoner.xtend | 25 +- .../reasoner/ViatraReasonerConfiguration.xtend | 3 + .../reasoner/dse/BasicScopeGlobalConstraint.xtend | 103 ++++++ .../dse/BestFirstStrategyForModelGeneration.java | 2 +- .../dse/ModelGenerationCompositeObjective.xtend | 2 +- .../viatrasolver/reasoner/dse/ScopeObjective.xtend | 4 +- .../reasoner/dse/UnfinishedWFObjective.xtend | 34 +- .../reasoner/dse/ViatraReasonerSolutionSaver.xtend | 11 +- .../META-INF/MANIFEST.MF | 8 +- ..._ViatraSolver_polyhedral_typeHierarchy_Clp.json | 13 + ..._ViatraSolver_polyhedral_typeHierarchy_Clp.json | 16 + ..._ViatraSolver_polyhedral_typeHierarchy_Clp.json | 15 + ..._ViatraSolver_polyhedral_typeHierarchy_Clp.json | 15 + ..._ViatraSolver_polyhedral_typeHierarchy_Clp.json | 17 + .../initialModels/satellite.xmi | 14 + .../bme/mit/inf/dslreasoner/run/CountMatches.xtend | 176 ----------- .../run/Ecore2LogicTraceBasedHint.xtend | 56 ++++ .../mit/inf/dslreasoner/run/MetamodelLoader.xtend | 302 +++++++++++++----- .../bme/mit/inf/dslreasoner/run/SGraphHint.xtend | 46 +++ .../mit/inf/dslreasoner/run/SatelliteHint.xtend | 86 +++++ .../run/TypeDistributionCalculator.xtend | 35 ++ .../dslreasoner/run/script/MeasurementScript.xtend | 70 ++++ .../run/script/MeasurementScriptRunner.xtend | 351 +++++++++++++++++++++ 100 files changed, 1976 insertions(+), 1667 deletions(-) delete mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/.settings/org.eclipse.core.resources.prefs delete mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite.henshin delete mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite.henshin_diagram delete mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite_fixup.henshin create mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/representations.aird delete mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/CostObjective.xtend delete mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/LocalSearchEngineManager.xtend delete mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/MetricBasedGuidanceFunction.xtend delete mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/PatternMatchConstraint.xtend delete mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/SatelliteMdeOptimiserMain.xtend delete mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/satellite.mopt delete mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph/queries/hu/bme/mit/inf/dslreasoner/partialsnapshot_mavo/yakindu/mutated/mutated.vql create mode 100644 Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/LinearTypeConstraintHint.xtend create mode 100644 Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/BasicScopeGlobalConstraint.xtend create mode 100644 Tests/hu.bme.mit.inf.dslreasoner.run/configs/FAM_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json create mode 100644 Tests/hu.bme.mit.inf.dslreasoner.run/configs/Yakindu_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json create mode 100644 Tests/hu.bme.mit.inf.dslreasoner.run/configs/ecore_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json create mode 100644 Tests/hu.bme.mit.inf.dslreasoner.run/configs/fs_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json create mode 100644 Tests/hu.bme.mit.inf.dslreasoner.run/configs/satellite_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json create mode 100644 Tests/hu.bme.mit.inf.dslreasoner.run/initialModels/satellite.xmi delete mode 100644 Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/CountMatches.xtend create mode 100644 Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/Ecore2LogicTraceBasedHint.xtend create mode 100644 Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SGraphHint.xtend create mode 100644 Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SatelliteHint.xtend create mode 100644 Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/TypeDistributionCalculator.xtend create mode 100644 Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/script/MeasurementScript.xtend create mode 100644 Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/script/MeasurementScriptRunner.xtend (limited to 'Tests/hu.bme.mit.inf.dslreasoner.run') 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 069bd953..22db4093 100644 Binary files a/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeModule.xtendbin and b/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeModule.xtendbin 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 624846d6..3ad5d167 100644 Binary files a/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeSetup.xtendbin and b/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeSetup.xtendbin differ diff --git a/Domains/Examples/ModelGenExampleFAM_plugin/src/hu/bme/mit/inf/dslreasoner/domains/transima/fam/FamPatterns.vql b/Domains/Examples/ModelGenExampleFAM_plugin/src/hu/bme/mit/inf/dslreasoner/domains/transima/fam/FamPatterns.vql index f0e48d42..1d9a6b6d 100644 --- a/Domains/Examples/ModelGenExampleFAM_plugin/src/hu/bme/mit/inf/dslreasoner/domains/transima/fam/FamPatterns.vql +++ b/Domains/Examples/ModelGenExampleFAM_plugin/src/hu/bme/mit/inf/dslreasoner/domains/transima/fam/FamPatterns.vql @@ -10,7 +10,7 @@ pattern terminatorAndInformation(T : FAMTerminator, I : InformationLink) = { InformationLink.to(I,In); FunctionalInput.terminator(In,T); } - +/* @QueryBasedFeature pattern type(This : Function, Target : FunctionType) = { find rootElements(_Model, This); diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/dse/RuleBasedCpsSolver.xtend b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/dse/RuleBasedCpsSolver.xtend index e4c758f0..503c06ea 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/dse/RuleBasedCpsSolver.xtend +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/dse/RuleBasedCpsSolver.xtend @@ -35,18 +35,18 @@ class RuleBasedCpsSolver { val dse = new DesignSpaceExplorer dse.addMetaModelPackage(CpsPackage.eINSTANCE) dse.initialModel = problem.eResource.resourceSet - dse.addTransformationRule(createRule(RequirementNotSatisfied.instance).action [ + dse.addTransformationRule(createRule.precondition(RequirementNotSatisfied.instance).action [ val app = createApplicationInstance req.type.instances += app req.instances += app ].build) - dse.addTransformationRule(createRule(Allocate.instance).action [ + dse.addTransformationRule(createRule.precondition(Allocate.instance).action [ app.allocatedTo = host ].build) // dse.addTransformationRule(createRule(UnallocateAppInstance.instance).action [ // app.allocatedTo = null // ].build) - dse.addTransformationRule(createRule(CreateHostInstance.instance).action [ + dse.addTransformationRule(createRule.precondition(CreateHostInstance.instance).action [ hostType.instances += createHostInstance ].build) // dse.addTransformationRule(createRule(RemoveHostInstance.instance).action [ diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/.classpath b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/.classpath index e5e58475..6781ea8f 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/.classpath +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/.classpath @@ -3,9 +3,12 @@ - + + + + + - diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/.project b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/.project index 16db5fc5..e594a173 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/.project +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/.project @@ -32,6 +32,7 @@ + org.eclipse.sirius.nature.modelingproject org.eclipse.jdt.core.javanature org.eclipse.pde.PluginNature org.eclipse.viatra.query.projectnature diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/.settings/org.eclipse.core.resources.prefs b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 4a3e59e4..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,3 +0,0 @@ -eclipse.preferences.version=1 -encoding//model/satellite.henshin=UTF-8 -encoding//model/satellite.henshin_diagram=UTF-8 diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/META-INF/MANIFEST.MF b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/META-INF/MANIFEST.MF index 36d729b4..966fc660 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/META-INF/MANIFEST.MF +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/META-INF/MANIFEST.MF @@ -7,6 +7,7 @@ Bundle-ClassPath: . Bundle-Vendor: %providerName Bundle-Localization: plugin Export-Package: hu.bme.mit.inf.dslreasoner.domains.satellite.queries, + hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal, satellite, satellite.impl, satellite.util @@ -22,20 +23,7 @@ Require-Bundle: org.eclipse.viatra.addon.querybasedfeatures.runtime, org.eclipse.viatra.dse.genetic, hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner;bundle-version="1.0.0", org.eclipse.emf.ecore.xmi;bundle-version="2.15.0", - uk.ac.kcl.inf.mdeoptimiser.libraries.core;bundle-version="1.0.0", - uk.ac.kcl.inf.mdeoptimiser.interfaces.cli;bundle-version="1.0.0", - org.eclipse.emf.henshin.interpreter;bundle-version="1.5.0", - uk.ac.kcl.inf.mdeoptimiser.libraries.rulegen;bundle-version="1.0.0", - org.sidiff.common;bundle-version="1.0.0", - org.sidiff.common.emf;bundle-version="1.0.0", - org.sidiff.common.emf.extensions;bundle-version="1.0.0", - org.moeaframework;bundle-version="2.13.0", - org.apache.commons.math3;bundle-version="3.6.1", - org.apache.commons.lang3;bundle-version="3.8.1", - com.google.inject;bundle-version="3.0.0", - org.sidiff.common.henshin;bundle-version="1.0.0", - org.sidiff.serge;bundle-version="1.0.0", - org.eclipse.viatra.query.runtime.rete;bundle-version="2.2.0" + org.eclipse.viatra.query.runtime.rete;bundle-version="2.0.0" Import-Package: org.apache.log4j Automatic-Module-Name: hu.bme.mit.inf.dslreasoner.domains.satellite Bundle-ActivationPolicy: lazy diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/configs/generation.vsconfig b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/configs/generation.vsconfig index 66c468d0..2fb246c9 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/configs/generation.vsconfig +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/configs/generation.vsconfig @@ -2,7 +2,7 @@ import epackage "model/satellite.ecore" import viatra "src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql" generate { - metamodel = { package satellite excluding { InterferometryMission.observationTime } } + metamodel = { package satellite } constraints = { package hu.bme.mit.inf.dslreasoner.domains.satellite.queries } partial-model = { "inputs/SatelliteInstance.xmi"} solver = ViatraSolver diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/CommSubsystem.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/CommSubsystem.java index 90bca78c..3b9d7ecf 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/CommSubsystem.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/CommSubsystem.java @@ -2,7 +2,6 @@ */ package satellite; -import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; /** @@ -15,7 +14,6 @@ import org.eclipse.emf.ecore.EObject; *

*
    *
  • {@link satellite.CommSubsystem#getTarget Target}
  • - *
  • {@link satellite.CommSubsystem#getSource Source}
  • *
* * @see satellite.SatellitePackage#getCommSubsystem() @@ -26,14 +24,12 @@ public interface CommSubsystem extends EObject { /** * Returns the value of the 'Target' reference. - * It is bidirectional and its opposite is '{@link satellite.CommSubsystem#getSource Source}'. * * * @return the value of the 'Target' reference. * @see #setTarget(CommSubsystem) * @see satellite.SatellitePackage#getCommSubsystem_Target() - * @see satellite.CommSubsystem#getSource - * @model opposite="source" + * @model * @generated */ CommSubsystem getTarget(); @@ -48,18 +44,4 @@ public interface CommSubsystem extends EObject { */ void setTarget(CommSubsystem value); - /** - * Returns the value of the 'Source' reference list. - * The list contents are of type {@link satellite.CommSubsystem}. - * It is bidirectional and its opposite is '{@link satellite.CommSubsystem#getTarget Target}'. - * - * - * @return the value of the 'Source' reference list. - * @see satellite.SatellitePackage#getCommSubsystem_Source() - * @see satellite.CommSubsystem#getTarget - * @model opposite="target" - * @generated - */ - EList getSource(); - } // CommSubsystem diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/ConstellationMission.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/ConstellationMission.java index 6182d7ad..8ff69955 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/ConstellationMission.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/ConstellationMission.java @@ -53,7 +53,7 @@ public interface ConstellationMission extends EObject { * * @return the value of the 'Spacecraft' containment reference list. * @see satellite.SatellitePackage#getConstellationMission_Spacecraft() - * @model containment="true" lower="2" upper="50" + * @model containment="true" lower="2" * @generated */ EList getSpacecraft(); diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/InterferometryMission.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/InterferometryMission.java index eb4ea064..4e28df38 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/InterferometryMission.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/InterferometryMission.java @@ -7,39 +7,11 @@ package satellite; * A representation of the model object 'Interferometry Mission'. * * - *

- * The following features are supported: - *

- *
    - *
  • {@link satellite.InterferometryMission#getObservationTime Observation Time}
  • - *
* * @see satellite.SatellitePackage#getInterferometryMission() * @model * @generated */ public interface InterferometryMission extends ConstellationMission { - /** - * Returns the value of the 'Observation Time' attribute. - * The default value is "2.0". - * - * - * @return the value of the 'Observation Time' attribute. - * @see #setObservationTime(float) - * @see satellite.SatellitePackage#getInterferometryMission_ObservationTime() - * @model default="2.0" required="true" - * @generated - */ - float getObservationTime(); - - /** - * Sets the value of the '{@link satellite.InterferometryMission#getObservationTime Observation Time}' attribute. - * - * - * @param value the new value of the 'Observation Time' attribute. - * @see #getObservationTime() - * @generated - */ - void setObservationTime(float value); } // InterferometryMission diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/SatellitePackage.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/SatellitePackage.java index 7be4ef84..9ca99311 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/SatellitePackage.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/SatellitePackage.java @@ -2,7 +2,6 @@ */ package satellite; -import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.EReference; @@ -130,15 +129,6 @@ public interface SatellitePackage extends EPackage { */ int INTERFEROMETRY_MISSION__SPACECRAFT = CONSTELLATION_MISSION__SPACECRAFT; - /** - * The feature id for the 'Observation Time' attribute. - * - * - * @generated - * @ordered - */ - int INTERFEROMETRY_MISSION__OBSERVATION_TIME = CONSTELLATION_MISSION_FEATURE_COUNT + 0; - /** * The number of structural features of the 'Interferometry Mission' class. * @@ -146,7 +136,7 @@ public interface SatellitePackage extends EPackage { * @generated * @ordered */ - int INTERFEROMETRY_MISSION_FEATURE_COUNT = CONSTELLATION_MISSION_FEATURE_COUNT + 1; + int INTERFEROMETRY_MISSION_FEATURE_COUNT = CONSTELLATION_MISSION_FEATURE_COUNT + 0; /** * The number of operations of the 'Interferometry Mission' class. @@ -296,15 +286,6 @@ public interface SatellitePackage extends EPackage { */ int COMM_SUBSYSTEM__TARGET = 0; - /** - * The feature id for the 'Source' reference list. - * - * - * @generated - * @ordered - */ - int COMM_SUBSYSTEM__SOURCE = 1; - /** * The number of structural features of the 'Comm Subsystem' class. * @@ -312,7 +293,7 @@ public interface SatellitePackage extends EPackage { * @generated * @ordered */ - int COMM_SUBSYSTEM_FEATURE_COUNT = 2; + int COMM_SUBSYSTEM_FEATURE_COUNT = 1; /** * The number of operations of the 'Comm Subsystem' class. @@ -582,15 +563,6 @@ public interface SatellitePackage extends EPackage { */ int UHF_COMM_SUBSYSTEM__TARGET = COMM_SUBSYSTEM__TARGET; - /** - * The feature id for the 'Source' reference list. - * - * - * @generated - * @ordered - */ - int UHF_COMM_SUBSYSTEM__SOURCE = COMM_SUBSYSTEM__SOURCE; - /** * The number of structural features of the 'UHF Comm Subsystem' class. * @@ -628,15 +600,6 @@ public interface SatellitePackage extends EPackage { */ int XCOMM_SUBSYSTEM__TARGET = COMM_SUBSYSTEM__TARGET; - /** - * The feature id for the 'Source' reference list. - * - * - * @generated - * @ordered - */ - int XCOMM_SUBSYSTEM__SOURCE = COMM_SUBSYSTEM__SOURCE; - /** * The number of structural features of the 'XComm Subsystem' class. * @@ -674,15 +637,6 @@ public interface SatellitePackage extends EPackage { */ int KA_COMM_SUBSYSTEM__TARGET = COMM_SUBSYSTEM__TARGET; - /** - * The feature id for the 'Source' reference list. - * - * - * @generated - * @ordered - */ - int KA_COMM_SUBSYSTEM__SOURCE = COMM_SUBSYSTEM__SOURCE; - /** * The number of structural features of the 'Ka Comm Subsystem' class. * @@ -743,17 +697,6 @@ public interface SatellitePackage extends EPackage { */ EClass getInterferometryMission(); - /** - * Returns the meta object for the attribute '{@link satellite.InterferometryMission#getObservationTime Observation Time}'. - * - * - * @return the meta object for the attribute 'Observation Time'. - * @see satellite.InterferometryMission#getObservationTime() - * @see #getInterferometryMission() - * @generated - */ - EAttribute getInterferometryMission_ObservationTime(); - /** * Returns the meta object for class '{@link satellite.CommunicatingElement Communicating Element}'. * @@ -827,17 +770,6 @@ public interface SatellitePackage extends EPackage { */ EReference getCommSubsystem_Target(); - /** - * Returns the meta object for the reference list '{@link satellite.CommSubsystem#getSource Source}'. - * - * - * @return the meta object for the reference list 'Source'. - * @see satellite.CommSubsystem#getSource() - * @see #getCommSubsystem() - * @generated - */ - EReference getCommSubsystem_Source(); - /** * Returns the meta object for class '{@link satellite.Payload Payload}'. * @@ -988,14 +920,6 @@ public interface SatellitePackage extends EPackage { */ EClass INTERFEROMETRY_MISSION = eINSTANCE.getInterferometryMission(); - /** - * The meta object literal for the 'Observation Time' attribute feature. - * - * - * @generated - */ - EAttribute INTERFEROMETRY_MISSION__OBSERVATION_TIME = eINSTANCE.getInterferometryMission_ObservationTime(); - /** * The meta object literal for the '{@link satellite.impl.CommunicatingElementImpl Communicating Element}' class. * @@ -1060,14 +984,6 @@ public interface SatellitePackage extends EPackage { */ EReference COMM_SUBSYSTEM__TARGET = eINSTANCE.getCommSubsystem_Target(); - /** - * The meta object literal for the 'Source' reference list feature. - * - * - * @generated - */ - EReference COMM_SUBSYSTEM__SOURCE = eINSTANCE.getCommSubsystem_Source(); - /** * The meta object literal for the '{@link satellite.impl.PayloadImpl Payload}' class. * diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/impl/CommSubsystemImpl.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/impl/CommSubsystemImpl.java index 21e385a8..d39abd4d 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/impl/CommSubsystemImpl.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/impl/CommSubsystemImpl.java @@ -2,16 +2,11 @@ */ package satellite.impl; -import java.util.Collection; import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; -import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList; -import org.eclipse.emf.ecore.util.InternalEList; import satellite.CommSubsystem; import satellite.SatellitePackage; @@ -24,7 +19,6 @@ import satellite.SatellitePackage; *

*
    *
  • {@link satellite.impl.CommSubsystemImpl#getTarget Target}
  • - *
  • {@link satellite.impl.CommSubsystemImpl#getSource Source}
  • *
* * @generated @@ -40,16 +34,6 @@ public abstract class CommSubsystemImpl extends MinimalEObjectImpl.Container imp */ protected CommSubsystem target; - /** - * The cached value of the '{@link #getSource() Source}' reference list. - * - * - * @see #getSource() - * @generated - * @ordered - */ - protected EList source; - /** * * @@ -97,25 +81,6 @@ public abstract class CommSubsystemImpl extends MinimalEObjectImpl.Container imp return target; } - /** - * - * - * @generated - */ - public NotificationChain basicSetTarget(CommSubsystem newTarget, NotificationChain msgs) { - CommSubsystem oldTarget = target; - target = newTarget; - if (eNotificationRequired()) { - ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, - SatellitePackage.COMM_SUBSYSTEM__TARGET, oldTarget, newTarget); - if (msgs == null) - msgs = notification; - else - msgs.add(notification); - } - return msgs; - } - /** * * @@ -123,70 +88,11 @@ public abstract class CommSubsystemImpl extends MinimalEObjectImpl.Container imp */ @Override public void setTarget(CommSubsystem newTarget) { - if (newTarget != target) { - NotificationChain msgs = null; - if (target != null) - msgs = ((InternalEObject) target).eInverseRemove(this, SatellitePackage.COMM_SUBSYSTEM__SOURCE, - CommSubsystem.class, msgs); - if (newTarget != null) - msgs = ((InternalEObject) newTarget).eInverseAdd(this, SatellitePackage.COMM_SUBSYSTEM__SOURCE, - CommSubsystem.class, msgs); - msgs = basicSetTarget(newTarget, msgs); - if (msgs != null) - msgs.dispatch(); - } else if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, SatellitePackage.COMM_SUBSYSTEM__TARGET, newTarget, - newTarget)); - } - - /** - * - * - * @generated - */ - @Override - public EList getSource() { - if (source == null) { - source = new EObjectWithInverseResolvingEList(CommSubsystem.class, this, - SatellitePackage.COMM_SUBSYSTEM__SOURCE, SatellitePackage.COMM_SUBSYSTEM__TARGET); - } - return source; - } - - /** - * - * - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case SatellitePackage.COMM_SUBSYSTEM__TARGET: - if (target != null) - msgs = ((InternalEObject) target).eInverseRemove(this, SatellitePackage.COMM_SUBSYSTEM__SOURCE, - CommSubsystem.class, msgs); - return basicSetTarget((CommSubsystem) otherEnd, msgs); - case SatellitePackage.COMM_SUBSYSTEM__SOURCE: - return ((InternalEList) (InternalEList) getSource()).basicAdd(otherEnd, msgs); - } - return super.eInverseAdd(otherEnd, featureID, msgs); - } - - /** - * - * - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case SatellitePackage.COMM_SUBSYSTEM__TARGET: - return basicSetTarget(null, msgs); - case SatellitePackage.COMM_SUBSYSTEM__SOURCE: - return ((InternalEList) getSource()).basicRemove(otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); + CommSubsystem oldTarget = target; + target = newTarget; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SatellitePackage.COMM_SUBSYSTEM__TARGET, oldTarget, + target)); } /** @@ -201,8 +107,6 @@ public abstract class CommSubsystemImpl extends MinimalEObjectImpl.Container imp if (resolve) return getTarget(); return basicGetTarget(); - case SatellitePackage.COMM_SUBSYSTEM__SOURCE: - return getSource(); } return super.eGet(featureID, resolve, coreType); } @@ -219,10 +123,6 @@ public abstract class CommSubsystemImpl extends MinimalEObjectImpl.Container imp case SatellitePackage.COMM_SUBSYSTEM__TARGET: setTarget((CommSubsystem) newValue); return; - case SatellitePackage.COMM_SUBSYSTEM__SOURCE: - getSource().clear(); - getSource().addAll((Collection) newValue); - return; } super.eSet(featureID, newValue); } @@ -238,9 +138,6 @@ public abstract class CommSubsystemImpl extends MinimalEObjectImpl.Container imp case SatellitePackage.COMM_SUBSYSTEM__TARGET: setTarget((CommSubsystem) null); return; - case SatellitePackage.COMM_SUBSYSTEM__SOURCE: - getSource().clear(); - return; } super.eUnset(featureID); } @@ -255,8 +152,6 @@ public abstract class CommSubsystemImpl extends MinimalEObjectImpl.Container imp switch (featureID) { case SatellitePackage.COMM_SUBSYSTEM__TARGET: return target != null; - case SatellitePackage.COMM_SUBSYSTEM__SOURCE: - return source != null && !source.isEmpty(); } return super.eIsSet(featureID); } diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/impl/InterferometryMissionImpl.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/impl/InterferometryMissionImpl.java index 3401ad51..450f8a9a 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/impl/InterferometryMissionImpl.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/impl/InterferometryMissionImpl.java @@ -2,12 +2,7 @@ */ package satellite.impl; -import org.eclipse.emf.common.notify.Notification; - import org.eclipse.emf.ecore.EClass; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; - import satellite.InterferometryMission; import satellite.SatellitePackage; @@ -15,36 +10,10 @@ import satellite.SatellitePackage; * * An implementation of the model object 'Interferometry Mission'. * - *

- * The following features are implemented: - *

- *
    - *
  • {@link satellite.impl.InterferometryMissionImpl#getObservationTime Observation Time}
  • - *
* * @generated */ public class InterferometryMissionImpl extends ConstellationMissionImpl implements InterferometryMission { - /** - * The default value of the '{@link #getObservationTime() Observation Time}' attribute. - * - * - * @see #getObservationTime() - * @generated - * @ordered - */ - protected static final float OBSERVATION_TIME_EDEFAULT = 2.0F; - - /** - * The cached value of the '{@link #getObservationTime() Observation Time}' attribute. - * - * - * @see #getObservationTime() - * @generated - * @ordered - */ - protected float observationTime = OBSERVATION_TIME_EDEFAULT; - /** * * @@ -64,103 +33,4 @@ public class InterferometryMissionImpl extends ConstellationMissionImpl implemen return SatellitePackage.Literals.INTERFEROMETRY_MISSION; } - /** - * - * - * @generated - */ - @Override - public float getObservationTime() { - return observationTime; - } - - /** - * - * - * @generated - */ - @Override - public void setObservationTime(float newObservationTime) { - float oldObservationTime = observationTime; - observationTime = newObservationTime; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, - SatellitePackage.INTERFEROMETRY_MISSION__OBSERVATION_TIME, oldObservationTime, observationTime)); - } - - /** - * - * - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case SatellitePackage.INTERFEROMETRY_MISSION__OBSERVATION_TIME: - return getObservationTime(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * - * - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case SatellitePackage.INTERFEROMETRY_MISSION__OBSERVATION_TIME: - setObservationTime((Float) newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * - * - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case SatellitePackage.INTERFEROMETRY_MISSION__OBSERVATION_TIME: - setObservationTime(OBSERVATION_TIME_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * - * - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case SatellitePackage.INTERFEROMETRY_MISSION__OBSERVATION_TIME: - return observationTime != OBSERVATION_TIME_EDEFAULT; - } - return super.eIsSet(featureID); - } - - /** - * - * - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) - return super.toString(); - - StringBuilder result = new StringBuilder(super.toString()); - result.append(" (observationTime: "); - result.append(observationTime); - result.append(')'); - return result.toString(); - } - } //InterferometryMissionImpl diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/impl/SatellitePackageImpl.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/impl/SatellitePackageImpl.java index 17212a96..f6dc1e30 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/impl/SatellitePackageImpl.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/impl/SatellitePackageImpl.java @@ -2,7 +2,6 @@ */ package satellite.impl; -import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.EReference; @@ -242,16 +241,6 @@ public class SatellitePackageImpl extends EPackageImpl implements SatellitePacka return interferometryMissionEClass; } - /** - * - * - * @generated - */ - @Override - public EAttribute getInterferometryMission_ObservationTime() { - return (EAttribute) interferometryMissionEClass.getEStructuralFeatures().get(0); - } - /** * * @@ -322,16 +311,6 @@ public class SatellitePackageImpl extends EPackageImpl implements SatellitePacka return (EReference) commSubsystemEClass.getEStructuralFeatures().get(0); } - /** - * - * - * @generated - */ - @Override - public EReference getCommSubsystem_Source() { - return (EReference) commSubsystemEClass.getEStructuralFeatures().get(1); - } - /** * * @@ -457,7 +436,6 @@ public class SatellitePackageImpl extends EPackageImpl implements SatellitePacka createEReference(constellationMissionEClass, CONSTELLATION_MISSION__SPACECRAFT); interferometryMissionEClass = createEClass(INTERFEROMETRY_MISSION); - createEAttribute(interferometryMissionEClass, INTERFEROMETRY_MISSION__OBSERVATION_TIME); communicatingElementEClass = createEClass(COMMUNICATING_ELEMENT); createEReference(communicatingElementEClass, COMMUNICATING_ELEMENT__COMM_SUBSYSTEM); @@ -469,7 +447,6 @@ public class SatellitePackageImpl extends EPackageImpl implements SatellitePacka commSubsystemEClass = createEClass(COMM_SUBSYSTEM); createEReference(commSubsystemEClass, COMM_SUBSYSTEM__TARGET); - createEReference(commSubsystemEClass, COMM_SUBSYSTEM__SOURCE); payloadEClass = createEClass(PAYLOAD); @@ -537,15 +514,12 @@ public class SatellitePackageImpl extends EPackageImpl implements SatellitePacka initEReference(getConstellationMission_GroundStationNetwork(), this.getGroundStationNetwork(), null, "groundStationNetwork", null, 1, 1, ConstellationMission.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getConstellationMission_Spacecraft(), this.getSpacecraft(), null, "spacecraft", null, 2, 50, + initEReference(getConstellationMission_Spacecraft(), this.getSpacecraft(), null, "spacecraft", null, 2, -1, ConstellationMission.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(interferometryMissionEClass, InterferometryMission.class, "InterferometryMission", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getInterferometryMission_ObservationTime(), ecorePackage.getEFloat(), "observationTime", "2.0", - 1, 1, InterferometryMission.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, - IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(communicatingElementEClass, CommunicatingElement.class, "CommunicatingElement", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); @@ -564,12 +538,9 @@ public class SatellitePackageImpl extends EPackageImpl implements SatellitePacka initEClass(commSubsystemEClass, CommSubsystem.class, "CommSubsystem", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getCommSubsystem_Target(), this.getCommSubsystem(), this.getCommSubsystem_Source(), "target", - null, 0, 1, CommSubsystem.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, - IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getCommSubsystem_Source(), this.getCommSubsystem(), this.getCommSubsystem_Target(), "source", - null, 0, -1, CommSubsystem.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, - IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getCommSubsystem_Target(), this.getCommSubsystem(), null, "target", null, 0, 1, + CommSubsystem.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, + !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(payloadEClass, Payload.class, "Payload", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/inputs/SatelliteInstance.xmi b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/inputs/SatelliteInstance.xmi index 7b8e355a..3d07a199 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/inputs/SatelliteInstance.xmi +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/inputs/SatelliteInstance.xmi @@ -4,11 +4,4 @@ xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:satellite="http://www.example.org/satellite" - xsi:schemaLocation="http://www.example.org/satellite ../model/satellite.ecore"> - - - - - + xsi:schemaLocation="http://www.example.org/satellite ../model/satellite.ecore"/> diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite.ecore b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite.ecore index 1685c756..9f17d43c 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite.ecore +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite.ecore @@ -5,12 +5,9 @@ - - - + upperBound="-1" eType="#//Spacecraft" containment="true"/> + @@ -21,10 +18,7 @@ containment="true"/> - - + diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite.genmodel b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite.genmodel index 09b5f64c..bc98abd6 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite.genmodel +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite.genmodel @@ -15,9 +15,7 @@ - - - + @@ -27,7 +25,6 @@ - diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite.henshin b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite.henshin deleted file mode 100644 index 33059424..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite.henshin +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite.henshin_diagram b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite.henshin_diagram deleted file mode 100644 index a5c675d8..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite.henshin_diagram +++ /dev/null @@ -1,131 +0,0 @@ - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite_fixup.henshin b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite_fixup.henshin deleted file mode 100644 index 224ced8f..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite_fixup.henshin +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 a07867dc..b0b77996 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/plugin.xml +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/plugin.xml @@ -8,6 +8,7 @@ + diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/representations.aird b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/representations.aird new file mode 100644 index 00000000..efa8e366 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/representations.aird @@ -0,0 +1,2 @@ + + diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/CostObjective.xtend b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/CostObjective.xtend deleted file mode 100644 index 43b2902f..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/CostObjective.xtend +++ /dev/null @@ -1,13 +0,0 @@ -package hu.bme.mit.inf.dslreasoner.domains.satellite.mdeo - -//import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CostMetric -// -//class CostObjective extends MetricBasedGuidanceFunction { -// new() { -// super(CostMetric.instance) -// } -// -// override getName() { -// "Cost" -// } -//} diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/LocalSearchEngineManager.xtend b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/LocalSearchEngineManager.xtend deleted file mode 100644 index ee7f0060..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/LocalSearchEngineManager.xtend +++ /dev/null @@ -1,31 +0,0 @@ -package hu.bme.mit.inf.dslreasoner.domains.satellite.mdeo - -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SatelliteQueries -import java.util.WeakHashMap -import org.eclipse.emf.ecore.EObject -import org.eclipse.viatra.query.runtime.api.AdvancedViatraQueryEngine -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngineOptions -import org.eclipse.viatra.query.runtime.emf.EMFScope -import org.eclipse.viatra.query.runtime.localsearch.matcher.integration.LocalSearchHints - -class LocalSearchEngineManager { - public static val INSTANCE = new LocalSearchEngineManager - - val WeakHashMap engineMap = new WeakHashMap - - private new() { - } - - def getEngine(EObject eObject) { - engineMap.computeIfAbsent(eObject) [ - val scope = new EMFScope(it) - val localSearchHints = LocalSearchHints.^default.build - val options = ViatraQueryEngineOptions.defineOptions.withDefaultHint(localSearchHints).withDefaultBackend( - localSearchHints.queryBackendFactory).build - val engine = AdvancedViatraQueryEngine.on(scope, options) - SatelliteQueries.instance.prepare(engine) - engine - ] - } -} diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/MetricBasedGuidanceFunction.xtend b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/MetricBasedGuidanceFunction.xtend deleted file mode 100644 index 1529794f..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/MetricBasedGuidanceFunction.xtend +++ /dev/null @@ -1,47 +0,0 @@ -package hu.bme.mit.inf.dslreasoner.domains.satellite.mdeo - -import org.eclipse.viatra.query.runtime.api.IPatternMatch -import org.eclipse.viatra.query.runtime.api.IQuerySpecification -import org.eclipse.viatra.query.runtime.api.ViatraQueryMatcher -import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.IGuidanceFunction -import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.interpreter.guidance.Solution - -abstract class MetricBasedGuidanceFunction implements IGuidanceFunction { - val IQuerySpecification> querySpecification - - protected new(IQuerySpecification> querySpecification) { - this.querySpecification = querySpecification - if (querySpecification.parameters.size != 1) { - throw new IllegalArgumentException("Metric must have a single parameter") - } - } - - override computeFitness(Solution model) { - val value = getMetricValue(model) - computeFitness(value) - } - - protected def double computeFitness(double metricValue) { - metricValue - } - - private def getMetricValue(Solution solution) { - val model = solution.model - val queryEngine = LocalSearchEngineManager.INSTANCE.getEngine(model) - val matcher = querySpecification.getMatcher(queryEngine) - val iterator = matcher.allMatches.iterator - if (!iterator.hasNext) { - throw new IllegalStateException("Too few matches") - } - val objectValue = iterator.next.get(0) - if (objectValue instanceof Number) { - val doubleValue = objectValue.doubleValue - if (iterator.hasNext) { - throw new IllegalStateException("Too many matches") - } - doubleValue - } else { - throw new IllegalStateException("Metric value must be a number") - } - } -} diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/PatternMatchConstraint.xtend b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/PatternMatchConstraint.xtend deleted file mode 100644 index b238e64f..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/PatternMatchConstraint.xtend +++ /dev/null @@ -1,29 +0,0 @@ -package hu.bme.mit.inf.dslreasoner.domains.satellite.mdeo - -import com.google.common.collect.ImmutableList -import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.SatelliteQueries -import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.IGuidanceFunction -import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.interpreter.guidance.Solution - -class PatternMatchConstraint implements IGuidanceFunction { - static val CONSTRAINT_ANNOTATION_NAME = "Constraint" - - val queries = ImmutableList.copyOf(SatelliteQueries.instance.specifications.filter [ - allAnnotations.exists[name == CONSTRAINT_ANNOTATION_NAME] - ]) - - override getName() { - "PatternMatch" - } - - override computeFitness(Solution solution) { - val model = solution.model - val queryEngine = LocalSearchEngineManager.INSTANCE.getEngine(model) - var int matchCount = 0 - for (query : queries) { - val matcher = query.getMatcher(queryEngine) - matchCount += matcher.countMatches - } - matchCount - } -} diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/SatelliteMdeOptimiserMain.xtend b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/SatelliteMdeOptimiserMain.xtend deleted file mode 100644 index 58034c43..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/SatelliteMdeOptimiserMain.xtend +++ /dev/null @@ -1,51 +0,0 @@ -package hu.bme.mit.inf.dslreasoner.domains.satellite.mdeo - -import java.io.BufferedReader -import java.io.BufferedWriter -import java.io.FileReader -import java.io.FileWriter -import java.util.Map -import org.eclipse.emf.ecore.EPackage -import org.eclipse.emf.ecore.resource.Resource -import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl -import satellite.SatellitePackage -import uk.ac.kcl.inf.mdeoptimiser.interfaces.cli.Run - -class SatelliteMdeOptimiserMain { - static val PROJECT_PATH = "." - static val MOPT_PATH = "src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/satellite.mopt" - - private new() { - new IllegalStateException("This is a static utility class and should not be instantiated directly.") - } - - public static def void main(String[] args) { - Resource.Factory.Registry.INSTANCE.extensionToFactoryMap.put(Resource.Factory.Registry.DEFAULT_EXTENSION, - new XMIResourceFactoryImpl) - EPackage.Registry.INSTANCE.put(SatellitePackage.eNS_URI, SatellitePackage.eINSTANCE) - fixupHenshinModel("model/satellite.henshin", "model/satellite_fixup.henshin", - #{"satellite.ecore" -> SatellitePackage.eNS_URI}) - Run.main(#["-p", PROJECT_PATH, "-m", MOPT_PATH]) - } - - private def static void fixupHenshinModel(String originalPath, String outputPath, Map remapMap) { - val reader = new BufferedReader(new FileReader(originalPath)) - try { - val writer = new BufferedWriter(new FileWriter(outputPath)) - try { - var String line - while ((line = reader.readLine) !== null) { - for (entry : remapMap.entrySet) { - line = line.replace(entry.key, entry.value) - } - writer.write(line) - writer.write("\n") - } - } finally { - writer.close - } - } finally { - reader.close - } - } -} diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/satellite.mopt b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/satellite.mopt deleted file mode 100644 index e9bd1a64..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/satellite.mopt +++ /dev/null @@ -1,36 +0,0 @@ -problem { - basepath - metamodel - model <../inputs/SatelliteInstance.xmi> -} - -goal { - objective Cost minimise java { "hu.bme.mit.inf.dslreasoner.domains.satellite.mdeo.CostObjective" } - constraint PatternMatch java { "hu.bme.mit.inf.dslreasoner.domains.satellite.mdeo.PatternMatchConstraint" } -} - -search { -// mutate using unit "addCubeSat3U" - mutate { "CubeSat3U" } - mutate { "CubeSat6U" } - mutate { "SmallSat" } - mutate { "InterferometryPayload" } - mutate { "UHFCommSubsystem" } - mutate { "XCommSubsystem" } - mutate { "KaCommSubsystem" } -} - -solver { - optimisation provider moea algorithm NSGAII { - variation: mutation - population: 25 - mutation.step: 3 - mutation.strategy: random - } - - termination { - time: 120 - } - - batches 1 -} \ No newline at end of file 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 c1d3f7d3..1f83a3b0 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 @@ -21,6 +21,13 @@ pattern transmittingGroundStationNetwork(Station : GroundStationNetwork) { find transmittingCommSubsystem(Station, _); } +@Constraint(severity = "error", key = {Station}, + message = "The ground station network may not have UHF communication subsystems.") +pattern roundStationNetworkUHF(Station : GroundStationNetwork) { + CommunicatingElement.commSubsystem(Station, Comm); + UHFCommSubsystem(Comm); +} + // At least two spacecraft must have the interferometry payload configured @Constraint(severity = "error", key = {Mission}, @@ -97,10 +104,6 @@ private pattern cubeSat3U(Sat : CubeSat3U) { CubeSat3U(Sat); } -private pattern cubeSat6U(Sat : CubeSat6U) { - CubeSat6U(Sat); -} - // No communication loops may exist // No spacecraft may directly communicate with itself diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph/META-INF/MANIFEST.MF b/Domains/hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph/META-INF/MANIFEST.MF index 81ee8677..2666dc5e 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph/META-INF/MANIFEST.MF +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph/META-INF/MANIFEST.MF @@ -9,8 +9,7 @@ Bundle-Localization: plugin Export-Package: hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph.yakindumm, hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph.yakindumm.impl, hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph.yakindumm.util, - hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu, - hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.mutated + hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu Require-Bundle: org.eclipse.viatra.query.runtime, org.eclipse.core.runtime, org.eclipse.emf.ecore;visibility:=reexport, 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 993ec75d..7bf4a20b 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 @@ -9,6 +9,8 @@ + + @@ -21,10 +23,14 @@ + + + + @@ -32,72 +38,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph/queries/hu/bme/mit/inf/dslreasoner/partialsnapshot_mavo/yakindu/mutated/mutated.vql b/Domains/hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph/queries/hu/bme/mit/inf/dslreasoner/partialsnapshot_mavo/yakindu/mutated/mutated.vql deleted file mode 100644 index 58f66fe2..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph/queries/hu/bme/mit/inf/dslreasoner/partialsnapshot_mavo/yakindu/mutated/mutated.vql +++ /dev/null @@ -1,270 +0,0 @@ -package hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.mutated - -import epackage "hu.bme.mit.inf.yakindumm" - -///////// -// Entry -///////// - -pattern entryInRegion_M0(r1 : Region, e1 : Entry) { - Region.vertices(r1, e1); -} -pattern entryInRegion_M1(r1 : Region, e1) { - Region.vertices(r1, e1); -} -pattern entryInRegion_M2(r1 : Region, e1: Entry) { - // For positive constraint - Region(r1);Entry(e1); -} - - -//@Constraint(severity="error", message="error", key = {r1}) -pattern noEntryInRegion_M0(r1 : Region) { - neg find entryInRegion_M0(r1, _); -} -pattern noEntryInRegion_M1(r1 : Region) { - neg find entryInRegion_M1(r1, _); -} -pattern noEntryInRegion_M2(r1 : Region) { - neg find entryInRegion_M2(r1, _); -} -pattern noEntryInRegion_M3(r1 : Region) { - find entryInRegion_M0(r1, _); -} -pattern noEntryInRegion_M4(r1 : Region) { - find entryInRegion_M1(r1, _); -} -pattern noEntryInRegion_M5(r1 : Region) { - find entryInRegion_M2(r1, _); -} - -//@Constraint(severity="error", message="error", key = {r}) -pattern multipleEntryInRegion_M0(r : Region) { - find entryInRegion_M0(r, e1); - find entryInRegion_M0(r, e2); - e1 != e2; -} -pattern multipleEntryInRegion_M1(r : Region) { - find entryInRegion_M1(r, e1); - find entryInRegion_M0(r, e2); - e1 != e2; -} -pattern multipleEntryInRegion_M2(r : Region) { - find entryInRegion_M2(r, e1); - find entryInRegion_M0(r, e2); - e1 != e2; -} -pattern multipleEntryInRegion_M3(r : Region) { - find entryInRegion_M0(r, e1); - find entryInRegion_M1(r, e2); - e1 != e2; -} -pattern multipleEntryInRegion_M4(r : Region) { - find entryInRegion_M2(r, e1); - find entryInRegion_M2(r, e2); - e1 != e2; -} -pattern multipleEntryInRegion_M5(r : Region) { - find entryInRegion_M0(r, e1); - find entryInRegion_M0(r, e2); -} - - -pattern transition_M0(t : Transition, src : Vertex, trg : Vertex) { - Transition.source(t, src); - Transition.target(t, trg); -} -pattern transition_M1(t : Transition, src : Vertex, trg : Vertex) { - Transition.source(t, src); - Vertex(trg); -} -pattern transition_M2(t : Transition, src : Vertex, trg : Vertex) { - Vertex(src); - Transition.target(t, trg); -} -pattern transition_M3(t : Transition, src : Vertex, trg : Vertex) { - Transition.source(t_x, src); - Transition.target(t, trg); -} -pattern transition_M4(t : Transition, src : Vertex, trg : Vertex) { - Transition.source(t, src); - Transition.target(t_x, trg); -} - -//@Constraint(severity="error", message="error", key = {e}) -pattern incomingToEntry_M0(t : Transition, e : Entry) { - find transition_M0(t, _, e); -} -pattern incomingToEntry_1(t : Transition, e) { - find transition_M0(t, _, e); -} -pattern incomingToEntry_2(t : Transition, e : Entry) { - find transition_M1(t, _, e); -} -pattern incomingToEntry_3(t : Transition, e : Entry) { - find transition_M2(t, _, e); -} -pattern incomingToEntry_4(t : Transition, e : Entry) { - find transition_M3(t, _, e); -} -pattern incomingToEntry_5(t : Transition, e : Entry) { - find transition_M4(t, _, e); -} - -pattern noOutgoingTransitionFromEntry_M0(e : Entry) { - neg find transition_M0(_, e, _); -} - -pattern noOutgoingTransitionFromEntry_M1(e) { - Vertex(e); - neg find transition_M0(_, e, _); -} -pattern noOutgoingTransitionFromEntry_M2(e : Entry) { - neg find transition_M1(_, e, _); -} -pattern noOutgoingTransitionFromEntry_M3(e : Entry) { - neg find transition_M2(_, e, _); -} -pattern noOutgoingTransitionFromEntry_M4(e : Entry) { - neg find transition_M3(_, e, _); -} -pattern noOutgoingTransitionFromEntry_M5(e : Entry) { - neg find transition_M4(_, e, _); -} - - -//@Constraint(severity="error", message="error", key = {e}) -pattern multipleTransitionFromEntry_M0(e : Entry, t1 : Transition, t2: Transition) { - Entry.outgoingTransitions(e,t1); - Entry.outgoingTransitions(e,t2); - t1!=t2; -} -pattern multipleTransitionFromEntry_M1(e, t1 : Transition, t2: Transition) { - Entry.outgoingTransitions(e,t1); - Entry.outgoingTransitions(e,t2); - t1!=t2; -} -pattern multipleTransitionFromEntry_M2(e : Entry, t1 : Transition, t2: Transition) { - Transition(t1); - Entry.outgoingTransitions(e,t2); - t1!=t2; -} -pattern multipleTransitionFromEntry_M3(e : Entry, t1 : Transition, t2: Transition) { - Entry.outgoingTransitions(e,t1); - Transition(t2); - t1!=t2; -} -pattern multipleTransitionFromEntry_M4(e : Entry, t1 : Transition, t2: Transition) { - Entry.outgoingTransitions(e,t1); - Entry.outgoingTransitions(e,t2); -} - -///////// -// Exit -///////// - -//@Constraint(severity="error", message="error", key = {e}) -pattern outgoingFromExit_M0(t : Transition, e : Exit) { - Exit.outgoingTransitions(e,t); -} -pattern outgoingFromExit_M1(t : Transition, e) { - Vertex.outgoingTransitions(e,t); -} -pattern outgoingFromExit_M2(t : Transition, e : Exit) { - Transition(t); - Exit(e); -} - -///////// -// Final -///////// - -//@Constraint(severity="error", message="error", key = {f}) -pattern outgoingFromFinal_M0(t : Transition, f : FinalState) { - FinalState.outgoingTransitions(f,t); -} -pattern outgoingFromFinal_M1(t : Transition, f) { - Vertex.outgoingTransitions(f,t); -} -pattern outgoingFromFinal_M2(t : Transition, f : FinalState) { - Transition(t); - FinalState(f); -} - -///////// -// State vs Region -///////// - -//@Constraint(severity="error", message="error", key = {region}) -pattern noStateInRegion_M0(region: Region) { - neg find StateInRegion_M0(region,_); -} -pattern noStateInRegion_M1(region: Region) { - neg find StateInRegion_M1(region,_); -} -pattern noStateInRegion_M2(region: Region) { - neg find StateInRegion_M2(region,_); -} -pattern noStateInRegion_M3(region: Region) { - find StateInRegion_M0(region,_); -} - -pattern StateInRegion_M0(region: Region, state: State) { - Region.vertices(region,state); -} -pattern StateInRegion_M1(region: Region, state) { - Region.vertices(region,state); -} -pattern StateInRegion_M2(region: Region, state:State) { - Region(region);State(state); -} - -///////// -// Choice -///////// - -@Constraint(severity="error", message="error", key = {c}) -pattern choiceHasNoOutgoing_M0(c : Choice) { - neg find transition_M0(_, c, _); -} -pattern choiceHasNoOutgoing_M1(c:Vertex) { - neg find transition_M0(_, c, _); -} -pattern choiceHasNoOutgoing_M2(c : Choice) { - neg find transition_M1(_, c, _); -} -pattern choiceHasNoOutgoing_M3(c : Choice) { - neg find transition_M2(_, c, _); -} -pattern choiceHasNoOutgoing_M4(c : Choice) { - neg find transition_M3(_, c, _); -} -pattern choiceHasNoOutgoing_M5(c : Choice) { - neg find transition_M4(_, c, _); -} -pattern choiceHasNoOutgoing_M6(c : Choice) { - find transition_M0(_, c, _); -} - -@Constraint(severity="error", message="error", key = {c}) -pattern choiceHasNoIncoming_M0(c: Choice) { - neg find transition_M0(_, _, c); -} -pattern choiceHasNoIncoming_M1(c:Vertex) { - neg find transition_M0(_, _, c); -} -pattern choiceHasNoIncoming_M2(c: Choice) { - neg find transition_M1(_, _, c); -} -pattern choiceHasNoIncoming_M3(c: Choice) { - neg find transition_M2(_, _, c); -} -pattern choiceHasNoIncoming_M4(c: Choice) { - neg find transition_M3(_, _, c); -} -pattern choiceHasNoIncoming_M5(c: Choice) { - neg find transition_M4(_, _, c); -} -pattern choiceHasNoIncoming_M6(c: Choice) { - find transition_M0(_, _, c); -} 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 f4bfa3c1..98a10cde 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 @@ -27,14 +27,22 @@ pattern transition(t : Transition, src : Vertex, trg : Vertex) { Transition.target(t, trg); } +pattern transitionFrom(t : Transition, src : Vertex) { + Transition.source(t, src); +} + +pattern transitionTo(t : Transition, trg : Vertex) { + Transition.target(t, trg); +} + @Constraint(severity="error", message="error", key = {e}) pattern incomingToEntry(t : Transition, e : Entry) { - find transition(t, _, e); + find transitionTo(t, e); } @Constraint(severity="error", message="error", key = {e}) pattern noOutgoingTransitionFromEntry(e : Entry) { - neg find transition(_, e, _); + neg find transitionFrom(_, e); } @Constraint(severity="error", message="error", key = {e}) @@ -80,12 +88,12 @@ pattern StateInRegion(region: Region, state: State) { @Constraint(severity="error", message="error", key = {c}) pattern choiceHasNoOutgoing(c : Choice) { - neg find transition(_, c, _); + neg find transitionFrom(_, c); } @Constraint(severity="error", message="error", key = {c}) pattern choiceHasNoIncoming(c: Choice) { - neg find transition(_, _, c); + neg find transitionTo(_, c); } ///////// @@ -94,27 +102,33 @@ pattern choiceHasNoIncoming(c: Choice) { @Constraint(severity="error", message="error", key = {s}) pattern synchHasNoOutgoing(s : Synchronization) { - neg find transition(_, s, _); + neg find transitionFrom(_, s); } @Constraint(severity="error", message="error", key = {s}) pattern synchHasNoIncoming(s : Synchronization) { - neg find transition(_, _, s); + neg find transitionTo(_, s); } @Constraint(severity="error", message="error", key = {s}) -pattern SynchronizedIncomingInSameRegion(s : Synchronization, v1 : Vertex, v2 : Vertex) { - find transition(t1, v1, s); - find transition(t2, v2, s); +pattern SynchronizedIncomingInSameRegion(s : Synchronization, t1 : Transition, t2 : Transition) { + find SynchronizedIncomingInSameRegionHelper1(r, s, t1); + find SynchronizedIncomingInSameRegionHelper1(r, s, t2); t1!=t2; - Region.vertices(r, v1); - Region.vertices(r, v2); } or { - find transition(t1, s, v1); - find transition(t2, s, v2); + find SynchronizedIncomingInSameRegionHelper2(r, s, t1); + find SynchronizedIncomingInSameRegionHelper2(r, s, t2); t1!=t2; +} + +pattern SynchronizedIncomingInSameRegionHelper1(r : Region, s : Synchronization, t1 : Transition) { + find transition(t1, v1, s); + Region.vertices(r, v1); +} + +pattern SynchronizedIncomingInSameRegionHelper2(r : Region, s : Synchronization, t1 : Transition) { + find transition(t1, s, v1); Region.vertices(r, v1); - Region.vertices(r, v2); } @Constraint(severity="error", message="error", key = {s}) @@ -136,18 +150,24 @@ pattern hasMultipleIncomingTrainsition(v : Synchronization) { } @Constraint(severity="error", message="error", key = {s}) -pattern SynchronizedRegionsAreNotSiblings(s : Synchronization, v1 : Vertex, v2 : Vertex) { - find transition(_, v1, s); - find transition(_, v2, s); - CompositeElement.regions.vertices(r1, v1); - CompositeElement.regions.vertices(r2, v2); +pattern SynchronizedRegionsAreNotSiblings(s : Synchronization, r1 : CompositeElement, r2 : CompositeElement) { + find SynchronizedRegionsAreNotSiblingsHelper1(s, r1); + find SynchronizedRegionsAreNotSiblingsHelper1(s, r2); r1 != r2; } or { + find SynchronizedRegionsAreNotSiblingsHelper2(s, r1); + find SynchronizedRegionsAreNotSiblingsHelper2(s, r2); + r1 != r2; +} + +pattern SynchronizedRegionsAreNotSiblingsHelper1(s : Synchronization, r1 : CompositeElement) { find transition(_, s, v1); - find transition(_, s, v2); CompositeElement.regions.vertices(r1, v1); - CompositeElement.regions.vertices(r2, v2); - r1 != r2; +} + +pattern SynchronizedRegionsAreNotSiblingsHelper2(s : Synchronization, r1 : CompositeElement) { + find transition(_, v1, s); + CompositeElement.regions.vertices(r1, v1); } /////////////////////////////// diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/ModelGenerationMethodProvider.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/ModelGenerationMethodProvider.xtend index 23632d4d..e45ec1c8 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/ModelGenerationMethodProvider.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/ModelGenerationMethodProvider.xtend @@ -5,6 +5,7 @@ import hu.bme.mit.inf.dslreasoner.logic.model.builder.DocumentationLevel import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem import hu.bme.mit.inf.dslreasoner.viatra2logic.viatra2logicannotations.TransfomedViatraQuery import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.CbcPolyhedronSolver +import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.LinearTypeConstraintHint import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.MultiplicityGoalConstraintCalculator import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.PolyhedronScopePropagator import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.RelationConstraintCalculator @@ -46,16 +47,28 @@ class ModelGenerationStatistics { public var long preliminaryTypeAnalisisTime = 0 public var int decisionsTried = 0 - + synchronized def incrementDecisionCount() { decisionsTried++ } + + public var int transformationInvocations + synchronized def incrementTransformationCount() { + transformationInvocations++ + } + public var int scopePropagatorInvocations - + synchronized def incrementScopePropagationCount() { scopePropagatorInvocations++ } + + public var int scopePropagatorSolverInvocations + + synchronized def incrementScopePropagationSolverCount() { + scopePropagatorSolverInvocations++ + } } @Data class ModelGenerationMethod { @@ -93,6 +106,7 @@ class ModelGenerationMethodProvider { boolean nameNewElements, TypeInferenceMethod typeInferenceMethod, ScopePropagatorStrategy scopePropagatorStrategy, + Collection hints, DocumentationLevel debugLevel ) { val statistics = new ModelGenerationStatistics @@ -103,8 +117,8 @@ class ModelGenerationMethodProvider { val relationConstraints = relationConstraintCalculator.calculateRelationConstraints(logicProblem) val queries = patternProvider.generateQueries(logicProblem, emptySolution, statistics, existingQueries, - workspace, typeInferenceMethod, scopePropagatorStrategy, relationConstraints, writeFiles) - val scopePropagator = createScopePropagator(scopePropagatorStrategy, emptySolution, queries, statistics) + workspace, typeInferenceMethod, scopePropagatorStrategy, relationConstraints, hints, writeFiles) + val scopePropagator = createScopePropagator(scopePropagatorStrategy, emptySolution, hints, queries, statistics) scopePropagator.propagateAllScopeConstraints val objectRefinementRules = refinementRuleProvider.createObjectRefinementRules(queries, scopePropagator, nameNewElements, statistics) @@ -138,14 +152,20 @@ class ModelGenerationMethodProvider { } private def createScopePropagator(ScopePropagatorStrategy scopePropagatorStrategy, - PartialInterpretation emptySolution, GeneratedPatterns queries, ModelGenerationStatistics statistics) { + PartialInterpretation emptySolution, Collection hints, GeneratedPatterns queries, + ModelGenerationStatistics statistics) { + if (!hints.empty && !(scopePropagatorStrategy instanceof ScopePropagatorStrategy.Polyhedral)) { + throw new IllegalArgumentException("Only the Polyhedral scope propagator strategy can use hints.") + } switch (scopePropagatorStrategy) { - case ScopePropagatorStrategy.Count: + case ScopePropagatorStrategy.None, + case ScopePropagatorStrategy.Basic: new ScopePropagator(emptySolution, statistics) case ScopePropagatorStrategy.BasicTypeHierarchy: new TypeHierarchyScopePropagator(emptySolution, statistics) ScopePropagatorStrategy.Polyhedral: { val types = queries.refineObjectQueries.keySet.map[newType].toSet + val allPatternsByName = queries.allQueries.toMap[fullyQualifiedName] val solver = switch (scopePropagatorStrategy.solver) { case Z3Integer: new Z3PolyhedronSolver(false, scopePropagatorStrategy.timeoutSeconds) @@ -160,7 +180,8 @@ class ModelGenerationMethodProvider { scopePropagatorStrategy.solver) } new PolyhedronScopePropagator(emptySolution, statistics, types, queries.multiplicityConstraintQueries, - queries.hasElementInContainmentQuery, solver, scopePropagatorStrategy.requiresUpperBoundIndexing) + queries.hasElementInContainmentQuery, allPatternsByName, hints, solver, + scopePropagatorStrategy.requiresUpperBoundIndexing, scopePropagatorStrategy.updateHeuristic) } default: throw new IllegalArgumentException("Unknown scope propagator strategy: " + scopePropagatorStrategy) diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/LinearTypeConstraintHint.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/LinearTypeConstraintHint.xtend new file mode 100644 index 00000000..8c21ca1d --- /dev/null +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/LinearTypeConstraintHint.xtend @@ -0,0 +1,30 @@ +package hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality + +import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Type +import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.patterns.PatternGenerator +import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation +import org.eclipse.viatra.query.runtime.api.IPatternMatch +import org.eclipse.viatra.query.runtime.api.ViatraQueryMatcher + +interface LinearTypeExpressionBuilderFactory { + def ViatraQueryMatcher createMatcher(String queryName) + + def LinearTypeExpressionBuilder createBuilder() +} + +interface LinearTypeExpressionBuilder { + def LinearTypeExpressionBuilder add(int scale, Type type) + + def LinearBoundedExpression build() +} + +@FunctionalInterface +interface RelationConstraintUpdater { + def void update(PartialInterpretation p) +} + +interface LinearTypeConstraintHint { + def CharSequence getAdditionalPatterns(PatternGenerator patternGenerator) + + def RelationConstraintUpdater createConstraintUpdater(LinearTypeExpressionBuilderFactory builderFactory) +} diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/PolyhedronScopePropagator.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/PolyhedronScopePropagator.xtend index 7c05e818..51dba244 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/PolyhedronScopePropagator.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/PolyhedronScopePropagator.xtend @@ -1,5 +1,7 @@ package hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality +import com.google.common.cache.Cache +import com.google.common.cache.CacheBuilder import com.google.common.collect.ImmutableList import com.google.common.collect.ImmutableMap import com.google.common.collect.ImmutableSet @@ -15,6 +17,7 @@ import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.par import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.Scope import java.util.ArrayDeque import java.util.ArrayList +import java.util.Collection import java.util.HashMap import java.util.HashSet import java.util.List @@ -29,26 +32,33 @@ import org.eclipse.viatra.query.runtime.emf.EMFScope import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor class PolyhedronScopePropagator extends TypeHierarchyScopePropagator { + static val CACHE_SIZE = 10000 + + val boolean updateHeuristic val Map scopeBounds val LinearBoundedExpression topLevelBounds val Polyhedron polyhedron val PolyhedronSaturationOperator operator val Set relevantRelations + val Cache cache = CacheBuilder.newBuilder.maximumSize(CACHE_SIZE).build List updaters = emptyList new(PartialInterpretation p, ModelGenerationStatistics statistics, Set possibleNewDynamicTypes, Map unfinishedMultiplicityQueries, IQuerySpecification> hasElementInContainmentQuery, - PolyhedronSolver solver, boolean propagateRelations) { + Map>> allPatternsByName, + Collection hints, PolyhedronSolver solver, boolean propagateRelations, + boolean updateHeuristic) { super(p, statistics) + this.updateHeuristic = updateHeuristic val builder = new PolyhedronBuilder(p) builder.buildPolyhedron(possibleNewDynamicTypes) scopeBounds = builder.scopeBounds topLevelBounds = builder.topLevelBounds polyhedron = builder.polyhedron operator = solver.createSaturationOperator(polyhedron) + propagateAllScopeConstraints() if (propagateRelations) { - propagateAllScopeConstraints() val maximumNumberOfNewNodes = topLevelBounds.upperBound if (maximumNumberOfNewNodes === null) { throw new IllegalStateException("Could not determine maximum number of new nodes, it may be unbounded") @@ -57,7 +67,7 @@ class PolyhedronScopePropagator extends TypeHierarchyScopePropagator { throw new IllegalStateException("Maximum number of new nodes is not positive") } builder.buildMultiplicityConstraints(unfinishedMultiplicityQueries, hasElementInContainmentQuery, - maximumNumberOfNewNodes) + allPatternsByName, hints, maximumNumberOfNewNodes) relevantRelations = builder.relevantRelations updaters = builder.updaters } else { @@ -66,21 +76,40 @@ class PolyhedronScopePropagator extends TypeHierarchyScopePropagator { } override void doPropagateAllScopeConstraints() { + super.doPropagateAllScopeConstraints() resetBounds() populatePolyhedronFromScope() // println(polyhedron) - val result = operator.saturate() -// println(polyhedron) - if (result == PolyhedronSaturationResult.EMPTY) { - setScopesInvalid() - } else { - populateScopesFromPolyhedron() - if (result != PolyhedronSaturationResult.SATURATED) { - super.propagateAllScopeConstraints() + val signature = polyhedron.createSignature + val cachedSignature = cache.getIfPresent(signature) + switch (cachedSignature) { + case null: { + statistics.incrementScopePropagationSolverCount + val result = operator.saturate() + if (result == PolyhedronSaturationResult.EMPTY) { + cache.put(signature, PolyhedronSignature.EMPTY) + setScopesInvalid() + } else { + val resultSignature = polyhedron.createSignature + cache.put(signature, resultSignature) + populateScopesFromPolyhedron() + } } + case PolyhedronSignature.EMPTY: + setScopesInvalid() + PolyhedronSignature.Bounds: { + polyhedron.applySignature(signature) + populateScopesFromPolyhedron() + } + default: + throw new IllegalStateException("Unknown polyhedron signature: " + signature) + } +// println(polyhedron) + if (updateHeuristic) { + copyScopeBoundsToHeuristic() } } - + override propagateAdditionToRelation(Relation r) { super.propagateAdditionToRelation(r) if (relevantRelations.contains(r)) { @@ -186,7 +215,7 @@ class PolyhedronScopePropagator extends TypeHierarchyScopePropagator { } @FinalFieldsConstructor - private static class PolyhedronBuilder { + private static class PolyhedronBuilder implements LinearTypeExpressionBuilderFactory { static val INFINITY_SCALE = 10 val PartialInterpretation p @@ -197,6 +226,7 @@ class PolyhedronScopePropagator extends TypeHierarchyScopePropagator { Map typeBounds int infinity ViatraQueryEngine queryEngine + Map>> allPatternsByName ImmutableList.Builder updatersBuilder Map scopeBounds @@ -222,9 +252,11 @@ class PolyhedronScopePropagator extends TypeHierarchyScopePropagator { def buildMultiplicityConstraints( Map constraints, IQuerySpecification> hasElementInContainmentQuery, - int maximumNuberOfNewNodes) { + Map>> allPatternsByName, + Collection hints, int maximumNuberOfNewNodes) { infinity = maximumNuberOfNewNodes * INFINITY_SCALE queryEngine = ViatraQueryEngine.on(new EMFScope(p)) + this.allPatternsByName = allPatternsByName updatersBuilder = ImmutableList.builder val containmentConstraints = constraints.entrySet.filter[key.containment].groupBy[key.targetType] for (pair : containmentConstraints.entrySet) { @@ -238,10 +270,13 @@ class PolyhedronScopePropagator extends TypeHierarchyScopePropagator { } } buildRelevantRelations(constraints.keySet) + for (hint : hints) { + updatersBuilder.add(hint.createConstraintUpdater(this)) + } updaters = updatersBuilder.build addCachedConstraintsToPolyhedron() } - + private def buildRelevantRelations(Set constraints) { val builder = ImmutableSet.builder for (constraint : constraints) { @@ -345,7 +380,7 @@ class PolyhedronScopePropagator extends TypeHierarchyScopePropagator { } } - private def addCoefficients(Map accumulator, int scale, Map a) { + private static def addCoefficients(Map accumulator, int scale, Map a) { for (pair : a.entrySet) { val dimension = pair.key val currentValue = accumulator.get(pair.key) ?: 0 @@ -411,14 +446,41 @@ class PolyhedronScopePropagator extends TypeHierarchyScopePropagator { } scopeBoundsBuilder.build } + + override createMatcher(String queryName) { + val querySpecification = allPatternsByName.get(queryName) + if (querySpecification === null) { + throw new IllegalArgumentException("Unknown pattern: " + queryName) + } + querySpecification.getMatcher(queryEngine) + } + + override createBuilder() { + new PolyhedronBuilderLinearTypeExpressionBuilder(this) + } } - private static interface RelationConstraintUpdater { - def void update(PartialInterpretation p) + @FinalFieldsConstructor + private static class PolyhedronBuilderLinearTypeExpressionBuilder implements LinearTypeExpressionBuilder { + val PolyhedronBuilder polyhedronBuilder + val Map coefficients = new HashMap + + override add(int scale, Type type) { + val typeCoefficients = polyhedronBuilder.subtypeDimensions.get(type) + if (typeCoefficients === null) { + throw new IllegalArgumentException("Unknown type: " + type) + } + PolyhedronBuilder.addCoefficients(coefficients, scale, typeCoefficients) + this + } + + override build() { + polyhedronBuilder.toExpression(coefficients) + } } @FinalFieldsConstructor - static class ContainmentConstraintUpdater implements RelationConstraintUpdater { + private static class ContainmentConstraintUpdater implements RelationConstraintUpdater { val String name val LinearBoundedExpression orphansLowerBound val LinearBoundedExpression orphansUpperBound @@ -460,7 +522,7 @@ class PolyhedronScopePropagator extends TypeHierarchyScopePropagator { } @FinalFieldsConstructor - static class ContainmentRootConstraintUpdater implements RelationConstraintUpdater { + private static class ContainmentRootConstraintUpdater implements RelationConstraintUpdater { val LinearBoundedExpression typeCardinality val ViatraQueryMatcher hasElementInContainmentMatcher @@ -479,7 +541,7 @@ class PolyhedronScopePropagator extends TypeHierarchyScopePropagator { } @FinalFieldsConstructor - static class UnfinishedMultiplicityConstraintUpdater implements RelationConstraintUpdater { + private static class UnfinishedMultiplicityConstraintUpdater implements RelationConstraintUpdater { val String name val LinearBoundedExpression availableMultiplicityExpression val ViatraQueryMatcher unfinishedMultiplicityMatcher @@ -500,7 +562,7 @@ class PolyhedronScopePropagator extends TypeHierarchyScopePropagator { } @FinalFieldsConstructor - static class UnrepairableMultiplicityConstraintUpdater implements RelationConstraintUpdater { + private static class UnrepairableMultiplicityConstraintUpdater implements RelationConstraintUpdater { val String name val LinearBoundedExpression targetCardinalityExpression val ViatraQueryMatcher unrepairableMultiplicityMatcher diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/PolyhedronSolver.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/PolyhedronSolver.xtend index 9c6cb82e..4e046190 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/PolyhedronSolver.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/PolyhedronSolver.xtend @@ -3,6 +3,7 @@ package hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality import java.util.List import java.util.Map import org.eclipse.xtend.lib.annotations.Accessors +import org.eclipse.xtend.lib.annotations.Data import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor interface PolyhedronSolver { @@ -52,16 +53,66 @@ class Polyhedron { val List expressionsToSaturate override toString() ''' - Dimensions: - «FOR dimension : dimensions» - «dimension» - «ENDFOR» - Constraints: - «FOR constraint : constraints» - «constraint» - «ENDFOR» + Dimensions: + «FOR dimension : dimensions» + «dimension» + «ENDFOR» + Constraints: + «FOR constraint : constraints» + «constraint» + «ENDFOR» ''' + def createSignature() { + val size = dimensions.size + constraints.size + val lowerBounds = newArrayOfSize(size) + val upperBounds = newArrayOfSize(size) + var int i = 0 + for (dimension : dimensions) { + lowerBounds.set(i, dimension.lowerBound) + upperBounds.set(i, dimension.upperBound) + i++ + } + for (constraint : constraints) { + lowerBounds.set(i, constraint.lowerBound) + upperBounds.set(i, constraint.upperBound) + i++ + } + new PolyhedronSignature.Bounds(lowerBounds, upperBounds) + } + + def applySignature(PolyhedronSignature.Bounds signature) { + val lowerBounds = signature.lowerBounds + val upperBounds = signature.upperBounds + var int i = 0 + for (dimension : dimensions) { + dimension.lowerBound = lowerBounds.get(i) + dimension.upperBound = upperBounds.get(i) + i++ + } + for (constraint : constraints) { + constraint.lowerBound = lowerBounds.get(i) + constraint.upperBound = upperBounds.get(i) + i++ + } + } +} + +abstract class PolyhedronSignature { + public static val EMPTY = new PolyhedronSignature { + override toString() { + "PolyhedronSignature.EMPTY" + } + } + + private new() { + } + + @Data + static class Bounds extends PolyhedronSignature { + val Integer[] lowerBounds + val Integer[] upperBounds + } } @Accessors @@ -80,6 +131,11 @@ abstract class LinearBoundedExpression { upperBound = tighterBound } } + + def void assertEqualsTo(int bound) { + tightenLowerBound(bound) + tightenUpperBound(bound) + } } @Accessors diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/RelationConstraintCalculator.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/RelationConstraintCalculator.xtend index 52a390a8..013e53e1 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/RelationConstraintCalculator.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/RelationConstraintCalculator.xtend @@ -117,9 +117,12 @@ class RelationConstraintCalculator { var inverseUpperMultiplicity = -1 val inverseRelation = inverseRelations.get(relation) if (inverseRelation !== null) { - inverseUpperMultiplicity = upperMultiplicities.get(relation) + inverseUpperMultiplicity = upperMultiplicities.get(inverseRelation) container = containmentRelations.contains(inverseRelation) } + if (containment) { + inverseUpperMultiplicity = 1 + } val constraint = new RelationMultiplicityConstraint(relation, inverseRelation, containment, container, lowerMultiplicity, upperMultiplicity, inverseUpperMultiplicity) if (constraint.isActive) { diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/ScopePropagator.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/ScopePropagator.xtend index 0bdb202e..2376fb38 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/ScopePropagator.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/ScopePropagator.xtend @@ -14,7 +14,7 @@ import org.eclipse.xtend.lib.annotations.Accessors class ScopePropagator { @Accessors(PROTECTED_GETTER) val PartialInterpretation partialInterpretation - val ModelGenerationStatistics statistics + @Accessors(PROTECTED_GETTER) val ModelGenerationStatistics statistics val Map type2Scope @Accessors(PROTECTED_GETTER) val Map> superScopes @Accessors(PROTECTED_GETTER) val Map> subScopes @@ -59,12 +59,21 @@ class ScopePropagator { } } } while (changed) + + copyScopeBoundsToHeuristic() } def propagateAllScopeConstraints() { statistics.incrementScopePropagationCount() doPropagateAllScopeConstraints() } + + protected def copyScopeBoundsToHeuristic() { + partialInterpretation.minNewElementsHeuristic = partialInterpretation.minNewElements + for (scope : partialInterpretation.scopes) { + scope.minNewElementsHeuristic = scope.minNewElements + } + } protected def void doPropagateAllScopeConstraints() { // Nothing to propagate. @@ -73,12 +82,17 @@ class ScopePropagator { def propagateAdditionToType(PartialTypeInterpratation t) { // println('''Adding to «(t as PartialComplexTypeInterpretation).interpretationOf.name»''') val targetScope = type2Scope.get(t) - targetScope.removeOne - val sups = superScopes.get(targetScope) - sups.forEach[removeOne] + if (targetScope !== null) { + targetScope.removeOne + val sups = superScopes.get(targetScope) + sups.forEach[removeOne] + } if (this.partialInterpretation.minNewElements > 0) { this.partialInterpretation.minNewElements = this.partialInterpretation.minNewElements - 1 } + if (this.partialInterpretation.minNewElementsHeuristic > 0) { + this.partialInterpretation.minNewElementsHeuristic = this.partialInterpretation.minNewElementsHeuristic - 1 + } if (this.partialInterpretation.maxNewElements > 0) { this.partialInterpretation.maxNewElements = this.partialInterpretation.maxNewElements - 1 } else if (this.partialInterpretation.maxNewElements === 0) { @@ -105,5 +119,8 @@ class ScopePropagator { if (scope.minNewElements > 0) { scope.minNewElements = scope.minNewElements - 1 } + if (scope.minNewElementsHeuristic > 0) { + scope.minNewElementsHeuristic = scope.minNewElementsHeuristic - 1 + } } } diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/ScopePropagatorStrategy.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/ScopePropagatorStrategy.xtend index b0ed75cb..3165917a 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/ScopePropagatorStrategy.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/ScopePropagatorStrategy.xtend @@ -16,7 +16,9 @@ enum PolyhedralScopePropagatorSolver { } abstract class ScopePropagatorStrategy { - public static val Count = new Simple("Count") + public static val None = new Simple("None") + + public static val Basic = new Simple("Basic") public static val BasicTypeHierarchy = new Simple("BasicTypeHierarchy") @@ -47,14 +49,19 @@ abstract class ScopePropagatorStrategy { val PolyhedralScopePropagatorConstraints constraints val PolyhedralScopePropagatorSolver solver + val boolean updateHeuristic val double timeoutSeconds @FinalFieldsConstructor new() { } + new(PolyhedralScopePropagatorConstraints constraints, PolyhedralScopePropagatorSolver solver, boolean updateHeuristic) { + this(constraints, solver, updateHeuristic, UNLIMITED_TIME) + } + new(PolyhedralScopePropagatorConstraints constraints, PolyhedralScopePropagatorSolver solver) { - this(constraints, solver, UNLIMITED_TIME) + this(constraints, solver, true) } override requiresUpperBoundIndexing() { diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/TypeHierarchyScopePropagator.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/TypeHierarchyScopePropagator.xtend index be8ef00a..d1704b39 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/TypeHierarchyScopePropagator.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/TypeHierarchyScopePropagator.xtend @@ -27,12 +27,16 @@ class TypeHierarchyScopePropagator extends ScopePropagator { } private def propagateLowerLimitUp(Scope subScope, Scope superScope) { + var changed = false if (subScope.minNewElements > superScope.minNewElements) { superScope.minNewElements = subScope.minNewElements - return true - } else { - return false + changed = true + } + if (subScope.minNewElementsHeuristic > superScope.minNewElementsHeuristic) { + superScope.minNewElementsHeuristic = subScope.minNewElementsHeuristic + changed = true } + changed } private def propagateUpperLimitDown(Scope subScope, Scope superScope) { @@ -50,16 +54,20 @@ class TypeHierarchyScopePropagator extends ScopePropagator { } private def propagateLowerLimitUp(Scope subScope, PartialInterpretation p) { + var changed = false if (subScope.minNewElements > p.minNewElements) { // println(''' // «(subScope.targetTypeInterpretation as PartialComplexTypeInterpretation).interpretationOf.name» -> nodes // p.minNewElements «p.minNewElements» = subScope.minNewElements «subScope.minNewElements» // ''') p.minNewElements = subScope.minNewElements - return true - } else { - return false + changed = true + } + if (subScope.minNewElementsHeuristic > p.minNewElementsHeuristic) { + p.minNewElementsHeuristic = subScope.minNewElementsHeuristic + changed = true } + changed } private def propagateUpperLimitDown(Scope subScope, PartialInterpretation p) { diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/Z3PolyhedronSolver.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/Z3PolyhedronSolver.xtend index 23444956..3b831433 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/Z3PolyhedronSolver.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/Z3PolyhedronSolver.xtend @@ -13,6 +13,7 @@ import java.math.BigDecimal import java.math.MathContext import java.math.RoundingMode import java.util.Map +import org.eclipse.xtend.lib.annotations.Accessors import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor class Z3PolyhedronSolver implements PolyhedronSolver { @@ -28,10 +29,33 @@ class Z3PolyhedronSolver implements PolyhedronSolver { } override createSaturationOperator(Polyhedron polyhedron) { + new DisposingZ3SaturationOperator(this, polyhedron) + } + + def createPersistentSaturationOperator(Polyhedron polyhedron) { new Z3SaturationOperator(polyhedron, lpRelaxation, timeoutSeconds) } } +@FinalFieldsConstructor +class DisposingZ3SaturationOperator implements PolyhedronSaturationOperator { + val Z3PolyhedronSolver solver + @Accessors val Polyhedron polyhedron + + override saturate() { + val persistentOperator = solver.createPersistentSaturationOperator(polyhedron) + try { + persistentOperator.saturate + } finally { + persistentOperator.close + } + } + + override close() throws Exception { + // Nothing to close. + } +} + class Z3SaturationOperator extends AbstractPolyhedronSaturationOperator { static val INFINITY_SYMBOL_NAME = "oo" static val MULT_SYMBOL_NAME = "*" @@ -106,9 +130,9 @@ class Z3SaturationOperator extends AbstractPolyhedronSaturationOperator { IntNum: resultExpr.getInt() RatNum: - floor(resultExpr) + ceil(resultExpr) AlgebraicNum: - floor(resultExpr.toLower(ALGEBRAIC_NUMBER_ROUNDING)) + ceil(resultExpr.toUpper(ALGEBRAIC_NUMBER_ROUNDING)) default: if (isNegativeInfinity(resultExpr)) { null @@ -136,9 +160,9 @@ class Z3SaturationOperator extends AbstractPolyhedronSaturationOperator { IntNum: resultExpr.getInt() RatNum: - ceil(resultExpr) + floor(resultExpr) AlgebraicNum: - ceil(resultExpr.toUpper(ALGEBRAIC_NUMBER_ROUNDING)) + floor(resultExpr.toLower(ALGEBRAIC_NUMBER_ROUNDING)) default: if (isPositiveInfinity(resultExpr)) { null diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PatternGenerator.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PatternGenerator.xtend index 1b0db90e..5c35fb54 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PatternGenerator.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PatternGenerator.xtend @@ -16,8 +16,11 @@ import hu.bme.mit.inf.dslreasoner.viatra2logic.viatra2logicannotations.Transform import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.Modality import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.TypeAnalysisResult import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.TypeInferenceMethod +import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.LinearTypeConstraintHint import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.RelationConstraints +import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.ScopePropagatorStrategy import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation +import java.util.Collection import java.util.HashMap import java.util.Map import org.eclipse.emf.ecore.EAttribute @@ -26,7 +29,6 @@ import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PQuery import org.eclipse.xtend.lib.annotations.Accessors import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* -import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.ScopePropagatorStrategy class PatternGenerator { @Accessors(PUBLIC_GETTER) val TypeIndexer typeIndexer // = new TypeIndexer(this) @@ -104,7 +106,9 @@ class PatternGenerator { } def isRepresentative(Relation relation, Relation inverse) { - if (inverse === null) { + if (relation === null) { + return false + } else if (inverse === null) { return true } else { relation.name.compareTo(inverse.name) < 1 @@ -144,7 +148,8 @@ class PatternGenerator { PartialInterpretation emptySolution, Map fqn2PQuery, TypeAnalysisResult typeAnalysisResult, - RelationConstraints constraints + RelationConstraints constraints, + Collection hints ) { return ''' @@ -294,6 +299,13 @@ class PatternGenerator { // 4.3 Relation refinement ////////// «relationRefinementGenerator.generateRefineReference(problem)» + + ////////// + // 5 Hints + ////////// + «FOR hint : hints» + «hint.getAdditionalPatterns(this)» + «ENDFOR» ''' } } diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PatternProvider.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PatternProvider.xtend index eadf0ae0..f5c85524 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PatternProvider.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PatternProvider.xtend @@ -26,6 +26,7 @@ import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PQuery import org.eclipse.xtend.lib.annotations.Data import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* +import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.LinearTypeConstraintHint @Data class GeneratedPatterns { @@ -62,7 +63,8 @@ class PatternProvider { def generateQueries(LogicProblem problem, PartialInterpretation emptySolution, ModelGenerationStatistics statistics, Set existingQueries, ReasonerWorkspace workspace, TypeInferenceMethod typeInferenceMethod, - ScopePropagatorStrategy scopePropagatorStrategy, RelationConstraints relationConstraints, boolean writeToFile) { + ScopePropagatorStrategy scopePropagatorStrategy, RelationConstraints relationConstraints, + Collection hints, boolean writeToFile) { val fqn2Query = existingQueries.toMap[it.fullyQualifiedName] val PatternGenerator patternGenerator = new PatternGenerator(typeInferenceMethod, scopePropagatorStrategy) val typeAnalysisResult = if (patternGenerator.requiresTypeAnalysis) { @@ -75,7 +77,7 @@ class PatternProvider { null } val baseIndexerFile = patternGenerator.transformBaseProperties(problem, emptySolution, fqn2Query, - typeAnalysisResult, relationConstraints) + typeAnalysisResult, relationConstraints, hints) if (writeToFile) { workspace.writeText('''generated3valued.vql_deactivated''', baseIndexerFile) } diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/RelationRefinementGenerator.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/RelationRefinementGenerator.xtend index fa73c861..d915d47e 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/RelationRefinementGenerator.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/RelationRefinementGenerator.xtend @@ -44,7 +44,7 @@ class RelationRefinementGenerator { def referRefinementQuery(RelationDeclaration relation, Relation inverseRelation, String relInterpretationName, String inverseInterpretationName, String sourceName, - String targetName) '''find «this.relationRefinementQueryName(relation,inverseRelation)»(problem, interpretation, «relInterpretationName», «IF inverseRelation !== null»inverseInterpretationName, «ENDIF»«sourceName», «targetName»);''' + String targetName) '''find «this.relationRefinementQueryName(relation,inverseRelation)»(problem, interpretation, «relInterpretationName», «IF inverseRelation !== null»«inverseInterpretationName», «ENDIF»«sourceName», «targetName»);''' def getRefineRelationQueries(LogicProblem p) { // val containmentRelations = p.containmentHierarchies.map[containmentRelations].flatten.toSet diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/UnfinishedIndexer.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/UnfinishedIndexer.xtend index 15b5a047..a8a07756 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/UnfinishedIndexer.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/UnfinishedIndexer.xtend @@ -1,5 +1,6 @@ package hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.patterns +import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RelationDeclaration import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.Modality import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.RelationMultiplicityConstraint @@ -76,21 +77,26 @@ class UnfinishedIndexer { «IF indexUpperMultiplicities» «IF constraint.constrainsUnrepairable || constraint.constrainsRemainingInverse» private pattern «repairMatchName(constraint)»(problem:LogicProblem, interpretation:PartialInterpretation, source:DefinedElement, target:DefinedElement) { - find interpretation(problem,interpretation); - find mustExist(problem,interpretation,source); - «base.typeIndexer.referInstanceOf(constraint.sourceType,Modality::MUST,"source")» - find mustExist(problem,interpretation,target); - «base.typeIndexer.referInstanceOf(constraint.targetType,Modality::MUST,"target")» - neg «base.referRelation(constraint.relation,"source","target",Modality.MUST,fqn2PQuery)» - «base.referRelation(constraint.relation,"source","target",Modality.MAY,fqn2PQuery)» + «IF base.isRepresentative(constraint.relation, constraint.inverseRelation) && constraint.relation instanceof RelationDeclaration» + «base.relationRefinementGenerator.referRefinementQuery(constraint.relation as RelationDeclaration, constraint.inverseRelation, "_", "_", "source", "target")» + «ELSE» + «IF base.isRepresentative(constraint.inverseRelation, constraint.relation) && constraint.inverseRelation instanceof RelationDeclaration» + «base.relationRefinementGenerator.referRefinementQuery(constraint.inverseRelation as RelationDeclaration, constraint.relation, "_", "_", "target", "source")» + «ELSE» + find interpretation(problem,interpretation); + find mustExist(problem,interpretation,source); + «base.typeIndexer.referInstanceOf(constraint.sourceType,Modality::MUST,"source")» + find mustExist(problem,interpretation,target); + «base.typeIndexer.referInstanceOf(constraint.targetType,Modality::MUST,"target")» + neg «base.referRelation(constraint.relation,"source","target",Modality.MUST,fqn2PQuery)» + «base.referRelation(constraint.relation,"source","target",Modality.MAY,fqn2PQuery)» + «ENDIF» + «ENDIF» } «ENDIF» «IF constraint.constrainsUnrepairable» private pattern «unrepairableMultiplicityName(constraint)»_helper(problem:LogicProblem, interpretation:PartialInterpretation, object:DefinedElement, unrepairableMultiplicity:java Integer) { - find interpretation(problem,interpretation); - find mustExist(problem,interpretation,object); - «base.typeIndexer.referInstanceOf(constraint.sourceType,Modality::MUST,"object")» find «unfinishedMultiplicityName(constraint)»_helper(problem, interpretation, object, missingMultiplicity); numberOfRepairMatches == count find «repairMatchName(constraint)»(problem, interpretation, object, _); check(numberOfRepairMatches < missingMultiplicity); diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/rules/RefinementRuleProvider.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/rules/RefinementRuleProvider.xtend index bf816de9..7891ebd8 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/rules/RefinementRuleProvider.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/rules/RefinementRuleProvider.xtend @@ -67,7 +67,8 @@ class RefinementRuleProvider { if(containmentRelation != null) { if(inverseRelation!= null) { ruleBuilder.action[match | - //println(name) + statistics.incrementTransformationCount +// println(name) val startTime = System.nanoTime //val problem = match.get(0) as LogicProblem val interpretation = match.get(1) as PartialInterpretation @@ -107,7 +108,8 @@ class RefinementRuleProvider { ] } else { ruleBuilder.action[match | - //println(name) + statistics.incrementTransformationCount +// println(name) val startTime = System.nanoTime //val problem = match.get(0) as LogicProblem val interpretation = match.get(1) as PartialInterpretation @@ -144,6 +146,9 @@ class RefinementRuleProvider { } } else { ruleBuilder.action[match | + statistics.incrementTransformationCount +// println(name) + val startTime = System.nanoTime //val problem = match.get(0) as LogicProblem val interpretation = match.get(1) as PartialInterpretation @@ -198,8 +203,9 @@ class RefinementRuleProvider { .precondition(lhs) if (inverseRelation == null) { ruleBuilder.action [ match | + statistics.incrementTransformationCount val startTime = System.nanoTime - //println(name) +// println(name) // val problem = match.get(0) as LogicProblem // val interpretation = match.get(1) as PartialInterpretation val relationInterpretation = match.get(2) as PartialRelationInterpretation @@ -217,8 +223,9 @@ class RefinementRuleProvider { ] } else { ruleBuilder.action [ match | + statistics.incrementTransformationCount val startTime = System.nanoTime - //println(name) +// println(name) // val problem = match.get(0) as LogicProblem // val interpretation = match.get(1) as PartialInterpretation val relationInterpretation = match.get(2) as PartialRelationInterpretation diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/PartialInterpretation.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/PartialInterpretation.java index 098cc15b..9d0c3fea 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/PartialInterpretation.java +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/PartialInterpretation.java @@ -30,6 +30,7 @@ import org.eclipse.emf.ecore.EObject; *
  • {@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation#getScopes Scopes}
  • *
  • {@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation#getMinNewElements Min New Elements}
  • *
  • {@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation#getMaxNewElements Max New Elements}
  • + *
  • {@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation#getMinNewElementsHeuristic Min New Elements Heuristic}
  • * * * @see hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationPackage#getPartialInterpretation() @@ -255,4 +256,27 @@ public interface PartialInterpretation extends EObject { */ void setMaxNewElements(int value); + /** + * Returns the value of the 'Min New Elements Heuristic' attribute. + * The default value is "0". + * + * + * @return the value of the 'Min New Elements Heuristic' attribute. + * @see #setMinNewElementsHeuristic(int) + * @see hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationPackage#getPartialInterpretation_MinNewElementsHeuristic() + * @model default="0" required="true" + * @generated + */ + int getMinNewElementsHeuristic(); + + /** + * Sets the value of the '{@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation#getMinNewElementsHeuristic Min New Elements Heuristic}' attribute. + * + * + * @param value the new value of the 'Min New Elements Heuristic' attribute. + * @see #getMinNewElementsHeuristic() + * @generated + */ + void setMinNewElementsHeuristic(int value); + } // PartialInterpretation diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/PartialinterpretationPackage.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/PartialinterpretationPackage.java index 4f34b9b7..f462ebe4 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/PartialinterpretationPackage.java +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/PartialinterpretationPackage.java @@ -166,6 +166,15 @@ public interface PartialinterpretationPackage extends EPackage { */ int PARTIAL_INTERPRETATION__MAX_NEW_ELEMENTS = 10; + /** + * The feature id for the 'Min New Elements Heuristic' attribute. + * + * + * @generated + * @ordered + */ + int PARTIAL_INTERPRETATION__MIN_NEW_ELEMENTS_HEURISTIC = 11; + /** * The number of structural features of the 'Partial Interpretation' class. * @@ -173,7 +182,7 @@ public interface PartialinterpretationPackage extends EPackage { * @generated * @ordered */ - int PARTIAL_INTERPRETATION_FEATURE_COUNT = 11; + int PARTIAL_INTERPRETATION_FEATURE_COUNT = 12; /** * The number of operations of the 'Partial Interpretation' class. @@ -912,6 +921,15 @@ public interface PartialinterpretationPackage extends EPackage { */ int SCOPE__TARGET_TYPE_INTERPRETATION = 2; + /** + * The feature id for the 'Min New Elements Heuristic' attribute. + * + * + * @generated + * @ordered + */ + int SCOPE__MIN_NEW_ELEMENTS_HEURISTIC = 3; + /** * The number of structural features of the 'Scope' class. * @@ -919,7 +937,7 @@ public interface PartialinterpretationPackage extends EPackage { * @generated * @ordered */ - int SCOPE_FEATURE_COUNT = 3; + int SCOPE_FEATURE_COUNT = 4; /** * The number of operations of the 'Scope' class. @@ -1357,6 +1375,17 @@ public interface PartialinterpretationPackage extends EPackage { */ EAttribute getPartialInterpretation_MaxNewElements(); + /** + * Returns the meta object for the attribute '{@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation#getMinNewElementsHeuristic Min New Elements Heuristic}'. + * + * + * @return the meta object for the attribute 'Min New Elements Heuristic'. + * @see hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation#getMinNewElementsHeuristic() + * @see #getPartialInterpretation() + * @generated + */ + EAttribute getPartialInterpretation_MinNewElementsHeuristic(); + /** * Returns the meta object for class '{@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialConstantInterpretation Partial Constant Interpretation}'. * @@ -1749,6 +1778,17 @@ public interface PartialinterpretationPackage extends EPackage { */ EReference getScope_TargetTypeInterpretation(); + /** + * Returns the meta object for the attribute '{@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.Scope#getMinNewElementsHeuristic Min New Elements Heuristic}'. + * + * + * @return the meta object for the attribute 'Min New Elements Heuristic'. + * @see hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.Scope#getMinNewElementsHeuristic() + * @see #getScope() + * @generated + */ + EAttribute getScope_MinNewElementsHeuristic(); + /** * Returns the meta object for class '{@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialPrimitiveInterpretation Partial Primitive Interpretation}'. * @@ -1952,6 +1992,14 @@ public interface PartialinterpretationPackage extends EPackage { */ EAttribute PARTIAL_INTERPRETATION__MAX_NEW_ELEMENTS = eINSTANCE.getPartialInterpretation_MaxNewElements(); + /** + * The meta object literal for the 'Min New Elements Heuristic' attribute feature. + * + * + * @generated + */ + EAttribute PARTIAL_INTERPRETATION__MIN_NEW_ELEMENTS_HEURISTIC = eINSTANCE.getPartialInterpretation_MinNewElementsHeuristic(); + /** * The meta object literal for the '{@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.impl.PartialConstantInterpretationImpl Partial Constant Interpretation}' class. * @@ -2278,6 +2326,14 @@ public interface PartialinterpretationPackage extends EPackage { */ EReference SCOPE__TARGET_TYPE_INTERPRETATION = eINSTANCE.getScope_TargetTypeInterpretation(); + /** + * The meta object literal for the 'Min New Elements Heuristic' attribute feature. + * + * + * @generated + */ + EAttribute SCOPE__MIN_NEW_ELEMENTS_HEURISTIC = eINSTANCE.getScope_MinNewElementsHeuristic(); + /** * The meta object literal for the '{@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.impl.PartialPrimitiveInterpretationImpl Partial Primitive Interpretation}' class. * diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/Scope.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/Scope.java index 155b9f00..a0b58615 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/Scope.java +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/Scope.java @@ -16,6 +16,7 @@ import org.eclipse.emf.ecore.EObject; *
  • {@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.Scope#getMinNewElements Min New Elements}
  • *
  • {@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.Scope#getMaxNewElements Max New Elements}
  • *
  • {@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.Scope#getTargetTypeInterpretation Target Type Interpretation}
  • + *
  • {@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.Scope#getMinNewElementsHeuristic Min New Elements Heuristic}
  • * * * @see hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationPackage#getScope() @@ -105,4 +106,27 @@ public interface Scope extends EObject { */ void setTargetTypeInterpretation(PartialTypeInterpratation value); + /** + * Returns the value of the 'Min New Elements Heuristic' attribute. + * The default value is "0". + * + * + * @return the value of the 'Min New Elements Heuristic' attribute. + * @see #setMinNewElementsHeuristic(int) + * @see hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationPackage#getScope_MinNewElementsHeuristic() + * @model default="0" required="true" + * @generated + */ + int getMinNewElementsHeuristic(); + + /** + * Sets the value of the '{@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.Scope#getMinNewElementsHeuristic Min New Elements Heuristic}' attribute. + * + * + * @param value the new value of the 'Min New Elements Heuristic' attribute. + * @see #getMinNewElementsHeuristic() + * @generated + */ + void setMinNewElementsHeuristic(int value); + } // Scope diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/BinaryElementRelationLinkImpl.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/BinaryElementRelationLinkImpl.java index f5efe02a..ca33dd65 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/BinaryElementRelationLinkImpl.java +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/BinaryElementRelationLinkImpl.java @@ -73,6 +73,7 @@ public class BinaryElementRelationLinkImpl extends RelationLinkImpl implements B * * @generated */ + @Override public DefinedElement getParam1() { if (param1 != null && param1.eIsProxy()) { InternalEObject oldParam1 = (InternalEObject)param1; @@ -99,6 +100,7 @@ public class BinaryElementRelationLinkImpl extends RelationLinkImpl implements B * * @generated */ + @Override public void setParam1(DefinedElement newParam1) { DefinedElement oldParam1 = param1; param1 = newParam1; @@ -111,6 +113,7 @@ public class BinaryElementRelationLinkImpl extends RelationLinkImpl implements B * * @generated */ + @Override public DefinedElement getParam2() { if (param2 != null && param2.eIsProxy()) { InternalEObject oldParam2 = (InternalEObject)param2; @@ -137,6 +140,7 @@ public class BinaryElementRelationLinkImpl extends RelationLinkImpl implements B * * @generated */ + @Override public void setParam2(DefinedElement newParam2) { DefinedElement oldParam2 = param2; param2 = newParam2; diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/BooleanElementImpl.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/BooleanElementImpl.java index e906e07d..5f12d9e4 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/BooleanElementImpl.java +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/BooleanElementImpl.java @@ -69,6 +69,7 @@ public class BooleanElementImpl extends PrimitiveElementImpl implements BooleanE * * @generated */ + @Override public boolean isValue() { return value; } @@ -78,6 +79,7 @@ public class BooleanElementImpl extends PrimitiveElementImpl implements BooleanE * * @generated */ + @Override public void setValue(boolean newValue) { boolean oldValue = value; value = newValue; @@ -152,7 +154,7 @@ public class BooleanElementImpl extends PrimitiveElementImpl implements BooleanE public String toString() { if (eIsProxy()) return super.toString(); - StringBuffer result = new StringBuffer(super.toString()); + StringBuilder result = new StringBuilder(super.toString()); result.append(" (value: "); result.append(value); result.append(')'); diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/IntegerElementImpl.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/IntegerElementImpl.java index ef1a4b96..c8fbe1dd 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/IntegerElementImpl.java +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/IntegerElementImpl.java @@ -69,6 +69,7 @@ public class IntegerElementImpl extends PrimitiveElementImpl implements IntegerE * * @generated */ + @Override public int getValue() { return value; } @@ -78,6 +79,7 @@ public class IntegerElementImpl extends PrimitiveElementImpl implements IntegerE * * @generated */ + @Override public void setValue(int newValue) { int oldValue = value; value = newValue; @@ -152,7 +154,7 @@ public class IntegerElementImpl extends PrimitiveElementImpl implements IntegerE public String toString() { if (eIsProxy()) return super.toString(); - StringBuffer result = new StringBuffer(super.toString()); + StringBuilder result = new StringBuilder(super.toString()); result.append(" (value: "); result.append(value); result.append(')'); diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/NaryRelationLinkElementImpl.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/NaryRelationLinkElementImpl.java index 749a03c5..c319a3f4 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/NaryRelationLinkElementImpl.java +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/NaryRelationLinkElementImpl.java @@ -83,6 +83,7 @@ public class NaryRelationLinkElementImpl extends MinimalEObjectImpl.Container im * * @generated */ + @Override public int getIndex() { return index; } @@ -92,6 +93,7 @@ public class NaryRelationLinkElementImpl extends MinimalEObjectImpl.Container im * * @generated */ + @Override public void setIndex(int newIndex) { int oldIndex = index; index = newIndex; @@ -104,6 +106,7 @@ public class NaryRelationLinkElementImpl extends MinimalEObjectImpl.Container im * * @generated */ + @Override public DefinedElement getParam() { if (param != null && param.eIsProxy()) { InternalEObject oldParam = (InternalEObject)param; @@ -130,6 +133,7 @@ public class NaryRelationLinkElementImpl extends MinimalEObjectImpl.Container im * * @generated */ + @Override public void setParam(DefinedElement newParam) { DefinedElement oldParam = param; param = newParam; @@ -215,7 +219,7 @@ public class NaryRelationLinkElementImpl extends MinimalEObjectImpl.Container im public String toString() { if (eIsProxy()) return super.toString(); - StringBuffer result = new StringBuffer(super.toString()); + StringBuilder result = new StringBuilder(super.toString()); result.append(" (index: "); result.append(index); result.append(')'); diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/NaryRelationLinkImpl.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/NaryRelationLinkImpl.java index f387ee06..9f7628cf 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/NaryRelationLinkImpl.java +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/NaryRelationLinkImpl.java @@ -66,6 +66,7 @@ public class NaryRelationLinkImpl extends RelationLinkImpl implements NaryRelati * * @generated */ + @Override public EList getElements() { if (elements == null) { elements = new EObjectContainmentEList(NaryRelationLinkElement.class, this, PartialinterpretationPackage.NARY_RELATION_LINK__ELEMENTS); diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialComplexTypeInterpretationImpl.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialComplexTypeInterpretationImpl.java index 07ee282d..c00b4278 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialComplexTypeInterpretationImpl.java +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialComplexTypeInterpretationImpl.java @@ -79,6 +79,7 @@ public class PartialComplexTypeInterpretationImpl extends PartialTypeInterpratat * * @generated */ + @Override public EList getSupertypeInterpretation() { if (supertypeInterpretation == null) { supertypeInterpretation = new EObjectResolvingEList(PartialComplexTypeInterpretation.class, this, PartialinterpretationPackage.PARTIAL_COMPLEX_TYPE_INTERPRETATION__SUPERTYPE_INTERPRETATION); @@ -91,6 +92,7 @@ public class PartialComplexTypeInterpretationImpl extends PartialTypeInterpratat * * @generated */ + @Override public TypeDeclaration getInterpretationOf() { if (interpretationOf != null && interpretationOf.eIsProxy()) { InternalEObject oldInterpretationOf = (InternalEObject)interpretationOf; @@ -117,6 +119,7 @@ public class PartialComplexTypeInterpretationImpl extends PartialTypeInterpratat * * @generated */ + @Override public void setInterpretationOf(TypeDeclaration newInterpretationOf) { TypeDeclaration oldInterpretationOf = interpretationOf; interpretationOf = newInterpretationOf; diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialConstantInterpretationImpl.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialConstantInterpretationImpl.java index 81b2ce8d..6d51f0db 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialConstantInterpretationImpl.java +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialConstantInterpretationImpl.java @@ -63,6 +63,7 @@ public class PartialConstantInterpretationImpl extends MinimalEObjectImpl.Contai * * @generated */ + @Override public ConstantDeclaration getInterpretationOf() { if (interpretationOf != null && interpretationOf.eIsProxy()) { InternalEObject oldInterpretationOf = (InternalEObject)interpretationOf; @@ -89,6 +90,7 @@ public class PartialConstantInterpretationImpl extends MinimalEObjectImpl.Contai * * @generated */ + @Override public void setInterpretationOf(ConstantDeclaration newInterpretationOf) { ConstantDeclaration oldInterpretationOf = interpretationOf; interpretationOf = newInterpretationOf; diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialFunctionInterpretationImpl.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialFunctionInterpretationImpl.java index 2d361e8e..855c4abc 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialFunctionInterpretationImpl.java +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialFunctionInterpretationImpl.java @@ -63,6 +63,7 @@ public class PartialFunctionInterpretationImpl extends MinimalEObjectImpl.Contai * * @generated */ + @Override public FunctionDeclaration getInterpretationOf() { if (interpretationOf != null && interpretationOf.eIsProxy()) { InternalEObject oldInterpretationOf = (InternalEObject)interpretationOf; @@ -89,6 +90,7 @@ public class PartialFunctionInterpretationImpl extends MinimalEObjectImpl.Contai * * @generated */ + @Override public void setInterpretationOf(FunctionDeclaration newInterpretationOf) { FunctionDeclaration oldInterpretationOf = interpretationOf; interpretationOf = newInterpretationOf; diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialInterpretationImpl.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialInterpretationImpl.java index bce3e2e0..9afdd8d2 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialInterpretationImpl.java +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialInterpretationImpl.java @@ -47,6 +47,7 @@ import org.eclipse.emf.ecore.util.InternalEList; *
  • {@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.impl.PartialInterpretationImpl#getScopes Scopes}
  • *
  • {@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.impl.PartialInterpretationImpl#getMinNewElements Min New Elements}
  • *
  • {@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.impl.PartialInterpretationImpl#getMaxNewElements Max New Elements}
  • + *
  • {@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.impl.PartialInterpretationImpl#getMinNewElementsHeuristic Min New Elements Heuristic}
  • * * * @generated @@ -182,6 +183,26 @@ public class PartialInterpretationImpl extends MinimalEObjectImpl.Container impl */ protected int maxNewElements = MAX_NEW_ELEMENTS_EDEFAULT; + /** + * The default value of the '{@link #getMinNewElementsHeuristic() Min New Elements Heuristic}' attribute. + * + * + * @see #getMinNewElementsHeuristic() + * @generated + * @ordered + */ + protected static final int MIN_NEW_ELEMENTS_HEURISTIC_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getMinNewElementsHeuristic() Min New Elements Heuristic}' attribute. + * + * + * @see #getMinNewElementsHeuristic() + * @generated + * @ordered + */ + protected int minNewElementsHeuristic = MIN_NEW_ELEMENTS_HEURISTIC_EDEFAULT; + /** * * @@ -206,6 +227,7 @@ public class PartialInterpretationImpl extends MinimalEObjectImpl.Container impl * * @generated */ + @Override public LogicProblem getProblem() { if (problem != null && problem.eIsProxy()) { InternalEObject oldProblem = (InternalEObject)problem; @@ -232,6 +254,7 @@ public class PartialInterpretationImpl extends MinimalEObjectImpl.Container impl * * @generated */ + @Override public void setProblem(LogicProblem newProblem) { LogicProblem oldProblem = problem; problem = newProblem; @@ -244,6 +267,7 @@ public class PartialInterpretationImpl extends MinimalEObjectImpl.Container impl * * @generated */ + @Override public EList getPartialconstantinterpretation() { if (partialconstantinterpretation == null) { partialconstantinterpretation = new EObjectContainmentEList(PartialConstantInterpretation.class, this, PartialinterpretationPackage.PARTIAL_INTERPRETATION__PARTIALCONSTANTINTERPRETATION); @@ -256,6 +280,7 @@ public class PartialInterpretationImpl extends MinimalEObjectImpl.Container impl * * @generated */ + @Override public EList getPartialrelationinterpretation() { if (partialrelationinterpretation == null) { partialrelationinterpretation = new EObjectContainmentEList(PartialRelationInterpretation.class, this, PartialinterpretationPackage.PARTIAL_INTERPRETATION__PARTIALRELATIONINTERPRETATION); @@ -268,6 +293,7 @@ public class PartialInterpretationImpl extends MinimalEObjectImpl.Container impl * * @generated */ + @Override public EList getPartialfunctioninterpretation() { if (partialfunctioninterpretation == null) { partialfunctioninterpretation = new EObjectContainmentEList(PartialFunctionInterpretation.class, this, PartialinterpretationPackage.PARTIAL_INTERPRETATION__PARTIALFUNCTIONINTERPRETATION); @@ -280,6 +306,7 @@ public class PartialInterpretationImpl extends MinimalEObjectImpl.Container impl * * @generated */ + @Override public EList getNewElements() { if (newElements == null) { newElements = new EObjectContainmentEList(DefinedElement.class, this, PartialinterpretationPackage.PARTIAL_INTERPRETATION__NEW_ELEMENTS); @@ -292,6 +319,7 @@ public class PartialInterpretationImpl extends MinimalEObjectImpl.Container impl * * @generated */ + @Override public EList getPartialtypeinterpratation() { if (partialtypeinterpratation == null) { partialtypeinterpratation = new EObjectContainmentEList(PartialTypeInterpratation.class, this, PartialinterpretationPackage.PARTIAL_INTERPRETATION__PARTIALTYPEINTERPRATATION); @@ -304,6 +332,7 @@ public class PartialInterpretationImpl extends MinimalEObjectImpl.Container impl * * @generated */ + @Override public EList getOpenWorldElements() { if (openWorldElements == null) { openWorldElements = new EObjectContainmentEList(DefinedElement.class, this, PartialinterpretationPackage.PARTIAL_INTERPRETATION__OPEN_WORLD_ELEMENTS); @@ -316,6 +345,7 @@ public class PartialInterpretationImpl extends MinimalEObjectImpl.Container impl * * @generated */ + @Override public LogicProblem getProblemConainer() { return problemConainer; } @@ -340,6 +370,7 @@ public class PartialInterpretationImpl extends MinimalEObjectImpl.Container impl * * @generated */ + @Override public void setProblemConainer(LogicProblem newProblemConainer) { if (newProblemConainer != problemConainer) { NotificationChain msgs = null; @@ -359,6 +390,7 @@ public class PartialInterpretationImpl extends MinimalEObjectImpl.Container impl * * @generated */ + @Override public EList getScopes() { if (scopes == null) { scopes = new EObjectContainmentEList(Scope.class, this, PartialinterpretationPackage.PARTIAL_INTERPRETATION__SCOPES); @@ -371,6 +403,7 @@ public class PartialInterpretationImpl extends MinimalEObjectImpl.Container impl * * @generated */ + @Override public int getMinNewElements() { return minNewElements; } @@ -380,6 +413,7 @@ public class PartialInterpretationImpl extends MinimalEObjectImpl.Container impl * * @generated */ + @Override public void setMinNewElements(int newMinNewElements) { int oldMinNewElements = minNewElements; minNewElements = newMinNewElements; @@ -392,6 +426,7 @@ public class PartialInterpretationImpl extends MinimalEObjectImpl.Container impl * * @generated */ + @Override public int getMaxNewElements() { return maxNewElements; } @@ -401,6 +436,7 @@ public class PartialInterpretationImpl extends MinimalEObjectImpl.Container impl * * @generated */ + @Override public void setMaxNewElements(int newMaxNewElements) { int oldMaxNewElements = maxNewElements; maxNewElements = newMaxNewElements; @@ -408,6 +444,29 @@ public class PartialInterpretationImpl extends MinimalEObjectImpl.Container impl eNotify(new ENotificationImpl(this, Notification.SET, PartialinterpretationPackage.PARTIAL_INTERPRETATION__MAX_NEW_ELEMENTS, oldMaxNewElements, maxNewElements)); } + /** + * + * + * @generated + */ + @Override + public int getMinNewElementsHeuristic() { + return minNewElementsHeuristic; + } + + /** + * + * + * @generated + */ + @Override + public void setMinNewElementsHeuristic(int newMinNewElementsHeuristic) { + int oldMinNewElementsHeuristic = minNewElementsHeuristic; + minNewElementsHeuristic = newMinNewElementsHeuristic; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, PartialinterpretationPackage.PARTIAL_INTERPRETATION__MIN_NEW_ELEMENTS_HEURISTIC, oldMinNewElementsHeuristic, minNewElementsHeuristic)); + } + /** * * @@ -467,6 +526,8 @@ public class PartialInterpretationImpl extends MinimalEObjectImpl.Container impl return getMinNewElements(); case PartialinterpretationPackage.PARTIAL_INTERPRETATION__MAX_NEW_ELEMENTS: return getMaxNewElements(); + case PartialinterpretationPackage.PARTIAL_INTERPRETATION__MIN_NEW_ELEMENTS_HEURISTIC: + return getMinNewElementsHeuristic(); } return super.eGet(featureID, resolve, coreType); } @@ -520,6 +581,9 @@ public class PartialInterpretationImpl extends MinimalEObjectImpl.Container impl case PartialinterpretationPackage.PARTIAL_INTERPRETATION__MAX_NEW_ELEMENTS: setMaxNewElements((Integer)newValue); return; + case PartialinterpretationPackage.PARTIAL_INTERPRETATION__MIN_NEW_ELEMENTS_HEURISTIC: + setMinNewElementsHeuristic((Integer)newValue); + return; } super.eSet(featureID, newValue); } @@ -565,6 +629,9 @@ public class PartialInterpretationImpl extends MinimalEObjectImpl.Container impl case PartialinterpretationPackage.PARTIAL_INTERPRETATION__MAX_NEW_ELEMENTS: setMaxNewElements(MAX_NEW_ELEMENTS_EDEFAULT); return; + case PartialinterpretationPackage.PARTIAL_INTERPRETATION__MIN_NEW_ELEMENTS_HEURISTIC: + setMinNewElementsHeuristic(MIN_NEW_ELEMENTS_HEURISTIC_EDEFAULT); + return; } super.eUnset(featureID); } @@ -599,6 +666,8 @@ public class PartialInterpretationImpl extends MinimalEObjectImpl.Container impl return minNewElements != MIN_NEW_ELEMENTS_EDEFAULT; case PartialinterpretationPackage.PARTIAL_INTERPRETATION__MAX_NEW_ELEMENTS: return maxNewElements != MAX_NEW_ELEMENTS_EDEFAULT; + case PartialinterpretationPackage.PARTIAL_INTERPRETATION__MIN_NEW_ELEMENTS_HEURISTIC: + return minNewElementsHeuristic != MIN_NEW_ELEMENTS_HEURISTIC_EDEFAULT; } return super.eIsSet(featureID); } @@ -612,11 +681,13 @@ public class PartialInterpretationImpl extends MinimalEObjectImpl.Container impl public String toString() { if (eIsProxy()) return super.toString(); - StringBuffer result = new StringBuffer(super.toString()); + StringBuilder result = new StringBuilder(super.toString()); result.append(" (minNewElements: "); result.append(minNewElements); result.append(", maxNewElements: "); result.append(maxNewElements); + result.append(", minNewElementsHeuristic: "); + result.append(minNewElementsHeuristic); result.append(')'); return result.toString(); } diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialRelationInterpretationImpl.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialRelationInterpretationImpl.java index 71aef9af..7ad06504 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialRelationInterpretationImpl.java +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialRelationInterpretationImpl.java @@ -106,6 +106,7 @@ public class PartialRelationInterpretationImpl extends MinimalEObjectImpl.Contai * * @generated */ + @Override public RelationDeclaration getInterpretationOf() { if (interpretationOf != null && interpretationOf.eIsProxy()) { InternalEObject oldInterpretationOf = (InternalEObject)interpretationOf; @@ -132,6 +133,7 @@ public class PartialRelationInterpretationImpl extends MinimalEObjectImpl.Contai * * @generated */ + @Override public void setInterpretationOf(RelationDeclaration newInterpretationOf) { RelationDeclaration oldInterpretationOf = interpretationOf; interpretationOf = newInterpretationOf; @@ -144,6 +146,7 @@ public class PartialRelationInterpretationImpl extends MinimalEObjectImpl.Contai * * @generated */ + @Override public EList getRelationlinks() { if (relationlinks == null) { relationlinks = new EObjectContainmentEList(RelationLink.class, this, PartialinterpretationPackage.PARTIAL_RELATION_INTERPRETATION__RELATIONLINKS); @@ -156,6 +159,7 @@ public class PartialRelationInterpretationImpl extends MinimalEObjectImpl.Contai * * @generated */ + @Override public TypeReference getParam1() { if (param1 != null && param1.eIsProxy()) { InternalEObject oldParam1 = (InternalEObject)param1; @@ -182,6 +186,7 @@ public class PartialRelationInterpretationImpl extends MinimalEObjectImpl.Contai * * @generated */ + @Override public void setParam1(TypeReference newParam1) { TypeReference oldParam1 = param1; param1 = newParam1; @@ -194,6 +199,7 @@ public class PartialRelationInterpretationImpl extends MinimalEObjectImpl.Contai * * @generated */ + @Override public TypeReference getParam2() { if (param2 != null && param2.eIsProxy()) { InternalEObject oldParam2 = (InternalEObject)param2; @@ -220,6 +226,7 @@ public class PartialRelationInterpretationImpl extends MinimalEObjectImpl.Contai * * @generated */ + @Override public void setParam2(TypeReference newParam2) { TypeReference oldParam2 = param2; param2 = newParam2; diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialTypeInterpratationImpl.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialTypeInterpratationImpl.java index da9b1472..51eabd2c 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialTypeInterpratationImpl.java +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialTypeInterpratationImpl.java @@ -76,6 +76,7 @@ public abstract class PartialTypeInterpratationImpl extends MinimalEObjectImpl.C * * @generated */ + @Override public EList getElements() { if (elements == null) { elements = new EObjectResolvingEList(DefinedElement.class, this, PartialinterpretationPackage.PARTIAL_TYPE_INTERPRATATION__ELEMENTS); @@ -88,6 +89,7 @@ public abstract class PartialTypeInterpratationImpl extends MinimalEObjectImpl.C * * @generated */ + @Override public EList getScopes() { if (scopes == null) { scopes = new EObjectWithInverseResolvingEList(Scope.class, this, PartialinterpretationPackage.PARTIAL_TYPE_INTERPRATATION__SCOPES, PartialinterpretationPackage.SCOPE__TARGET_TYPE_INTERPRETATION); diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialinterpretationFactoryImpl.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialinterpretationFactoryImpl.java index af1db8a1..06ca4e37 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialinterpretationFactoryImpl.java +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialinterpretationFactoryImpl.java @@ -84,6 +84,7 @@ public class PartialinterpretationFactoryImpl extends EFactoryImpl implements Pa * * @generated */ + @Override public PartialInterpretation createPartialInterpretation() { PartialInterpretationImpl partialInterpretation = new PartialInterpretationImpl(); return partialInterpretation; @@ -94,6 +95,7 @@ public class PartialinterpretationFactoryImpl extends EFactoryImpl implements Pa * * @generated */ + @Override public PartialConstantInterpretation createPartialConstantInterpretation() { PartialConstantInterpretationImpl partialConstantInterpretation = new PartialConstantInterpretationImpl(); return partialConstantInterpretation; @@ -104,6 +106,7 @@ public class PartialinterpretationFactoryImpl extends EFactoryImpl implements Pa * * @generated */ + @Override public PartialRelationInterpretation createPartialRelationInterpretation() { PartialRelationInterpretationImpl partialRelationInterpretation = new PartialRelationInterpretationImpl(); return partialRelationInterpretation; @@ -114,6 +117,7 @@ public class PartialinterpretationFactoryImpl extends EFactoryImpl implements Pa * * @generated */ + @Override public PartialFunctionInterpretation createPartialFunctionInterpretation() { PartialFunctionInterpretationImpl partialFunctionInterpretation = new PartialFunctionInterpretationImpl(); return partialFunctionInterpretation; @@ -124,6 +128,7 @@ public class PartialinterpretationFactoryImpl extends EFactoryImpl implements Pa * * @generated */ + @Override public UnaryElementRelationLink createUnaryElementRelationLink() { UnaryElementRelationLinkImpl unaryElementRelationLink = new UnaryElementRelationLinkImpl(); return unaryElementRelationLink; @@ -134,6 +139,7 @@ public class PartialinterpretationFactoryImpl extends EFactoryImpl implements Pa * * @generated */ + @Override public BinaryElementRelationLink createBinaryElementRelationLink() { BinaryElementRelationLinkImpl binaryElementRelationLink = new BinaryElementRelationLinkImpl(); return binaryElementRelationLink; @@ -144,6 +150,7 @@ public class PartialinterpretationFactoryImpl extends EFactoryImpl implements Pa * * @generated */ + @Override public NaryRelationLink createNaryRelationLink() { NaryRelationLinkImpl naryRelationLink = new NaryRelationLinkImpl(); return naryRelationLink; @@ -154,6 +161,7 @@ public class PartialinterpretationFactoryImpl extends EFactoryImpl implements Pa * * @generated */ + @Override public NaryRelationLinkElement createNaryRelationLinkElement() { NaryRelationLinkElementImpl naryRelationLinkElement = new NaryRelationLinkElementImpl(); return naryRelationLinkElement; @@ -164,6 +172,7 @@ public class PartialinterpretationFactoryImpl extends EFactoryImpl implements Pa * * @generated */ + @Override public BooleanElement createBooleanElement() { BooleanElementImpl booleanElement = new BooleanElementImpl(); return booleanElement; @@ -174,6 +183,7 @@ public class PartialinterpretationFactoryImpl extends EFactoryImpl implements Pa * * @generated */ + @Override public IntegerElement createIntegerElement() { IntegerElementImpl integerElement = new IntegerElementImpl(); return integerElement; @@ -184,6 +194,7 @@ public class PartialinterpretationFactoryImpl extends EFactoryImpl implements Pa * * @generated */ + @Override public RealElement createRealElement() { RealElementImpl realElement = new RealElementImpl(); return realElement; @@ -194,6 +205,7 @@ public class PartialinterpretationFactoryImpl extends EFactoryImpl implements Pa * * @generated */ + @Override public StringElement createStringElement() { StringElementImpl stringElement = new StringElementImpl(); return stringElement; @@ -204,6 +216,7 @@ public class PartialinterpretationFactoryImpl extends EFactoryImpl implements Pa * * @generated */ + @Override public Scope createScope() { ScopeImpl scope = new ScopeImpl(); return scope; @@ -214,6 +227,7 @@ public class PartialinterpretationFactoryImpl extends EFactoryImpl implements Pa * * @generated */ + @Override public PartialBooleanInterpretation createPartialBooleanInterpretation() { PartialBooleanInterpretationImpl partialBooleanInterpretation = new PartialBooleanInterpretationImpl(); return partialBooleanInterpretation; @@ -224,6 +238,7 @@ public class PartialinterpretationFactoryImpl extends EFactoryImpl implements Pa * * @generated */ + @Override public PartialIntegerInterpretation createPartialIntegerInterpretation() { PartialIntegerInterpretationImpl partialIntegerInterpretation = new PartialIntegerInterpretationImpl(); return partialIntegerInterpretation; @@ -234,6 +249,7 @@ public class PartialinterpretationFactoryImpl extends EFactoryImpl implements Pa * * @generated */ + @Override public PartialRealInterpretation createPartialRealInterpretation() { PartialRealInterpretationImpl partialRealInterpretation = new PartialRealInterpretationImpl(); return partialRealInterpretation; @@ -244,6 +260,7 @@ public class PartialinterpretationFactoryImpl extends EFactoryImpl implements Pa * * @generated */ + @Override public PartialStringInterpretation createPartialStringInterpretation() { PartialStringInterpretationImpl partialStringInterpretation = new PartialStringInterpretationImpl(); return partialStringInterpretation; @@ -254,6 +271,7 @@ public class PartialinterpretationFactoryImpl extends EFactoryImpl implements Pa * * @generated */ + @Override public PartialComplexTypeInterpretation createPartialComplexTypeInterpretation() { PartialComplexTypeInterpretationImpl partialComplexTypeInterpretation = new PartialComplexTypeInterpretationImpl(); return partialComplexTypeInterpretation; @@ -264,6 +282,7 @@ public class PartialinterpretationFactoryImpl extends EFactoryImpl implements Pa * * @generated */ + @Override public PartialinterpretationPackage getPartialinterpretationPackage() { return (PartialinterpretationPackage)getEPackage(); } diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialinterpretationPackageImpl.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialinterpretationPackageImpl.java index a21dc306..1ea3a11d 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialinterpretationPackageImpl.java +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialinterpretationPackageImpl.java @@ -227,7 +227,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa /** * Creates, registers, and initializes the Package for this model, and for any others upon which it depends. - * + * *

    This method is used to initialize {@link PartialinterpretationPackage#eINSTANCE} when that field is accessed. * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. * @@ -241,7 +241,8 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa if (isInited) return (PartialinterpretationPackage)EPackage.Registry.INSTANCE.getEPackage(PartialinterpretationPackage.eNS_URI); // Obtain or create and register package - PartialinterpretationPackageImpl thePartialinterpretationPackage = (PartialinterpretationPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof PartialinterpretationPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new PartialinterpretationPackageImpl()); + Object registeredPartialinterpretationPackage = EPackage.Registry.INSTANCE.get(eNS_URI); + PartialinterpretationPackageImpl thePartialinterpretationPackage = registeredPartialinterpretationPackage instanceof PartialinterpretationPackageImpl ? (PartialinterpretationPackageImpl)registeredPartialinterpretationPackage : new PartialinterpretationPackageImpl(); isInited = true; @@ -258,7 +259,6 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa // Mark meta-data to indicate it can't be changed thePartialinterpretationPackage.freeze(); - // Update the registry and return the package EPackage.Registry.INSTANCE.put(PartialinterpretationPackage.eNS_URI, thePartialinterpretationPackage); return thePartialinterpretationPackage; @@ -269,6 +269,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EClass getPartialInterpretation() { return partialInterpretationEClass; } @@ -278,6 +279,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EReference getPartialInterpretation_Problem() { return (EReference)partialInterpretationEClass.getEStructuralFeatures().get(0); } @@ -287,6 +289,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EReference getPartialInterpretation_Partialconstantinterpretation() { return (EReference)partialInterpretationEClass.getEStructuralFeatures().get(1); } @@ -296,6 +299,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EReference getPartialInterpretation_Partialrelationinterpretation() { return (EReference)partialInterpretationEClass.getEStructuralFeatures().get(2); } @@ -305,6 +309,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EReference getPartialInterpretation_Partialfunctioninterpretation() { return (EReference)partialInterpretationEClass.getEStructuralFeatures().get(3); } @@ -314,6 +319,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EReference getPartialInterpretation_NewElements() { return (EReference)partialInterpretationEClass.getEStructuralFeatures().get(4); } @@ -323,6 +329,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EReference getPartialInterpretation_Partialtypeinterpratation() { return (EReference)partialInterpretationEClass.getEStructuralFeatures().get(5); } @@ -332,6 +339,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EReference getPartialInterpretation_OpenWorldElements() { return (EReference)partialInterpretationEClass.getEStructuralFeatures().get(6); } @@ -341,6 +349,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EReference getPartialInterpretation_ProblemConainer() { return (EReference)partialInterpretationEClass.getEStructuralFeatures().get(7); } @@ -350,6 +359,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EReference getPartialInterpretation_Scopes() { return (EReference)partialInterpretationEClass.getEStructuralFeatures().get(8); } @@ -359,6 +369,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EAttribute getPartialInterpretation_MinNewElements() { return (EAttribute)partialInterpretationEClass.getEStructuralFeatures().get(9); } @@ -368,6 +379,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EAttribute getPartialInterpretation_MaxNewElements() { return (EAttribute)partialInterpretationEClass.getEStructuralFeatures().get(10); } @@ -377,6 +389,17 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override + public EAttribute getPartialInterpretation_MinNewElementsHeuristic() { + return (EAttribute)partialInterpretationEClass.getEStructuralFeatures().get(11); + } + + /** + * + * + * @generated + */ + @Override public EClass getPartialConstantInterpretation() { return partialConstantInterpretationEClass; } @@ -386,6 +409,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EReference getPartialConstantInterpretation_InterpretationOf() { return (EReference)partialConstantInterpretationEClass.getEStructuralFeatures().get(0); } @@ -395,6 +419,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EClass getPartialRelationInterpretation() { return partialRelationInterpretationEClass; } @@ -404,6 +429,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EReference getPartialRelationInterpretation_InterpretationOf() { return (EReference)partialRelationInterpretationEClass.getEStructuralFeatures().get(0); } @@ -413,6 +439,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EReference getPartialRelationInterpretation_Relationlinks() { return (EReference)partialRelationInterpretationEClass.getEStructuralFeatures().get(1); } @@ -422,6 +449,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EReference getPartialRelationInterpretation_Param1() { return (EReference)partialRelationInterpretationEClass.getEStructuralFeatures().get(2); } @@ -431,6 +459,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EReference getPartialRelationInterpretation_Param2() { return (EReference)partialRelationInterpretationEClass.getEStructuralFeatures().get(3); } @@ -440,6 +469,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EClass getPartialFunctionInterpretation() { return partialFunctionInterpretationEClass; } @@ -449,6 +479,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EReference getPartialFunctionInterpretation_InterpretationOf() { return (EReference)partialFunctionInterpretationEClass.getEStructuralFeatures().get(0); } @@ -458,6 +489,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EClass getPartialTypeInterpratation() { return partialTypeInterpratationEClass; } @@ -467,6 +499,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EReference getPartialTypeInterpratation_Elements() { return (EReference)partialTypeInterpratationEClass.getEStructuralFeatures().get(0); } @@ -476,6 +509,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EReference getPartialTypeInterpratation_Scopes() { return (EReference)partialTypeInterpratationEClass.getEStructuralFeatures().get(1); } @@ -485,6 +519,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EClass getRelationLink() { return relationLinkEClass; } @@ -494,6 +529,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EClass getUnaryElementRelationLink() { return unaryElementRelationLinkEClass; } @@ -503,6 +539,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EReference getUnaryElementRelationLink_Param1() { return (EReference)unaryElementRelationLinkEClass.getEStructuralFeatures().get(0); } @@ -512,6 +549,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EClass getBinaryElementRelationLink() { return binaryElementRelationLinkEClass; } @@ -521,6 +559,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EReference getBinaryElementRelationLink_Param1() { return (EReference)binaryElementRelationLinkEClass.getEStructuralFeatures().get(0); } @@ -530,6 +569,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EReference getBinaryElementRelationLink_Param2() { return (EReference)binaryElementRelationLinkEClass.getEStructuralFeatures().get(1); } @@ -539,6 +579,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EClass getNaryRelationLink() { return naryRelationLinkEClass; } @@ -548,6 +589,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EReference getNaryRelationLink_Elements() { return (EReference)naryRelationLinkEClass.getEStructuralFeatures().get(0); } @@ -557,6 +599,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EClass getNaryRelationLinkElement() { return naryRelationLinkElementEClass; } @@ -566,6 +609,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EAttribute getNaryRelationLinkElement_Index() { return (EAttribute)naryRelationLinkElementEClass.getEStructuralFeatures().get(0); } @@ -575,6 +619,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EReference getNaryRelationLinkElement_Param() { return (EReference)naryRelationLinkElementEClass.getEStructuralFeatures().get(1); } @@ -584,6 +629,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EClass getPrimitiveElement() { return primitiveElementEClass; } @@ -593,6 +639,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EAttribute getPrimitiveElement_ValueSet() { return (EAttribute)primitiveElementEClass.getEStructuralFeatures().get(0); } @@ -602,6 +649,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EClass getBooleanElement() { return booleanElementEClass; } @@ -611,6 +659,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EAttribute getBooleanElement_Value() { return (EAttribute)booleanElementEClass.getEStructuralFeatures().get(0); } @@ -620,6 +669,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EClass getIntegerElement() { return integerElementEClass; } @@ -629,6 +679,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EAttribute getIntegerElement_Value() { return (EAttribute)integerElementEClass.getEStructuralFeatures().get(0); } @@ -638,6 +689,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EClass getRealElement() { return realElementEClass; } @@ -647,6 +699,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EAttribute getRealElement_Value() { return (EAttribute)realElementEClass.getEStructuralFeatures().get(0); } @@ -656,6 +709,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EClass getStringElement() { return stringElementEClass; } @@ -665,6 +719,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EAttribute getStringElement_Value() { return (EAttribute)stringElementEClass.getEStructuralFeatures().get(0); } @@ -674,6 +729,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EClass getScope() { return scopeEClass; } @@ -683,6 +739,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EAttribute getScope_MinNewElements() { return (EAttribute)scopeEClass.getEStructuralFeatures().get(0); } @@ -692,6 +749,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EAttribute getScope_MaxNewElements() { return (EAttribute)scopeEClass.getEStructuralFeatures().get(1); } @@ -701,6 +759,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EReference getScope_TargetTypeInterpretation() { return (EReference)scopeEClass.getEStructuralFeatures().get(2); } @@ -710,6 +769,17 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override + public EAttribute getScope_MinNewElementsHeuristic() { + return (EAttribute)scopeEClass.getEStructuralFeatures().get(3); + } + + /** + * + * + * @generated + */ + @Override public EClass getPartialPrimitiveInterpretation() { return partialPrimitiveInterpretationEClass; } @@ -719,6 +789,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EClass getPartialBooleanInterpretation() { return partialBooleanInterpretationEClass; } @@ -728,6 +799,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EClass getPartialIntegerInterpretation() { return partialIntegerInterpretationEClass; } @@ -737,6 +809,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EClass getPartialRealInterpretation() { return partialRealInterpretationEClass; } @@ -746,6 +819,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EClass getPartialStringInterpretation() { return partialStringInterpretationEClass; } @@ -755,6 +829,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EClass getPartialComplexTypeInterpretation() { return partialComplexTypeInterpretationEClass; } @@ -764,6 +839,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EReference getPartialComplexTypeInterpretation_SupertypeInterpretation() { return (EReference)partialComplexTypeInterpretationEClass.getEStructuralFeatures().get(0); } @@ -773,6 +849,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public EReference getPartialComplexTypeInterpretation_InterpretationOf() { return (EReference)partialComplexTypeInterpretationEClass.getEStructuralFeatures().get(1); } @@ -782,6 +859,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa * * @generated */ + @Override public PartialinterpretationFactory getPartialinterpretationFactory() { return (PartialinterpretationFactory)getEFactoryInstance(); } @@ -817,6 +895,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa createEReference(partialInterpretationEClass, PARTIAL_INTERPRETATION__SCOPES); createEAttribute(partialInterpretationEClass, PARTIAL_INTERPRETATION__MIN_NEW_ELEMENTS); createEAttribute(partialInterpretationEClass, PARTIAL_INTERPRETATION__MAX_NEW_ELEMENTS); + createEAttribute(partialInterpretationEClass, PARTIAL_INTERPRETATION__MIN_NEW_ELEMENTS_HEURISTIC); partialConstantInterpretationEClass = createEClass(PARTIAL_CONSTANT_INTERPRETATION); createEReference(partialConstantInterpretationEClass, PARTIAL_CONSTANT_INTERPRETATION__INTERPRETATION_OF); @@ -869,6 +948,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa createEAttribute(scopeEClass, SCOPE__MIN_NEW_ELEMENTS); createEAttribute(scopeEClass, SCOPE__MAX_NEW_ELEMENTS); createEReference(scopeEClass, SCOPE__TARGET_TYPE_INTERPRETATION); + createEAttribute(scopeEClass, SCOPE__MIN_NEW_ELEMENTS_HEURISTIC); partialPrimitiveInterpretationEClass = createEClass(PARTIAL_PRIMITIVE_INTERPRETATION); @@ -945,6 +1025,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa initEReference(getPartialInterpretation_Scopes(), this.getScope(), null, "scopes", null, 0, -1, PartialInterpretation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEAttribute(getPartialInterpretation_MinNewElements(), ecorePackage.getEInt(), "minNewElements", "0", 1, 1, PartialInterpretation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEAttribute(getPartialInterpretation_MaxNewElements(), ecorePackage.getEInt(), "maxNewElements", "-1", 1, 1, PartialInterpretation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getPartialInterpretation_MinNewElementsHeuristic(), ecorePackage.getEInt(), "minNewElementsHeuristic", "0", 1, 1, PartialInterpretation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(partialConstantInterpretationEClass, PartialConstantInterpretation.class, "PartialConstantInterpretation", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getPartialConstantInterpretation_InterpretationOf(), theLogiclanguagePackage.getConstantDeclaration(), null, "interpretationOf", null, 1, 1, PartialConstantInterpretation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); @@ -997,6 +1078,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa initEAttribute(getScope_MinNewElements(), ecorePackage.getEInt(), "minNewElements", "0", 1, 1, Scope.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEAttribute(getScope_MaxNewElements(), ecorePackage.getEInt(), "maxNewElements", "-1", 1, 1, Scope.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getScope_TargetTypeInterpretation(), this.getPartialTypeInterpratation(), this.getPartialTypeInterpratation_Scopes(), "targetTypeInterpretation", null, 1, 1, Scope.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getScope_MinNewElementsHeuristic(), ecorePackage.getEInt(), "minNewElementsHeuristic", "0", 1, 1, Scope.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(partialPrimitiveInterpretationEClass, PartialPrimitiveInterpretation.class, "PartialPrimitiveInterpretation", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PrimitiveElementImpl.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PrimitiveElementImpl.java index 29a1e1be..a8ef81b0 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PrimitiveElementImpl.java +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PrimitiveElementImpl.java @@ -71,6 +71,7 @@ public abstract class PrimitiveElementImpl extends DefinedElementImpl implements * * @generated */ + @Override public boolean isValueSet() { return valueSet; } @@ -80,6 +81,7 @@ public abstract class PrimitiveElementImpl extends DefinedElementImpl implements * * @generated */ + @Override public void setValueSet(boolean newValueSet) { boolean oldValueSet = valueSet; valueSet = newValueSet; @@ -154,7 +156,7 @@ public abstract class PrimitiveElementImpl extends DefinedElementImpl implements public String toString() { if (eIsProxy()) return super.toString(); - StringBuffer result = new StringBuffer(super.toString()); + StringBuilder result = new StringBuilder(super.toString()); result.append(" (valueSet: "); result.append(valueSet); result.append(')'); diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/RealElementImpl.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/RealElementImpl.java index 0361a3e9..67cff5a2 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/RealElementImpl.java +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/RealElementImpl.java @@ -71,6 +71,7 @@ public class RealElementImpl extends PrimitiveElementImpl implements RealElement * * @generated */ + @Override public BigDecimal getValue() { return value; } @@ -80,6 +81,7 @@ public class RealElementImpl extends PrimitiveElementImpl implements RealElement * * @generated */ + @Override public void setValue(BigDecimal newValue) { BigDecimal oldValue = value; value = newValue; @@ -154,7 +156,7 @@ public class RealElementImpl extends PrimitiveElementImpl implements RealElement public String toString() { if (eIsProxy()) return super.toString(); - StringBuffer result = new StringBuffer(super.toString()); + StringBuilder result = new StringBuilder(super.toString()); result.append(" (value: "); result.append(value); result.append(')'); diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/ScopeImpl.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/ScopeImpl.java index d8ade871..a1b6de35 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/ScopeImpl.java +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/ScopeImpl.java @@ -26,6 +26,7 @@ import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; *

  • {@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.impl.ScopeImpl#getMinNewElements Min New Elements}
  • *
  • {@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.impl.ScopeImpl#getMaxNewElements Max New Elements}
  • *
  • {@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.impl.ScopeImpl#getTargetTypeInterpretation Target Type Interpretation}
  • + *
  • {@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.impl.ScopeImpl#getMinNewElementsHeuristic Min New Elements Heuristic}
  • * * * @generated @@ -81,6 +82,26 @@ public class ScopeImpl extends MinimalEObjectImpl.Container implements Scope { */ protected PartialTypeInterpratation targetTypeInterpretation; + /** + * The default value of the '{@link #getMinNewElementsHeuristic() Min New Elements Heuristic}' attribute. + * + * + * @see #getMinNewElementsHeuristic() + * @generated + * @ordered + */ + protected static final int MIN_NEW_ELEMENTS_HEURISTIC_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getMinNewElementsHeuristic() Min New Elements Heuristic}' attribute. + * + * + * @see #getMinNewElementsHeuristic() + * @generated + * @ordered + */ + protected int minNewElementsHeuristic = MIN_NEW_ELEMENTS_HEURISTIC_EDEFAULT; + /** * * @@ -105,6 +126,7 @@ public class ScopeImpl extends MinimalEObjectImpl.Container implements Scope { * * @generated */ + @Override public int getMinNewElements() { return minNewElements; } @@ -114,6 +136,7 @@ public class ScopeImpl extends MinimalEObjectImpl.Container implements Scope { * * @generated */ + @Override public void setMinNewElements(int newMinNewElements) { int oldMinNewElements = minNewElements; minNewElements = newMinNewElements; @@ -126,6 +149,7 @@ public class ScopeImpl extends MinimalEObjectImpl.Container implements Scope { * * @generated */ + @Override public int getMaxNewElements() { return maxNewElements; } @@ -135,6 +159,7 @@ public class ScopeImpl extends MinimalEObjectImpl.Container implements Scope { * * @generated */ + @Override public void setMaxNewElements(int newMaxNewElements) { int oldMaxNewElements = maxNewElements; maxNewElements = newMaxNewElements; @@ -147,6 +172,7 @@ public class ScopeImpl extends MinimalEObjectImpl.Container implements Scope { * * @generated */ + @Override public PartialTypeInterpratation getTargetTypeInterpretation() { if (targetTypeInterpretation != null && targetTypeInterpretation.eIsProxy()) { InternalEObject oldTargetTypeInterpretation = (InternalEObject)targetTypeInterpretation; @@ -188,6 +214,7 @@ public class ScopeImpl extends MinimalEObjectImpl.Container implements Scope { * * @generated */ + @Override public void setTargetTypeInterpretation(PartialTypeInterpratation newTargetTypeInterpretation) { if (newTargetTypeInterpretation != targetTypeInterpretation) { NotificationChain msgs = null; @@ -202,6 +229,29 @@ public class ScopeImpl extends MinimalEObjectImpl.Container implements Scope { eNotify(new ENotificationImpl(this, Notification.SET, PartialinterpretationPackage.SCOPE__TARGET_TYPE_INTERPRETATION, newTargetTypeInterpretation, newTargetTypeInterpretation)); } + /** + * + * + * @generated + */ + @Override + public int getMinNewElementsHeuristic() { + return minNewElementsHeuristic; + } + + /** + * + * + * @generated + */ + @Override + public void setMinNewElementsHeuristic(int newMinNewElementsHeuristic) { + int oldMinNewElementsHeuristic = minNewElementsHeuristic; + minNewElementsHeuristic = newMinNewElementsHeuristic; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, PartialinterpretationPackage.SCOPE__MIN_NEW_ELEMENTS_HEURISTIC, oldMinNewElementsHeuristic, minNewElementsHeuristic)); + } + /** * * @@ -247,6 +297,8 @@ public class ScopeImpl extends MinimalEObjectImpl.Container implements Scope { case PartialinterpretationPackage.SCOPE__TARGET_TYPE_INTERPRETATION: if (resolve) return getTargetTypeInterpretation(); return basicGetTargetTypeInterpretation(); + case PartialinterpretationPackage.SCOPE__MIN_NEW_ELEMENTS_HEURISTIC: + return getMinNewElementsHeuristic(); } return super.eGet(featureID, resolve, coreType); } @@ -268,6 +320,9 @@ public class ScopeImpl extends MinimalEObjectImpl.Container implements Scope { case PartialinterpretationPackage.SCOPE__TARGET_TYPE_INTERPRETATION: setTargetTypeInterpretation((PartialTypeInterpratation)newValue); return; + case PartialinterpretationPackage.SCOPE__MIN_NEW_ELEMENTS_HEURISTIC: + setMinNewElementsHeuristic((Integer)newValue); + return; } super.eSet(featureID, newValue); } @@ -289,6 +344,9 @@ public class ScopeImpl extends MinimalEObjectImpl.Container implements Scope { case PartialinterpretationPackage.SCOPE__TARGET_TYPE_INTERPRETATION: setTargetTypeInterpretation((PartialTypeInterpratation)null); return; + case PartialinterpretationPackage.SCOPE__MIN_NEW_ELEMENTS_HEURISTIC: + setMinNewElementsHeuristic(MIN_NEW_ELEMENTS_HEURISTIC_EDEFAULT); + return; } super.eUnset(featureID); } @@ -307,6 +365,8 @@ public class ScopeImpl extends MinimalEObjectImpl.Container implements Scope { return maxNewElements != MAX_NEW_ELEMENTS_EDEFAULT; case PartialinterpretationPackage.SCOPE__TARGET_TYPE_INTERPRETATION: return targetTypeInterpretation != null; + case PartialinterpretationPackage.SCOPE__MIN_NEW_ELEMENTS_HEURISTIC: + return minNewElementsHeuristic != MIN_NEW_ELEMENTS_HEURISTIC_EDEFAULT; } return super.eIsSet(featureID); } @@ -320,11 +380,13 @@ public class ScopeImpl extends MinimalEObjectImpl.Container implements Scope { public String toString() { if (eIsProxy()) return super.toString(); - StringBuffer result = new StringBuffer(super.toString()); + StringBuilder result = new StringBuilder(super.toString()); result.append(" (minNewElements: "); result.append(minNewElements); result.append(", maxNewElements: "); result.append(maxNewElements); + result.append(", minNewElementsHeuristic: "); + result.append(minNewElementsHeuristic); result.append(')'); return result.toString(); } diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/StringElementImpl.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/StringElementImpl.java index f207401d..0242c9b2 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/StringElementImpl.java +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/StringElementImpl.java @@ -69,6 +69,7 @@ public class StringElementImpl extends PrimitiveElementImpl implements StringEle * * @generated */ + @Override public String getValue() { return value; } @@ -78,6 +79,7 @@ public class StringElementImpl extends PrimitiveElementImpl implements StringEle * * @generated */ + @Override public void setValue(String newValue) { String oldValue = value; value = newValue; @@ -152,7 +154,7 @@ public class StringElementImpl extends PrimitiveElementImpl implements StringEle public String toString() { if (eIsProxy()) return super.toString(); - StringBuffer result = new StringBuffer(super.toString()); + StringBuilder result = new StringBuilder(super.toString()); result.append(" (value: "); result.append(value); result.append(')'); diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/UnaryElementRelationLinkImpl.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/UnaryElementRelationLinkImpl.java index 2cb56323..e76a89b7 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/UnaryElementRelationLinkImpl.java +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/UnaryElementRelationLinkImpl.java @@ -62,6 +62,7 @@ public class UnaryElementRelationLinkImpl extends RelationLinkImpl implements Un * * @generated */ + @Override public DefinedElement getParam1() { if (param1 != null && param1.eIsProxy()) { InternalEObject oldParam1 = (InternalEObject)param1; @@ -88,6 +89,7 @@ public class UnaryElementRelationLinkImpl extends RelationLinkImpl implements Un * * @generated */ + @Override public void setParam1(DefinedElement newParam1) { DefinedElement oldParam1 = param1; param1 = newParam1; diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/model/PartialInterpretation.ecore b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/model/PartialInterpretation.ecore index acf82a3f..47d54258 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/model/PartialInterpretation.ecore +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/model/PartialInterpretation.ecore @@ -27,6 +27,9 @@ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt" defaultValueLiteral="0"/> + + diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/model/PartialInterpretation.genmodel b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/model/PartialInterpretation.genmodel index 2ac0a4f3..daeaf594 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/model/PartialInterpretation.genmodel +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/model/PartialInterpretation.genmodel @@ -18,7 +18,10 @@ - + + + + @@ -33,9 +36,8 @@ - - + @@ -50,6 +52,7 @@ + @@ -70,11 +73,16 @@ + + + + + diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/Descriptor.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/Descriptor.xtend index c7c1ad77..e4bdb086 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/Descriptor.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/Descriptor.xtend @@ -60,6 +60,10 @@ import org.eclipse.xtend2.lib.StringConcatenationClient return this.dataHash.hashCode } + override equals(Object other) { + other.class == LocalNodeDescriptor && (other as AbstractNodeDescriptor).hashCode == hashCode + } + override protected prettyPrint() { '''(«dataHash»)[«IF id !== null»id = "«id»"«IF types === null || !types.empty», «ENDIF»«ENDIF»«IF types === null»TYPES = null«ELSE»«FOR type : types SEPARATOR ", "»«type»«ENDFOR»«ENDIF»]''' } @@ -143,6 +147,10 @@ import org.eclipse.xtend2.lib.StringConcatenationClient return this.dataHash.hashCode } + override equals(Object other) { + other.class == FurtherNodeDescriptor && (other as AbstractNodeDescriptor).hashCode == hashCode + } + override prettyPrint() { ''' («dataHash»)[ diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/NeighbourhoodOptions.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/NeighbourhoodOptions.xtend index efc89803..c6e03f75 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/NeighbourhoodOptions.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/NeighbourhoodOptions.xtend @@ -7,12 +7,12 @@ import org.eclipse.xtend.lib.annotations.Data @Data class NeighbourhoodOptions { - public static val FixPointRage = -1 + public static val FixPointRange = -1 public static val GraphWidthRange = -2 public static val FullParallels = Integer.MAX_VALUE public static val MaxNumbers = Integer.MAX_VALUE - public static val DEFAULT = new NeighbourhoodOptions(GraphWidthRange, FullParallels, MaxNumbers, null, null) + public static val DEFAULT = new NeighbourhoodOptions(FixPointRange, FullParallels, MaxNumbers, null, null) val int range val int parallels diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/PartialInterpretation2Hash.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/PartialInterpretation2Hash.xtend index d474877d..ddf7d712 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/PartialInterpretation2Hash.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/PartialInterpretation2Hash.xtend @@ -5,7 +5,7 @@ import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.DefinedElement class PartialInterpretation2Hash extends PartialInterpretation2NeighbourhoodRepresentation{ - protected new() { + new() { super(false, true) } diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/PartialInterpretation2NeighbourhoodRepresentation.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/PartialInterpretation2NeighbourhoodRepresentation.xtend index a0382e8e..3048167e 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/PartialInterpretation2NeighbourhoodRepresentation.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/PartialInterpretation2NeighbourhoodRepresentation.xtend @@ -25,7 +25,7 @@ abstract class PartialInterpretation2NeighbourhoodRepresentation nodeRepresentations = null - var Map modelRepresentation = null +class NeighbourhoodBasedHashStateCoderFactory extends AbstractNeighbourhoodBasedStateCoderFactory { + new() { + } new(NeighbourhoodOptions options) { super(options) } + override protected doCreateStateCoder(NeighbourhoodOptions options) { + new NeighbourhoodBasedPartialInterpretationStateCoder(new PartialInterpretation2Hash, options) + } +} + +class NeighbourhoodBasedPartialInterpretationStateCoder extends AbstractNeighbourhoodBasedPartialInterpretationStateCoder { + val PartialInterpretation2NeighbourhoodRepresentation calculator + var Map nodeRepresentations = null + var ModelRep modelRepresentation = null + + new(PartialInterpretation2NeighbourhoodRepresentation calculator, NeighbourhoodOptions options) { + super(options) + this.calculator = calculator + } + override protected isRefreshNeeded() { nodeRepresentations === null || modelRepresentation === null } diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasoner.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasoner.xtend index 1abde0a8..aa02cd30 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasoner.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasoner.xtend @@ -12,12 +12,15 @@ import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicproblemPackage import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.LogicresultFactory import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.ModelResult import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.ModelGenerationMethodProvider +import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.ScopePropagatorStrategy import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.PartialInterpretationInitialiser import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationPackage import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.statecoder.AbstractNeighbourhoodBasedStateCoderFactory import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.statecoder.IdentifierBasedStateCoderFactory +import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.statecoder.NeighbourhoodBasedHashStateCoderFactory import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.statecoder.PairwiseNeighbourhoodBasedStateCoderFactory +import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.dse.BasicScopeGlobalConstraint import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.dse.BestFirstStrategyForModelGeneration import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.dse.DiversityChecker import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.dse.InconsistentScopeGlobalConstraint @@ -39,7 +42,6 @@ import org.eclipse.viatra.dse.api.DesignSpaceExplorer import org.eclipse.viatra.dse.api.DesignSpaceExplorer.DseLoggingLevel import org.eclipse.viatra.dse.solutionstore.SolutionStore import org.eclipse.viatra.dse.statecode.IStateCoderFactory -import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.statecoder.NeighbourhoodBasedStateCoderFactory class ViatraReasoner extends LogicReasoner { val PartialInterpretationInitialiser initialiser = new PartialInterpretationInitialiser() @@ -71,6 +73,11 @@ class ViatraReasoner extends LogicReasoner { workspace.writeModel(emptySolution, "init.partialmodel") } emptySolution.problemConainer = problem + var BasicScopeGlobalConstraint basicScopeGlobalConstraint = null + if (viatraConfig.scopePropagatorStrategy == ScopePropagatorStrategy.None) { + basicScopeGlobalConstraint = new BasicScopeGlobalConstraint(emptySolution) + emptySolution.scopes.clear + } val method = modelGenerationMethodProvider.createModelGenerationMethod( problem, @@ -79,11 +86,12 @@ class ViatraReasoner extends LogicReasoner { viatraConfig.nameNewElements, viatraConfig.typeInferenceMethod, viatraConfig.scopePropagatorStrategy, + viatraConfig.hints, viatraConfig.documentationLevel ) dse.addObjective(new ModelGenerationCompositeObjective( - new ScopeObjective, + basicScopeGlobalConstraint ?: new ScopeObjective, method.unfinishedMultiplicities.map[new UnfinishedMultiplicityObjective(it)], wf2ObjectiveConverter.createCompletenessObjective(method.unfinishedWF) )) @@ -132,6 +140,9 @@ class ViatraReasoner extends LogicReasoner { dse.addGlobalConstraint(wf2ObjectiveConverter.createInvalidationGlobalConstraint(method.invalidWF)) dse.addGlobalConstraint(new SurelyViolatedObjectiveGlobalConstraint(solutionSaver)) dse.addGlobalConstraint(new InconsistentScopeGlobalConstraint) + if (basicScopeGlobalConstraint !== null) { + dse.addGlobalConstraint(basicScopeGlobalConstraint) + } for (additionalConstraint : viatraConfig.searchSpaceConstraints.additionalGlobalConstraints) { dse.addGlobalConstraint(additionalConstraint.apply(method)) } @@ -140,7 +151,7 @@ class ViatraReasoner extends LogicReasoner { val IStateCoderFactory statecoder = switch (viatraConfig.stateCoderStrategy) { case Neighbourhood: - new NeighbourhoodBasedStateCoderFactory + new NeighbourhoodBasedHashStateCoderFactory case PairwiseNeighbourhood: new PairwiseNeighbourhoodBasedStateCoderFactory default: @@ -215,10 +226,18 @@ class ViatraReasoner extends LogicReasoner { it.name = "Decisions" it.value = method.statistics.decisionsTried ] + it.entries += createIntStatisticEntry => [ + it.name = "Transformations" + it.value = method.statistics.transformationInvocations + ] it.entries += createIntStatisticEntry => [ it.name = "ScopePropagations" it.value = method.statistics.scopePropagatorInvocations ] + it.entries += createIntStatisticEntry => [ + it.name = "ScopePropagationsSolverCalls" + it.value = method.statistics.scopePropagatorSolverInvocations + ] if (diversityChecker.isActive) { it.entries += createIntStatisticEntry => [ it.name = "SolutionDiversityCheckTime" 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 a5f42a5f..6f38d261 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 @@ -16,6 +16,7 @@ import java.util.LinkedList import java.util.List import java.util.Set import org.eclipse.xtext.xbase.lib.Functions.Function1 +import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.LinearTypeConstraintHint enum StateCoderStrategy { Neighbourhood, @@ -56,6 +57,8 @@ class ViatraReasonerConfiguration extends LogicSolverConfiguration { public var ScopePropagatorStrategy scopePropagatorStrategy = new ScopePropagatorStrategy.Polyhedral( PolyhedralScopePropagatorConstraints.Relational, PolyhedralScopePropagatorSolver.Clp) + + public var List hints = newArrayList public var List costObjectives = newArrayList } diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/BasicScopeGlobalConstraint.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/BasicScopeGlobalConstraint.xtend new file mode 100644 index 00000000..67f447ed --- /dev/null +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/BasicScopeGlobalConstraint.xtend @@ -0,0 +1,103 @@ +package hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.dse + +import com.google.common.collect.ImmutableList +import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation +import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialTypeInterpratation +import java.util.Comparator +import java.util.List +import org.eclipse.viatra.dse.base.ThreadContext +import org.eclipse.viatra.dse.objectives.Comparators +import org.eclipse.viatra.dse.objectives.IGlobalConstraint +import org.eclipse.viatra.dse.objectives.IObjective +import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor + +class BasicScopeGlobalConstraint implements IGlobalConstraint, IObjective { + val PartialInterpretation p + val List assertions + + new(PartialInterpretation p) { + this.p = p + assertions = ImmutableList.copyOf(p.scopes.map [ + val currentSize = targetTypeInterpretation.elements.size + val minElements = minNewElements + currentSize + val maxElements = if (maxNewElements < 0) { + -1 + } else { + maxNewElements + currentSize + } + new ScopeAssertion(minElements, maxElements, targetTypeInterpretation) + ]) + } + + override init(ThreadContext context) { + if (context.model != p) { + throw new IllegalArgumentException( + "Partial model must be passed to the constructor of BasicScopeGlobalConstraint") + } + } + + override checkGlobalConstraint(ThreadContext context) { + assertions.forall[upperBoundSatisfied] + } + + override getFitness(ThreadContext context) { + var double fitness = p.minNewElements + for (assertion : assertions) { + if (!assertion.lowerBoundSatisfied) { + fitness += 1 + } + } + fitness + } + + override satisifiesHardObjective(Double fitness) { + fitness <= 0.01 + } + + override BasicScopeGlobalConstraint createNew() { + this + } + + override getName() { + class.name + } + + override getComparator() { + Comparators.LOWER_IS_BETTER + } + + override getLevel() { + 2 + } + + override isHardObjective() { + true + } + + override setComparator(Comparator comparator) { + throw new UnsupportedOperationException + } + + override setLevel(int level) { + throw new UnsupportedOperationException + } + + @FinalFieldsConstructor + private static class ScopeAssertion { + val int lowerBound + val int upperBound + val PartialTypeInterpratation typeDefinitions + + private def getCount() { + typeDefinitions.elements.size + } + + private def isLowerBoundSatisfied() { + count >= lowerBound + } + + private def isUpperBoundSatisfied() { + upperBound < 0 || count <= upperBound + } + } +} diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/BestFirstStrategyForModelGeneration.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/BestFirstStrategyForModelGeneration.java index 5af7fc69..081e48fa 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/BestFirstStrategyForModelGeneration.java +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/BestFirstStrategyForModelGeneration.java @@ -255,7 +255,7 @@ public class BestFirstStrategyForModelGeneration implements IStrategy { activationIds = new ArrayList(context.getUntraversedActivationIds()); Collections.shuffle(activationIds); } catch (NullPointerException e) { - logger.warn("Unexpected state code: " + context.getDesignSpaceManager().getCurrentState()); +// logger.warn("Unexpected state code: " + context.getDesignSpaceManager().getCurrentState()); numberOfStatecoderFail++; activationIds = Collections.emptyList(); } diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/ModelGenerationCompositeObjective.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/ModelGenerationCompositeObjective.xtend index 9a33753c..2976bebe 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/ModelGenerationCompositeObjective.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/ModelGenerationCompositeObjective.xtend @@ -59,7 +59,7 @@ class ModelGenerationCompositeObjective implements IThreeValuedObjective { } sum += multiplicity sum += unfinishedWFsFitness // *0.5 - // println('''Sum=«sum»|Scope=«scopeFitnes»|Multiplicity=«multiplicity»|WFs=«unfinishedWFsFitness»''') +// println('''Sum=«sum»|Scope=«scopeFitnes»|Multiplicity=«multiplicity»|WFs=«unfinishedWFsFitness»''') return sum } diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/ScopeObjective.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/ScopeObjective.xtend index 69efe0d7..e7967b00 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/ScopeObjective.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/ScopeObjective.xtend @@ -23,9 +23,9 @@ class ScopeObjective implements IObjective{ override getFitness(ThreadContext context) { val interpretation = context.model as PartialInterpretation - var res = interpretation.minNewElements.doubleValue + var res = interpretation.minNewElementsHeuristic.doubleValue for(scope : interpretation.scopes) { - res += scope.minNewElements*2 + res += scope.minNewElementsHeuristic*2 } return res } diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/UnfinishedWFObjective.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/UnfinishedWFObjective.xtend index bf34aeeb..1b61ffa5 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/UnfinishedWFObjective.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/UnfinishedWFObjective.xtend @@ -14,41 +14,51 @@ import org.eclipse.viatra.query.runtime.api.ViatraQueryMatcher class UnfinishedWFObjective implements IObjective { Collection>> unfinishedWFs val List> matchers - - new(Collection>> unfinishedWFs) { + + new( + Collection>> unfinishedWFs) { this.unfinishedWFs = unfinishedWFs matchers = new ArrayList(unfinishedWFs.size) } + override getName() '''unfinishedWFs''' + override createNew() { return new UnfinishedWFObjective(unfinishedWFs) } + override init(ThreadContext context) { - val engine = context.queryEngine//ViatraQueryEngine.on(new EMFScope(context.model)) - for(unfinishedWF : unfinishedWFs) { + val engine = context.queryEngine // ViatraQueryEngine.on(new EMFScope(context.model)) + for (unfinishedWF : unfinishedWFs) { matchers += unfinishedWF.getMatcher(engine) } } - + override getComparator() { Comparators.LOWER_IS_BETTER } + override getFitness(ThreadContext context) { var sumOfMatches = 0 - for(matcher : matchers) { + for (matcher : matchers) { val number = matcher.countMatches - //println('''«matcher.patternName» = «number»''') - sumOfMatches+=number +// if (number > 0) { +// println('''«matcher.patternName» = «number»''') +// } + sumOfMatches += number } return sumOfMatches.doubleValue } - + override getLevel() { 2 } + override isHardObjective() { true } - override satisifiesHardObjective(Double fitness) { return fitness <=0.01 } - + + override satisifiesHardObjective(Double fitness) { return fitness <= 0.01 } + override setComparator(Comparator comparator) { throw new UnsupportedOperationException() } + override setLevel(int level) { throw new UnsupportedOperationException() } -} \ No newline at end of file +} diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/ViatraReasonerSolutionSaver.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/ViatraReasonerSolutionSaver.xtend index 6bffeb59..74500cc2 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/ViatraReasonerSolutionSaver.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/ViatraReasonerSolutionSaver.xtend @@ -42,7 +42,7 @@ class ViatraReasonerSolutionSaver implements ISolutionSaver { private def saveBestSolutionOnly(ThreadContext context, Object id, SolutionTrajectory solutionTrajectory) { val fitness = context.lastFitness - if (!fitness.satisifiesHardObjectives) { + if (!shouldSaveSolution(fitness, context)) { return false } val dominatedTrajectories = newArrayList @@ -83,7 +83,7 @@ class ViatraReasonerSolutionSaver implements ISolutionSaver { private def saveAnyDiverseSolution(ThreadContext context, Object id, SolutionTrajectory solutionTrajectory) { val fitness = context.lastFitness - if (!fitness.satisifiesHardObjectives) { + if (!shouldSaveSolution(fitness, context)) { return false } if (!diversityChecker.newSolution(context, id, emptyList)) { @@ -92,7 +92,12 @@ class ViatraReasonerSolutionSaver implements ISolutionSaver { basicSaveSolution(context, id, solutionTrajectory, fitness) } - private def basicSaveSolution(ThreadContext context, Object id, SolutionTrajectory solutionTrajectory, Fitness fitness) { + private def shouldSaveSolution(Fitness fitness, ThreadContext context) { + return fitness.satisifiesHardObjectives + } + + private def basicSaveSolution(ThreadContext context, Object id, SolutionTrajectory solutionTrajectory, + Fitness fitness) { var boolean solutionSaved = false var dseSolution = solutionsCollection.get(id) if (dseSolution === null) { diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/META-INF/MANIFEST.MF b/Tests/hu.bme.mit.inf.dslreasoner.run/META-INF/MANIFEST.MF index cc274c7c..fe223d4a 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/META-INF/MANIFEST.MF +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/META-INF/MANIFEST.MF @@ -28,8 +28,10 @@ Require-Bundle: hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlan hu.bme.mit.inf.dslreasoner.visualisation;bundle-version="1.0.0", hu.bme.mit.inf.dslreasoner.domains.alloyexamples;bundle-version="1.0.0", org.eclipse.collections;bundle-version="9.2.0", - org.eclipse.viatra.query.patternlanguage.emf;bundle-version="2.2.0", - org.eclipse.viatra.query.runtime.rete;bundle-version="2.2.0", - org.objectweb.asm;bundle-version="7.0.0" + org.eclipse.viatra.query.patternlanguage.emf;bundle-version="2.0.0", + org.eclipse.viatra.query.runtime.rete;bundle-version="2.0.0", + org.objectweb.asm;bundle-version="7.0.0", + com.google.gson;bundle-version="2.8.2", + hu.bme.mit.inf.dslreasoner.domains.satellite;bundle-version="0.1.0" Import-Package: org.apache.log4j Bundle-RequiredExecutionEnvironment: JavaSE-1.8 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 new file mode 100644 index 00000000..26df3c74 --- /dev/null +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/configs/FAM_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json @@ -0,0 +1,13 @@ +{ + "inputPath": "initialModels", + "outputPath": "outputModels", + "timeout": 1200, + "saveModels": true, + "warmupIterations": 0, + "iterations": 1, + "domain": "FAM", + "scope": "none", + "sizes": [500], + "solver": "ViatraSolver", + "scopePropagator": "basic" +} 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 new file mode 100644 index 00000000..5f8a01b1 --- /dev/null +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/configs/Yakindu_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json @@ -0,0 +1,16 @@ +{ + "inputPath": "initialModels", + "outputPath": "outputModels", + "timeout": 1200, + "saveModels": false, + "warmupIterations": 0, + "iterations": 5, + "domain": "Yakindu", + "scope": "quantiles", + "sizes": [100], + "solver": "ViatraSolver", + "scopePropagator": "polyhedral", + "propagatedConstraints": "hints", + "polyhedronSolver": "Clp", + "scopeHeuristic": "basic" +} 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/ecore_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json new file mode 100644 index 00000000..42073422 --- /dev/null +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/configs/ecore_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json @@ -0,0 +1,15 @@ +{ + "inputPath": "initialModels", + "outputPath": "outputModels", + "timeout": 1200, + "saveModels": true, + "warmupIterations": 0, + "iterations": 5, + "domain": "ecore", + "scope": "quantiles", + "sizes": [100], + "solver": "ViatraSolver", + "scopePropagator": "polyhedral", + "propagatedConstraints": "relations", + "polyhedronSolver": "Clp" +} 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/fs_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json new file mode 100644 index 00000000..d7955ddd --- /dev/null +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/configs/fs_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json @@ -0,0 +1,15 @@ +{ + "inputPath": "initialModels", + "outputPath": "outputModels", + "timeout": 1200, + "saveModels": true, + "warmupIterations": 1, + "iterations": 1, + "domain": "fs", + "scope": "useful", + "sizes": [50, 100, 150, 200, 250, 300, 350, 400, 450, 500], + "solver": "ViatraSolver", + "scopePropagator": "polyhedral", + "propagatedConstraints": "relations", + "polyhedronSolver": "Clp" +} 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 new file mode 100644 index 00000000..474962e7 --- /dev/null +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/configs/satellite_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json @@ -0,0 +1,17 @@ +{ + "inputPath": "initialModels", + "outputPath": "outputModels", + "timeout": 1200, + "saveModels": true, + "saveTemporaryFiles": true, + "warmupIterations": 0, + "iterations": 1, + "domain": "satellite", + "scope": "quantiles", + "sizes": [50], + "solver": "ViatraSolver", + "scopePropagator": "polyhedral", + "propagatedConstraints": "hints", + "polyhedronSolver": "Clp", + "scopeHeuristic": "polyhedral" +} diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/initialModels/satellite.xmi b/Tests/hu.bme.mit.inf.dslreasoner.run/initialModels/satellite.xmi new file mode 100644 index 00000000..77f6ecfd --- /dev/null +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/initialModels/satellite.xmi @@ -0,0 +1,14 @@ + + + + + + + diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/CountMatches.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/CountMatches.xtend deleted file mode 100644 index 02caf9dd..00000000 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/CountMatches.xtend +++ /dev/null @@ -1,176 +0,0 @@ -package hu.bme.mit.inf.dslreasoner.run - -import hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph.yakindumm.YakindummPackage -import hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.mutated.Mutated -import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace -import java.io.File -import java.util.ArrayList -import java.util.Collection -import java.util.Comparator -import java.util.HashMap -import java.util.List -import java.util.Map -import java.util.TreeSet -import org.eclipse.emf.ecore.EObject -import org.eclipse.emf.ecore.resource.Resource -import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl -import org.eclipse.viatra.query.runtime.api.IPatternMatch -import org.eclipse.viatra.query.runtime.api.IQuerySpecification -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine -import org.eclipse.viatra.query.runtime.emf.EMFScope - -class QueryComparator implements Comparator>{ - - override compare(IQuerySpecification arg0, IQuerySpecification arg1) { - arg0.fullyQualifiedName.compareTo(arg1.fullyQualifiedName) - } -} - -class CountMatches { - var static List> wfPatterns; - var static Map,IQuerySpecification> query2Reference - - def static void main(String[] args) { - YakindummPackage.eINSTANCE.eClass - Resource.Factory.Registry.INSTANCE.extensionToFactoryMap.put("*",new XMIResourceFactoryImpl) - - wfPatterns = Mutated.instance.specifications.toList; - //wfPatterns = wfPatterns.filter[it.allAnnotations.exists[it.name == "Constraint"]].toList - wfPatterns.sort(new QueryComparator) - - val groupName2Representant = new HashMap - query2Reference = new HashMap - for(wfPattern : wfPatterns) { - val groupName = wfPattern.groupName - if(groupName2Representant.containsKey(groupName)) { - val representant = groupName2Representant.get(groupName) - query2Reference.put(wfPattern,representant) - } else { - groupName2Representant.put(groupName,wfPattern) - } - } - - - println('''modelpath;run;model;« - FOR wfPattern:wfPatterns SEPARATOR ";"»#(« - wfPattern.fullyQualifiedName.split("\\.").last»);hash(« - wfPattern.fullyQualifiedName.split("\\.").last»)«ENDFOR»;« - FOR mutant : wfPatterns.filter[query2Reference.keySet.contains(it)] SEPARATOR ';'»diff(« - mutant.fullyQualifiedName.split("\\.").last»)«ENDFOR»''' - ) - countMatches('''D:/FASE18Meas/RemoHF''') - } - - def private static simpleName(IQuerySpecification wfPattern) { - wfPattern.fullyQualifiedName.split("\\.").last - } - def private static groupName(IQuerySpecification wfPattern) { - wfPattern.simpleName.split('_').head - } - - def static void countMatches(String path) { - val file = new File(path) - if(file.isDirectory) { - for(subFileName : file.list) { - (path + "/" + subFileName).countMatches - } - } else if(file.isFile) { - if(path.endsWith("xmi")) { - countMatches(file,path) - } - } - } - - def static void countMatches(File file, String path) { - - - val pathSegments = path.split("/") - val groupName = pathSegments.get(pathSegments.size-2).split("\\.").last.split("_").get(0) - print(groupName +";") - val nameExtension = pathSegments.get(pathSegments.size-1).split("\\.").get(0).split("_") - try{ - val runNumber = nameExtension.get(1) - val modelNumber = nameExtension.get(2) - print('''«runNumber»;«modelNumber»''') - } catch(Exception e) { - print('''«file.name»;0''') - } - - val parent = file.parent - val workspace = new FileSystemWorkspace(parent,"") - val model = workspace.readModel(EObject,file.name) - - val engine = ViatraQueryEngine.on(new EMFScope(model)) - val objectCode = model.eResource.calculateObjectCode - - val pattern2Hash = new HashMap - for(pattern : wfPatterns) { - val matcher = pattern.getMatcher(engine) - val matches = matcher.allMatches - val hash = matches.getMatchSetDescriptor(objectCode) - pattern2Hash.put(pattern,hash) - print(''';«matcher.countMatches»;«hash»''') - } - var mutantsKilled = 0 - for(mutant : wfPatterns.filter[query2Reference.keySet.contains(it)]) { - val equals = pattern2Hash.get(mutant) == pattern2Hash.get(query2Reference.get(mutant)) - print(''';''') - if(equals) { - print('0') - } else { - print('1') - mutantsKilled++ - } - } - //print(''';«mutantsKilled»''') - println() - } - - def static Map calculateObjectCode(Resource resource) { - val res = new HashMap - val iterator = resource.allContents - var index = 1 - while(iterator.hasNext) { - res.put(iterator.next,index++) - } - return res - } - - def static getMatchSetDescriptor(Collection matchSet, Map objectCode) { - val set = new TreeSet(new ArrayComparator) - for(match: matchSet) { - val size = match.parameterNames.size - val idArray = new ArrayList(size) - for(i:0..> { - - override compare(List arg0, List arg1) { - if(arg0.size === arg1.size) { - for(i : 0.. nameToType + val Map> nameToRelation + + protected new(Ecore2Logic ecore2Logic, Ecore2Logic_Trace trace) { + nameToType = ImmutableMap.copyOf(ecore2Logic.allClassesInScope(trace).toMap[name].mapValues [ eClass | + ecore2Logic.TypeofEClass(trace, eClass) + ]) + nameToRelation = ImmutableMap.copyOf(ecore2Logic.allReferencesInScope(trace).groupBy[EContainingClass.name]. + mapValues [ references | + ImmutableMap.copyOf(references.toMap[name].mapValues [ reference | + ecore2Logic.relationOfReference(trace, reference) + ]) + ]) + } + + protected def getType(String name) { + nameToType.get(name) + } + + protected def relation(String typeName, String relationName) { + nameToRelation.get(typeName).get(relationName) + } + + protected static def int countMatches(ViatraQueryMatcher matcher, PartialInterpretation p) { + val match = matcher.newEmptyMatch + match.set(0, p.problem) + match.set(1, p) + matcher.countMatches(match) + } + + protected static def int getCount(ViatraQueryMatcher matcher, PartialInterpretation p) { + val match = matcher.newEmptyMatch + match.set(0, p.problem) + match.set(1, p) + val realMatch = matcher.getOneArbitraryMatch(match) + if (realMatch.present) { + realMatch.get.get(2) as Integer + } else { + 0 + } + } +} 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 34f3c267..54724226 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 @@ -4,18 +4,23 @@ import functionalarchitecture.FunctionalarchitecturePackage import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Ecore import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.FileSystem import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FilesystemPackage +import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SatelliteQueriesAll import hu.bme.mit.inf.dslreasoner.domains.transima.fam.FamPatterns import hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph.yakindumm.YakindummPackage +import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic +import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic_Trace import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor import hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.Patterns import hu.bme.mit.inf.dslreasoner.viatra2logic.ViatraQuerySetDescriptor import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.ModelGenerationMethod +import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.LinearTypeConstraintHint import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ModelGenerationMethodBasedGlobalConstraint import hu.bme.mit.inf.dslreasoner.workspace.ReasonerWorkspace import java.util.Collection import java.util.HashMap import java.util.LinkedHashMap import java.util.List +import java.util.Map import java.util.Set import org.eclipse.emf.ecore.EAttribute import org.eclipse.emf.ecore.EClass @@ -24,60 +29,83 @@ import org.eclipse.emf.ecore.EEnumLiteral import org.eclipse.emf.ecore.EObject import org.eclipse.emf.ecore.EReference import org.eclipse.emf.ecore.EcorePackage +import org.eclipse.xtend.lib.annotations.Data import org.eclipse.xtext.xbase.lib.Functions.Function1 -import hu.bme.mit.inf.dslreasoner.domains.transima.fam.Type -import hu.bme.mit.inf.dslreasoner.domains.transima.fam.Model +import satellite.SatellitePackage + +@Data +class TypeQuantiles { + double low + double high +} abstract class MetamodelLoader { protected val ReasonerWorkspace workspace + new(ReasonerWorkspace workspace) { this.workspace = workspace - } + } + def EcoreMetamodelDescriptor loadMetamodel() + def Set getRelevantTypes(EcoreMetamodelDescriptor descriptor) + def Set getRelevantReferences(EcoreMetamodelDescriptor descriptor) + def ViatraQuerySetDescriptor loadQueries(EcoreMetamodelDescriptor metamodel) + def List loadPartialModel() - - def List> additionalConstraints() - - def filterByNames(Iterable collection, Function1 nameExtractor, Collection requiredNames) { + + def List> additionalConstraints() + + def Map getTypeQuantiles() { + emptyMap + } + + def List getHints(Ecore2Logic ecore2Logic, Ecore2Logic_Trace trace) { + emptyList + } + + def filterByNames(Iterable collection, Function1 nameExtractor, + Collection requiredNames) { val res = collection.filter[requiredNames.contains(nameExtractor.apply(it))] if(res.size != requiredNames.size) throw new IllegalArgumentException return res.toSet } } -class FAMLoader extends MetamodelLoader{ - +class FAMLoader extends MetamodelLoader { + new(ReasonerWorkspace workspace) { super(workspace) } - + override loadMetamodel() { val package = FunctionalarchitecturePackage.eINSTANCE val List classes = package.EClassifiers.filter(EClass).toList val List enums = package.EClassifiers.filter(EEnum).toList val List literals = enums.map[ELiterals].flatten.toList - val List references = classes.map[EReferences].flatten.toList + val List references = classes.map[EReferences].flatten.filter[name != "type" && name != "model"]. + toList val List attributes = classes.map[EAttributes].flatten.toList - return new EcoreMetamodelDescriptor(classes,#{},false,enums,literals,references,attributes) + return new EcoreMetamodelDescriptor(classes, #{}, false, enums, literals, references, attributes) } - - override getRelevantTypes(EcoreMetamodelDescriptor descriptor) { - return descriptor.classes.filterByNames([it.name],#["FunctionalElement"]) + + override getRelevantTypes(EcoreMetamodelDescriptor descriptor) { + return descriptor.classes.filterByNames([it.name], #["FunctionalElement"]) } + override getRelevantReferences(EcoreMetamodelDescriptor descriptor) { - return descriptor.references.filterByNames([it.name],#["subElements"]) + return descriptor.references.filterByNames([it.name], #["subElements"]) } - + override loadQueries(EcoreMetamodelDescriptor metamodel) { val i = FamPatterns.instance val patterns = i.specifications.toList - val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name== "Constraint"]].toSet + val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name == "Constraint"]].toSet val derivedFeatures = new LinkedHashMap - derivedFeatures.put(Type.instance,metamodel.attributes.filter[it.name == "type"].head) - derivedFeatures.put(Model.instance,metamodel.references.filter[it.name == "model"].head) +// derivedFeatures.put(Type.instance,metamodel.attributes.filter[it.name == "type"].head) +// derivedFeatures.put(Model.instance,metamodel.references.filter[it.name == "model"].head) val res = new ViatraQuerySetDescriptor( patterns, wfPatterns, @@ -85,65 +113,67 @@ class FAMLoader extends MetamodelLoader{ ) return res } + override loadPartialModel() { - this.workspace.readModel(EObject,"FAM.xmi").eResource.allContents.toList + this.workspace.readModel(EObject, "FAM.xmi").eResource.allContents.toList } - + override additionalConstraints() { #[] } } -class YakinduLoader extends MetamodelLoader{ - +class YakinduLoader extends MetamodelLoader { + var useSynchronization = true; - var useComplexStates = false; - public static val patternsWithSynchronization = #[ - "synchHasNoOutgoing", "synchHasNoIncoming", "SynchronizedIncomingInSameRegion", "notSynchronizingStates", - "hasMultipleOutgoingTrainsition", "hasMultipleIncomingTrainsition", "SynchronizedRegionsAreNotSiblings", - "SynchronizedRegionDoesNotHaveMultipleRegions", "synchThree", "twoSynch","noSynch2","synch","noSynch4","noSynch3","noSynch"] - public static val patternsWithComplexStates =#["outgoingFromExit","outgoingFromFinal","choiceHasNoOutgoing","choiceHasNoIncoming"] + var useComplexStates = false; + public static val patternsWithSynchronization = #["synchHasNoOutgoing", "synchHasNoIncoming", + "SynchronizedIncomingInSameRegion", "SynchronizedIncomingInSameRegionHelper1", + "SynchronizedIncomingInSameRegionHelper2", "notSynchronizingStates", "hasMultipleOutgoingTrainsition", + "hasMultipleIncomingTrainsition", "SynchronizedRegionsAreNotSiblings", + "SynchronizedRegionsAreNotSiblingsHelper1", "SynchronizedRegionsAreNotSiblingsHelper2", + "SynchronizedRegionDoesNotHaveMultipleRegions", "synchThree", "twoSynch", "noSynch2", "synch", "noSynch4", + "noSynch3", "noSynch"] + public static val patternsWithComplexStates = #["outgoingFromExit", "outgoingFromFinal", "choiceHasNoOutgoing", + "choiceHasNoIncoming"] + new(ReasonerWorkspace workspace) { super(workspace) YakindummPackage.eINSTANCE.eClass } - + def setUseSynchronization(boolean useSynchronization) { this.useSynchronization = useSynchronization } + def setUseComplexStates(boolean useComplexStates) { this.useComplexStates = useComplexStates } - + override loadMetamodel() { val useSynchInThisLoad = this.useSynchronization val useComplexStates = this.useComplexStates - + val package = YakindummPackage.eINSTANCE - val List classes = package.EClassifiers.filter(EClass) - .filter[useSynchInThisLoad || (it.name != "Synchronization")] - .filter[useComplexStates || (it.name != "Choice" && it.name != "Exit" && it.name != "FinalState")] - .toList + val List classes = package.EClassifiers.filter(EClass).filter [ + useSynchInThisLoad || (it.name != "Synchronization") + ].filter[useComplexStates || (it.name != "Choice" && it.name != "Exit" && it.name != "FinalState")].toList val List enums = package.EClassifiers.filter(EEnum).toList val List literals = enums.map[ELiterals].flatten.toList val List references = classes.map[EReferences].flatten.toList val List attributes = classes.map[EAttributes].flatten.toList - return new EcoreMetamodelDescriptor(classes,#{},false,enums,literals,references,attributes) + return new EcoreMetamodelDescriptor(classes, #{}, false, enums, literals, references, attributes) } + override loadQueries(EcoreMetamodelDescriptor metamodel) { val useSynchInThisLoad = this.useSynchronization - + val i = Patterns.instance - val patterns = i.specifications - .filter[spec | - useSynchInThisLoad || - !patternsWithSynchronization.exists[spec.fullyQualifiedName.endsWith(it)] - ] - .filter[spec | - useComplexStates || - !patternsWithComplexStates.exists[spec.fullyQualifiedName.endsWith(it)] - ] - .toList - val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name== "Constraint"]].toSet + val patterns = i.specifications.filter [ spec | + useSynchInThisLoad || !patternsWithSynchronization.exists[spec.fullyQualifiedName.endsWith(it)] + ].filter [ spec | + useComplexStates || !patternsWithComplexStates.exists[spec.fullyQualifiedName.endsWith(it)] + ].toList + val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name == "Constraint"]].toSet val derivedFeatures = new LinkedHashMap val res = new ViatraQuerySetDescriptor( patterns, @@ -152,53 +182,71 @@ class YakinduLoader extends MetamodelLoader{ ) return res } + override getRelevantTypes(EcoreMetamodelDescriptor descriptor) { - descriptor.classes.filterByNames([it.name],#["Vertex","Transition","Synchronization"]) + descriptor.classes.filterByNames([it.name], #["Vertex", "Transition", "Synchronization"]) } - + override getRelevantReferences(EcoreMetamodelDescriptor descriptor) { - descriptor.references.filterByNames([it.name],#["source","target"]) + descriptor.references.filterByNames([it.name], #["source", "target"]) } - + override loadPartialModel() { - this.workspace.readModel(EObject,"Yakindu.xmi").eResource.allContents.toList + this.workspace.readModel(EObject, "Yakindu.xmi").eResource.allContents.toList } - - override additionalConstraints() { //#[] - #[[method | new SGraphInconsistencyDetector(method)]] + + override additionalConstraints() { // #[] + #[[method|new SGraphInconsistencyDetector(method)]] + } + + override getTypeQuantiles() { + #{ + "Choice" -> new TypeQuantiles(0.118279569892473, 0.154020979020979), + "Entry" -> new TypeQuantiles(0.0283018867924528, 0.0620167525773196), + "Exit" -> new TypeQuantiles(0, 0), + "FinalState" -> new TypeQuantiles(0, 0), + "Region" -> new TypeQuantiles(0.0294117647058824, 0.0633258678611422), + "State" -> new TypeQuantiles(0.132023636740618, 0.175925925925926), +// "Statechart" -> new TypeQuantiles(0.00961538461538462, 0.010752688172043), + "Transition" -> new TypeQuantiles(0.581632653061224, 0.645161290322581) + } + } + + override getHints(Ecore2Logic ecore2Logic, Ecore2Logic_Trace trace) { + #[new SGraphHint(ecore2Logic, trace)] } } -class FileSystemLoader extends MetamodelLoader{ - +class FileSystemLoader extends MetamodelLoader { + new(ReasonerWorkspace workspace) { super(workspace) } - + override loadMetamodel() { val package = FilesystemPackage.eINSTANCE val List classes = package.EClassifiers.filter(EClass).toList val List enums = package.EClassifiers.filter(EEnum).toList val List literals = enums.map[ELiterals].flatten.toList - val List references = classes.map[EReferences].flatten.toList + val List references = classes.map[EReferences].flatten.filter[name != "live"].toList val List attributes = classes.map[EAttributes].flatten.toList - return new EcoreMetamodelDescriptor(classes,#{},false,enums,literals,references,attributes) + return new EcoreMetamodelDescriptor(classes, #{}, false, enums, literals, references, attributes) } - + override getRelevantTypes(EcoreMetamodelDescriptor descriptor) { return null } - + override getRelevantReferences(EcoreMetamodelDescriptor descriptor) { null } - + override loadQueries(EcoreMetamodelDescriptor metamodel) { val patternGroup = FileSystem.instance val patterns = patternGroup.specifications.toList val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name == "Constraint"]].toSet val derivedFeatures = new HashMap - derivedFeatures.put(patternGroup.live,metamodel.references.filter[it.name == "live"].head) +// derivedFeatures.put(patternGroup.live,metamodel.references.filter[it.name == "live"].head) return new ViatraQuerySetDescriptor( patterns, wfPatterns, @@ -206,41 +254,46 @@ class FileSystemLoader extends MetamodelLoader{ ) } - + override loadPartialModel() { - this.workspace.readModel(EObject,"fs.xmi").eResource.allContents.toList + this.workspace.readModel(EObject, "fs.xmi").eResource.allContents.toList } - + override additionalConstraints() { - #[[method | new FileSystemInconsistencyDetector(method)]] + #[[method|new FileSystemInconsistencyDetector(method)]] } - + } class EcoreLoader extends MetamodelLoader { - + new(ReasonerWorkspace workspace) { super(workspace) } - + override loadMetamodel() { val package = EcorePackage.eINSTANCE - val List classes = package.EClassifiers.filter(EClass).filter[it.name!="EFactory"].toList + val List classes = package.EClassifiers.filter(EClass).filter [ + it.name != "EFactory" && it.name != "EObject" && it.name != "EResource" + ].toList val List enums = package.EClassifiers.filter(EEnum).toList val List literals = enums.map[ELiterals].flatten.toList - val List references = classes.map[EReferences].flatten.filter[it.name!="eFactoryInstance"].filter[!it.derived].toList - val List attributes = #[] //classes.map[EAttributes].flatten.toList - return new EcoreMetamodelDescriptor(classes,#{},false,enums,literals,references,attributes) + val List references = classes.map[EReferences].flatten.filter [ + it.name != "eFactoryInstance" && it.name != "contents" && it.name != "references" && + it.name != "eGenericType" && it.name != "eGenericSuperTypes" + ].filter[!it.derived].toList + val List attributes = #[] // classes.map[EAttributes].flatten.toList + return new EcoreMetamodelDescriptor(classes, #{}, false, enums, literals, references, attributes) } - + override getRelevantTypes(EcoreMetamodelDescriptor descriptor) { return null } - + override getRelevantReferences(EcoreMetamodelDescriptor descriptor) { null } - + override loadQueries(EcoreMetamodelDescriptor metamodel) { val patternGroup = Ecore.instance val patterns = patternGroup.specifications.toList @@ -253,13 +306,92 @@ class EcoreLoader extends MetamodelLoader { ) } - + override loadPartialModel() { - this.workspace.readModel(EObject,"ecore.xmi").eResource.allContents.toList + this.workspace.readModel(EObject, "ecore.xmi").eResource.allContents.toList } - + override additionalConstraints() { #[] } + + override getTypeQuantiles() { + #{ + "EAnnotation" -> new TypeQuantiles(0, 0), + "EAttribute" -> new TypeQuantiles(0.14, 0.300943396226415), + "EClass" -> new TypeQuantiles(0.224014336917563, 0.372881355932203), + "EDataType" -> new TypeQuantiles(0, 0), + "EEnum" -> new TypeQuantiles(0, 0.0275208638045255), + "EEnumLiteral" -> new TypeQuantiles(0, 0.105204907665065), + "EGenericType" -> new TypeQuantiles(0, 0), + "EOperation" -> new TypeQuantiles(0, 0), + "EPackage" -> new TypeQuantiles(0.0119047619047619, 0.0192307692307692), + "EParameter" -> new TypeQuantiles(0, 0), + "EReference" -> new TypeQuantiles(0.217599234815878, 0.406779661016949), + "EStringToStringMapEntry" -> new TypeQuantiles(0, 0), + "ETypeParameter" -> new TypeQuantiles(0, 0) + } + } + +} + +class SatelliteLoader extends MetamodelLoader { + + new(ReasonerWorkspace workspace) { + super(workspace) + } + + override loadMetamodel() { + val package = SatellitePackage.eINSTANCE + val List classes = package.EClassifiers.filter(EClass).toList + val List enums = package.EClassifiers.filter(EEnum).toList + val List literals = enums.map[ELiterals].flatten.toList + val List references = classes.map[EReferences].flatten.toList + val List attributes = classes.map[EAttributes].flatten.toList + return new EcoreMetamodelDescriptor(classes, #{}, false, enums, literals, references, attributes) + } + + override getRelevantTypes(EcoreMetamodelDescriptor descriptor) { + null + } + + override getRelevantReferences(EcoreMetamodelDescriptor descriptor) { + null + } + + override loadQueries(EcoreMetamodelDescriptor metamodel) { + val i = SatelliteQueriesAll.instance + val patterns = i.specifications.toList + val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name == "Constraint"]].toSet + val derivedFeatures = new LinkedHashMap + val res = new ViatraQuerySetDescriptor( + patterns, + wfPatterns, + derivedFeatures + ) + return res + } + + override loadPartialModel() { + this.workspace.readModel(EObject, "satellite.xmi").eResource.allContents.toList + } + + override additionalConstraints() { #[] } + + override getHints(Ecore2Logic ecore2Logic, Ecore2Logic_Trace trace) { + #[new SatelliteHint(ecore2Logic, trace)] + } + + override getTypeQuantiles() { + #{ + "CubeSat3U" -> new TypeQuantiles(0.1, 0.25), + "CubeSat6U" -> new TypeQuantiles(0, 0.25), + "SmallSat" -> new TypeQuantiles(0, 0.15), + "UHFCommSubsystem" -> new TypeQuantiles(0.08, 0.25), + "XCommSubsystem" -> new TypeQuantiles(0.08, 0.25), + "KaCommSubsystem" -> new TypeQuantiles(0, 0.1), + "InterferometryPayload" -> new TypeQuantiles(0.15, 0.25) + } + } -} \ No newline at end of file +} diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SGraphHint.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SGraphHint.xtend new file mode 100644 index 00000000..97ce4ee6 --- /dev/null +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SGraphHint.xtend @@ -0,0 +1,46 @@ +package hu.bme.mit.inf.dslreasoner.run + +import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic +import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic_Trace +import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.LinearTypeExpressionBuilderFactory +import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.patterns.PatternGenerator + +class SGraphHint extends Ecore2LogicTraceBasedHint { + new(Ecore2Logic ecore2Logic, Ecore2Logic_Trace trace) { + super(ecore2Logic, trace) + } + + override getAdditionalPatterns(extension PatternGenerator patternGenerator) { + "" + } + + override createConstraintUpdater(LinearTypeExpressionBuilderFactory it) { + val newEntriesWithoutRegionCount = createBuilder.add(1, "Entry".type).add(-1, "Region".type).build + val newStatesWithoutRegionCount = createBuilder.add(1, "State".type).add(-1, "Region".type).build + val newTransitionWithoutNeedsOutgoingCount = createBuilder.add(1, "Transition".type).add(-1, "Entry".type). + add(-1, "Choice".type).build + val newTransitionWithoutNeedsIncomingCount = createBuilder.add(1, "Transition".type).add(-1, "Choice".type). + build + + val regionsWithoutEntryMatcher = createMatcher( + "unfinishedBy_pattern_hu_bme_mit_inf_dslreasoner_partialsnapshot_mavo_yakindu_noEntryInRegion") + val regionsWithoutStateMatcher = createMatcher( + "unfinishedBy_pattern_hu_bme_mit_inf_dslreasoner_partialsnapshot_mavo_yakindu_noStateInRegion") + val entryHasNoOutgoingMatcher = createMatcher( + "unfinishedBy_pattern_hu_bme_mit_inf_dslreasoner_partialsnapshot_mavo_yakindu_noOutgoingTransitionFromEntry") + val choiceHasNoOutgoingMatcher = createMatcher( + "unfinishedBy_pattern_hu_bme_mit_inf_dslreasoner_partialsnapshot_mavo_yakindu_choiceHasNoOutgoing") + val choiceHasNoIncomingMatcher = createMatcher( + "unfinishedBy_pattern_hu_bme_mit_inf_dslreasoner_partialsnapshot_mavo_yakindu_choiceHasNoIncoming") + val transitionWithoutTargetMatcher = createMatcher("unfinishedLowerMultiplicity_target_reference_Transition") + + return [ p | + newEntriesWithoutRegionCount.assertEqualsTo(regionsWithoutEntryMatcher.countMatches(p)) + newStatesWithoutRegionCount.tightenLowerBound(regionsWithoutStateMatcher.countMatches(p)) + newTransitionWithoutNeedsOutgoingCount.tightenLowerBound( + entryHasNoOutgoingMatcher.countMatches(p) + choiceHasNoOutgoingMatcher.countMatches(p)) + newTransitionWithoutNeedsIncomingCount.tightenLowerBound( + choiceHasNoIncomingMatcher.countMatches(p) - transitionWithoutTargetMatcher.getCount(p)) + ] + } +} diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SatelliteHint.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SatelliteHint.xtend new file mode 100644 index 00000000..e95c0c64 --- /dev/null +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SatelliteHint.xtend @@ -0,0 +1,86 @@ +package hu.bme.mit.inf.dslreasoner.run + +import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic +import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic_Trace +import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.Modality +import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.LinearTypeExpressionBuilderFactory +import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.patterns.PatternGenerator + +class SatelliteHint extends Ecore2LogicTraceBasedHint { + static val INTERFEROMETY_PAYLOAD = "hint_interferometryPayload" + static val REMAINING_CONTENTS_KA_COMM_SUBSYSTEM = "hint_kaCommSubsystem" + static val HINT_SPACECRAFT_UHF_POSSIBLE_LINK = "hint_spacecraftWithUhfPossibleLink" + static val HINT_SPACECRAFT_UHF_ONLY_NO_LINK = "hint_spacecraftUhfOnlyNoLink" + + new(Ecore2Logic ecore2Logic, Ecore2Logic_Trace trace) { + super(ecore2Logic, trace) + } + + override getAdditionalPatterns(PatternGenerator it) ''' + pattern «INTERFEROMETY_PAYLOAD»(problem:LogicProblem, interpretation:PartialInterpretation, object:DefinedElement) { + find interpretation(problem, interpretation); + find mustExist(problem, interpretation, object); + «typeIndexer.referInstanceOf("InterferometryPayload".type, Modality.MUST, "object")» + } + + private pattern «REMAINING_CONTENTS_KA_COMM_SUBSYSTEM»_helper(problem:LogicProblem, interpretation:PartialInterpretation, object:DefinedElement, remainingContents:java Integer) { + find remainingContents_commSubsystem_reference_CommunicatingElement_helper(problem, interpretation, object, remainingContents); + «typeIndexer.referInstanceOf("SmallSat".type, Modality.MUST, "object")» + } + + pattern «REMAINING_CONTENTS_KA_COMM_SUBSYSTEM»(problem:LogicProblem, interpretation:PartialInterpretation, remainingContents:java Integer) { + find interpretation(problem, interpretation); + remainingContents == sum find «REMAINING_CONTENTS_KA_COMM_SUBSYSTEM»_helper(problem, interpretation, _, #_); + } + + private pattern hint_spacecraftNotUhfOnly(problem:LogicProblem, interpretation:PartialInterpretation, spacecraft:DefinedElement) { + find interpretation(problem, interpretation); + find mustExist(problem, interpretation, spacecraft); + «typeIndexer.referInstanceOf("Spacecraft".type, Modality.MUST, "spacecraft")» + «relationDeclarationIndexer.referRelation("CommunicatingElement".relation("commSubsystem"), "spacecraft", "comm", Modality.MAY)» + neg «typeIndexer.referInstanceOf("UHFCommSubsystem".type, Modality.MUST, "comm")» + } + + private pattern hint_spacecraftWithUhf(problem:LogicProblem, interpretation:PartialInterpretation, spacecraft:DefinedElement) { + find interpretation(problem, interpretation); + find mustExist(problem, interpretation, spacecraft); + «typeIndexer.referInstanceOf("Spacecraft".type, Modality.MUST, "spacecraft")» + «relationDeclarationIndexer.referRelation("CommunicatingElement".relation("commSubsystem"), "spacecraft", "comm", Modality.MUST)» + «typeIndexer.referInstanceOf("UHFCommSubsystem".type, Modality.MUST, "comm")» + } + + pattern «HINT_SPACECRAFT_UHF_POSSIBLE_LINK»(problem:LogicProblem, interpretation:PartialInterpretation) { + find hint_spacecraftWithUhf(problem, interpretation, spacecraft); + find hint_spacecraftNotUhfOnly(problem, interpretation, spacecraft); + } + + pattern «HINT_SPACECRAFT_UHF_ONLY_NO_LINK»(problem:LogicProblem, interpretation:PartialInterpretation) { + find interpretation(problem, interpretation); + find mustExist(problem, interpretation, spacecraft); + «typeIndexer.referInstanceOf("Spacecraft".type, Modality.MUST, "spacecraft")» + neg find hint_spacecraftNotUhfOnly(problem, interpretation, spacecraft); + find currentInRelation_pattern_hu_bme_mit_inf_dslreasoner_domains_satellite_queries_noLinkToGroundStation(problem, interpretation, spacecraft); + } + ''' + + override createConstraintUpdater(LinearTypeExpressionBuilderFactory it) { + val interferometryPayloadCount = createBuilder.add(1, "InterferometryPayload".type).build + val kaCommSubsystemWithoutSmallSatCount = createBuilder.add(1, "KaCommSubsystem".type).add(-2, "SmallSat".type). + build + val uhfCommSubsystemCount = createBuilder.add(1, "UHFCommSubsystem".type).build + + val interferometryPayloadMatcher = createMatcher(INTERFEROMETY_PAYLOAD) + val kaCommSubsystemRemainingContentsMatcher = createMatcher(REMAINING_CONTENTS_KA_COMM_SUBSYSTEM) + val uhfPossibleLinkMatcher = createMatcher(HINT_SPACECRAFT_UHF_POSSIBLE_LINK) + val uhfNoLinkMatcher = createMatcher(HINT_SPACECRAFT_UHF_ONLY_NO_LINK) + + return [ p | + interferometryPayloadCount.tightenLowerBound(2 - interferometryPayloadMatcher.countMatches(p)) + kaCommSubsystemWithoutSmallSatCount.tightenUpperBound(kaCommSubsystemRemainingContentsMatcher.getCount(p)) + if (uhfPossibleLinkMatcher.countMatches(p) == 0 && uhfNoLinkMatcher.countMatches(p) >= 1) { + uhfCommSubsystemCount.tightenLowerBound(1) + } + ] + } + +} diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/TypeDistributionCalculator.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/TypeDistributionCalculator.xtend new file mode 100644 index 00000000..e2d6e6ca --- /dev/null +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/TypeDistributionCalculator.xtend @@ -0,0 +1,35 @@ +package hu.bme.mit.inf.dslreasoner.run + +import hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph.yakindumm.YakindummPackage +import java.io.File +import org.eclipse.emf.common.util.URI +import org.eclipse.emf.ecore.EPackage +import org.eclipse.emf.ecore.EcorePackage +import org.eclipse.emf.ecore.resource.Resource +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl +import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl + +class TypeDistributionCalculator { + public static def void main(String[] args) { + Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("*", new XMIResourceFactoryImpl) + EPackage.Registry.INSTANCE.put(EcorePackage.eNS_URI, EcorePackage.eINSTANCE) + EPackage.Registry.INSTANCE.put(YakindummPackage.eNS_URI, YakindummPackage.eINSTANCE) + + println("model,className,count") + val directory = new File(args.get(0)) + for (file : directory.listFiles) { + val modelName = file.name + val resourceSet = new ResourceSetImpl + val resource = resourceSet.getResource(URI.createFileURI(file.absolutePath), true) + val objectsByTypeName = resource.allContents.filter [ obj | + val featureName = obj.eContainingFeature?.name + // Filter out "derived containment" references in Ecore. + // See https://stackoverflow.com/a/46340165 + featureName != "eGenericType" && featureName != "eGenericSuperTypes" + ].groupBy[eClass.name] + for (pair : objectsByTypeName.entrySet) { + println('''«modelName»,«pair.key»,«pair.value.size»''') + } + } + } +} 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 new file mode 100644 index 00000000..5abff962 --- /dev/null +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/script/MeasurementScript.xtend @@ -0,0 +1,70 @@ +package hu.bme.mit.inf.dslreasoner.run.script + +import java.util.List +import org.eclipse.xtend.lib.annotations.Accessors + +@Accessors +class MeasurementScript { + String inputPath + String outputPath + int timeout + boolean saveModels + boolean saveTemporaryFiles + int warmupIterations + int iterations + Domain domain + Scope scope + List sizes + Solver solver + ScopePropagator scopePropagator + ScopeConstraints propagatedConstraints + PolyhedronSolver polyhedronSolver + ScopeHeuristic scopeHeuristic + + def toCsvHeader() { + '''«domain»,«scope»,«solver»,«scopePropagator ?: "NULL"»,«propagatedConstraints ?: "NULL"»,«polyhedronSolver ?: "NULL"»''' + } +} + +enum Domain { + fs, + ecore, + Yakindu, + FAM, + satellite +} + +enum Scope { + none, + quantiles +} + +enum Solver { + ViatraSolver, + AlloySolver +} + +enum ScopePropagator { + none, + basic, + polyhedral +} + +enum ScopeConstraints { + none, + typeHierarchy, + relations, + hints +} + +enum PolyhedronSolver { + Z3Integer, + Z3Real, + Cbc, + Clp +} + +enum ScopeHeuristic { + basic, + polyhedral +} 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 new file mode 100644 index 00000000..48e750cb --- /dev/null +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/script/MeasurementScriptRunner.xtend @@ -0,0 +1,351 @@ +package hu.bme.mit.inf.dslreasoner.run.script + +import com.google.gson.Gson +import hu.bme.mit.inf.dslreasoner.ecore2logic.EClassMapper +import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic +import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2LogicConfiguration +import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic_Trace +import hu.bme.mit.inf.dslreasoner.logic.model.builder.DocumentationLevel +import hu.bme.mit.inf.dslreasoner.logic.model.builder.TypeScopes +import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.DefinedElement +import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.IntLiteral +import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RealLiteral +import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.StringLiteral +import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Type +import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.TypeDefinition +import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem +import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.IntStatisticEntry +import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.LogicresultFactory +import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.ModelResult +import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.RealStatisticEntry +import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.Statistics +import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.StringStatisticEntry +import hu.bme.mit.inf.dslreasoner.logic2ecore.Logic2Ecore +import hu.bme.mit.inf.dslreasoner.run.EcoreLoader +import hu.bme.mit.inf.dslreasoner.run.FAMLoader +import hu.bme.mit.inf.dslreasoner.run.FileSystemLoader +import hu.bme.mit.inf.dslreasoner.run.MetamodelLoader +import hu.bme.mit.inf.dslreasoner.run.SatelliteLoader +import hu.bme.mit.inf.dslreasoner.run.YakinduLoader +import hu.bme.mit.inf.dslreasoner.util.CollectionsUtil +import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2Logic +import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2LogicConfiguration +import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.PolyhedralScopePropagatorConstraints +import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.PolyhedralScopePropagatorSolver +import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.ScopePropagatorStrategy +import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.InstanceModel2Logic +import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.PartialModelRelation2Assertion +import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner +import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration +import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace +import hu.bme.mit.inf.dslreasoner.workspace.ReasonerWorkspace +import java.io.FileReader +import java.util.HashMap +import java.util.HashSet +import java.util.Map +import java.util.Set +import org.eclipse.emf.ecore.EObject +import org.eclipse.emf.ecore.resource.Resource +import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl +import org.eclipse.viatra.query.patternlanguage.emf.EMFPatternLanguageStandaloneSetup +import org.eclipse.viatra.query.runtime.api.ViatraQueryEngineOptions +import org.eclipse.viatra.query.runtime.rete.matcher.ReteBackendFactory +import org.eclipse.xtend.lib.annotations.Data + +class MeasurementScriptRunner { + static val MODEL_SIZE_GAP = 0 + static val SCOPE_PROPAGATOR_TIMEOUT = 10 + static val USEC_TO_MSEC = 1000000 + + static extension val LogicresultFactory = LogicresultFactory.eINSTANCE + + val MeasurementScript script + val ReasonerWorkspace inputWorkspace + val ReasonerWorkspace outputWorkspace + val MetamodelLoader metamodelLoader + + new(MeasurementScript script) { + this.script = script + inputWorkspace = new FileSystemWorkspace(script.inputPath + "/", "") + outputWorkspace = new FileSystemWorkspace(script.outputPath + + "/", '''«script.domain»_«script.solver»_«script.scope»_«script.scopePropagator ?: "na"»_«script.propagatedConstraints ?: "na"»_«script.polyhedronSolver ?: "na"»_''') + metamodelLoader = switch (script.domain) { + case fs: new FileSystemLoader(inputWorkspace) + case ecore: new EcoreLoader(inputWorkspace) + case Yakindu: new YakinduLoader(inputWorkspace) => [useSynchronization = false; useComplexStates = true] + case FAM: new FAMLoader(inputWorkspace) + case satellite: new SatelliteLoader(inputWorkspace) + default: throw new IllegalArgumentException("Unsupported domain: " + script.domain) + } + } + + def run() { + if (script.sizes.empty) { + return + } + val start = System.currentTimeMillis + val warmupSize = script.sizes.head + for (var int i = 0; i < script.warmupIterations; i++) { + System.err.println('''Warmup «i + 1»/«script.warmupIterations»...''') + runExperiment(warmupSize) + } + val warmupEnd = System.currentTimeMillis + System.err.println('''Warmup completed in «(warmupEnd - start) / 1000» seconds''') + for (size : script.sizes) { + var int failures = 0 + for (var int i = 0; i < script.iterations; i++) { + System.err.println("Running GC...") + runGc() + System.err.println('''Iteration «i + 1»/«script.iterations» of size «size»...''') + val startTime = System.currentTimeMillis + val result = runExperiment(size) + val headerPrefix = '''«script.toCsvHeader»,«size»,«i + 1»,«result.resultName»''' + println('''«headerPrefix»,startTime,«startTime»''') + println('''«headerPrefix»,logic2SolverTransformationTime,«result.statistics.transformationTime»''') + println('''«headerPrefix»,solverTime,«result.statistics.solverTime»''') + for (statistic : result.statistics.entries) { + val valueString = switch (statistic) { + IntStatisticEntry: statistic.value.toString + RealStatisticEntry: statistic.value.toString + StringStatisticEntry: statistic.value.toString + default: statistic.toString + } + println('''«headerPrefix»,«statistic.name»,«valueString»''') + } + if (script.saveModels && result.model !== null) { + outputWorkspace.writeModel(result.model, '''«size»_«i + 1».xmi''') + } + if (result.resultName === "InsuficientResourcesResultImpl") { + failures++ + } + System.out.flush + } + if (failures == script.iterations) { + System.err.println("All measurements failed") + return + } + } + val end = System.currentTimeMillis + System.err.println('''Measurement completed in «(end - start) / 1000» seconds''') + } + + private static def void runGc() { + System.gc + Thread.sleep(100) + System.gc + Thread.sleep(100) + System.gc + Thread.sleep(800) + } + + private def runExperiment(int modelSize) { + if (script.solver != Solver.ViatraSolver) { + throw new IllegalArgumentException("Only VIATRA-Generator is supported") + } + val config = new ViatraReasonerConfiguration + config.solutionScope.numberOfRequiredSolutions = 1 + config.scopePropagatorStrategy = switch (script.scopePropagator) { + case none: + ScopePropagatorStrategy.None + case basic: + switch (script.propagatedConstraints) { + case none: + ScopePropagatorStrategy.Basic + case typeHierarchy: + ScopePropagatorStrategy.BasicTypeHierarchy + case relations, + case hints: + throw new IllegalArgumentException( + "Basic scope propagator does not support relational and hint constraints") + default: + throw new IllegalArgumentException("Unknown scope constraints: " + script.propagatedConstraints) + } + case polyhedral: { + val constraints = switch (script.propagatedConstraints) { + case none: + throw new IllegalArgumentException( + "Polyhedral scope propagator needs at least type hierarchy constraints") + case typeHierarchy: + PolyhedralScopePropagatorConstraints.TypeHierarchy + case relations, + case hints: + PolyhedralScopePropagatorConstraints.Relational + default: + throw new IllegalArgumentException("Unknown scope constraints: " + script.propagatedConstraints) + } + val polyhedronSolver = switch (script.polyhedronSolver) { + case Z3Integer: PolyhedralScopePropagatorSolver.Z3Integer + case Z3Real: PolyhedralScopePropagatorSolver.Z3Real + case Cbc: PolyhedralScopePropagatorSolver.Cbc + case Clp: PolyhedralScopePropagatorSolver.Clp + default: throw new IllegalArgumentException("Unknown polyhedron solver: " + script.polyhedronSolver) + } + val updateHeuristic = script.scopeHeuristic != ScopeHeuristic.basic + new ScopePropagatorStrategy.Polyhedral(constraints, polyhedronSolver, updateHeuristic, + SCOPE_PROPAGATOR_TIMEOUT) + } + default: + throw new IllegalArgumentException("Unknown scope propagator: " + script.scopePropagator) + } + config.runtimeLimit = script.timeout + config.documentationLevel = if(script.saveTemporaryFiles) DocumentationLevel.NORMAL else DocumentationLevel.NONE + config.debugConfiguration.partialInterpretatioVisualiser = null + config.searchSpaceConstraints.additionalGlobalConstraints += metamodelLoader.additionalConstraints + + val modelLoadingStart = System.nanoTime + val metamodelDescriptor = metamodelLoader.loadMetamodel + val partialModelDescriptor = metamodelLoader.loadPartialModel + val queryDescriptor = metamodelLoader.loadQueries(metamodelDescriptor) + val modelLoadingTime = System.nanoTime - modelLoadingStart + + val domain2LogicTransformationStart = System.nanoTime + val Ecore2Logic ecore2Logic = new Ecore2Logic + val Viatra2Logic viatra2Logic = new Viatra2Logic(ecore2Logic) + val InstanceModel2Logic instanceModel2Logic = new InstanceModel2Logic + var modelGeneration = ecore2Logic.transformMetamodel(metamodelDescriptor, new Ecore2LogicConfiguration()) + var problem = modelGeneration.output + problem = instanceModel2Logic.transform( + modelGeneration, + partialModelDescriptor + ).output + problem = viatra2Logic.transformQueries( + queryDescriptor, + modelGeneration, + new Viatra2LogicConfiguration + ).output + initializeScope(config, modelSize, problem, ecore2Logic, modelGeneration.trace) + if (script.propagatedConstraints == ScopeConstraints.hints) { + config.hints = metamodelLoader.getHints(ecore2Logic, modelGeneration.trace) + } + val domain2LogicTransformationTime = System.nanoTime - domain2LogicTransformationStart + + if (config.documentationLevel != DocumentationLevel.NONE) { + outputWorkspace.writeModel(problem, "initial.logicproblem") + } + + val solver = new ViatraReasoner + val result = solver.solve(problem, config, outputWorkspace) + val statistics = result.statistics + statistics.entries += createIntStatisticEntry => [ + name = "modelLoadingTime" + value = (modelLoadingTime / USEC_TO_MSEC) as int + ] + statistics.entries += createIntStatisticEntry => [ + name = "domain2LogicTransformationTime" + value = (domain2LogicTransformationTime / USEC_TO_MSEC) as int + ] + var EObject modelResult = null + if (result instanceof ModelResult) { + val intepretations = solver.getInterpretations(result) + if (intepretations.size != 1) { + throw new IllegalStateException("Expected 1 interpretation, got " + intepretations.size) + } + var resultTransformationStart = System.nanoTime + val logic2Ecore = new Logic2Ecore(ecore2Logic) + modelResult = logic2Ecore.transformInterpretation(intepretations.head, modelGeneration.trace) + val resultTransformationTime = System.nanoTime - resultTransformationStart + statistics.entries += createIntStatisticEntry => [ + name = "ecore2LogicTransformationTime" + value = (resultTransformationTime / USEC_TO_MSEC) as int + ] + } + + new ExperimentResult(result.class.simpleName, statistics, modelResult) + } + + private def initializeScope(ViatraReasonerConfiguration config, int modelSize, LogicProblem problem, + EClassMapper eClassMapper, Ecore2Logic_Trace trace) { + val knownElements = initializeKnownElements(problem, config.typeScopes) + if (modelSize < 0) { + config.typeScopes.minNewElements = 0 + config.typeScopes.maxNewElements = TypeScopes.Unlimited + } else { + val numberOfKnownElements = knownElements.values.flatten.toSet.size + val newElementCount = modelSize - numberOfKnownElements + config.typeScopes.minNewElements = newElementCount + config.typeScopes.maxNewElements = newElementCount + MODEL_SIZE_GAP + } + switch (script.scope) { + case none: + return + case quantiles: { + val quantiles = metamodelLoader.typeQuantiles + for (eClassInScope : eClassMapper.allClassesInScope(trace)) { + val quantile = quantiles.get(eClassInScope.name) + if (quantile !== null) { + val type = eClassMapper.TypeofEClass(trace, eClassInScope) + val knownInstances = knownElements.get(type) + val currentCount = if(knownInstances === null) 0 else knownInstances.size + val lowCount = Math.floor(modelSize * quantile.low) as int + val highCount = Math.ceil((modelSize + MODEL_SIZE_GAP) * quantile.high) as int + config.typeScopes.minNewElementsByType.put(type, lowCount - currentCount) + config.typeScopes.maxNewElementsByType.put(type, highCount - currentCount) + } + } + } + default: + throw new IllegalArgumentException("Unknown scope: " + script.scope) + } + } + + /* + * Copied from hu.bme.mit.inf.dslreasoner.application.execution.ScopeLoader.initialiseknownElements(LogicProblem, TypeScopes) + */ + private static def initializeKnownElements(LogicProblem p, TypeScopes s) { + val Map> res = new HashMap + + // 1. fill map with every types + for (t : p.types) { + res.put(t, new HashSet) + } + + // 2. fill map with every objects + for (definedType : p.types.filter(TypeDefinition)) { + val supertypes = CollectionsUtil.transitiveClosureStar(definedType)[supertypes] + for (supertype : supertypes) { + for (element : definedType.elements) { + res.get(supertype).add(element) + } + } + } + val partialModelContents = p.annotations.filter(PartialModelRelation2Assertion).map[target].toList.map [ + eAllContents.toIterable + ].flatten.toList + s.knownIntegers += partialModelContents.filter(IntLiteral).map[it.value] + s.knownReals += partialModelContents.filter(RealLiteral).map[it.value] + s.knownStrings += partialModelContents.filter(StringLiteral).map[it.value] + + res + } + + public static def void main(String[] args) { + if (args.length != 1) { + System.err.println("Missing measurement script name.") + System.exit(-1) + } + EMFPatternLanguageStandaloneSetup.doSetup + ViatraQueryEngineOptions.setSystemDefaultBackends(ReteBackendFactory.INSTANCE, ReteBackendFactory.INSTANCE, + ReteBackendFactory.INSTANCE) + Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("*", new XMIResourceFactoryImpl) + val config = readConfig(args.get(0)) + val runnner = new MeasurementScriptRunner(config) + runnner.run() + } + + static def readConfig(String scriptPath) { + val gson = new Gson + val reader = new FileReader(scriptPath) + try { + gson.fromJson(reader, MeasurementScript) + } finally { + reader.close + } + } + + @Data + private static class ExperimentResult { + String resultName + Statistics statistics + EObject model + } +} -- cgit v1.2.3-54-g00ecf From 110268c8e8937df8d67075caebd6d31460d0f81a Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Thu, 15 Aug 2019 15:36:05 +0200 Subject: Measurements WIP --- .../META-INF/MANIFEST.MF | 5 +- .../model/FileSytem.ecore | 2 +- .../model/FileSytem.genmodel | 8 +- .../domains/alloyexamples/FileSystem.vql | 12 +- .../plugin.xml | 2 + .../dslreasoner/domains/alloyexamples/.gitignore | 2 + .../inf/dslreasoner/domains/alloyexamples/Dir.java | 533 ++++++++++++++++++++ .../dslreasoner/domains/alloyexamples/Live.java | 4 +- .../domains/alloyexamples/PatternContent.java | 69 +-- .../domains/alloyexamples/RootIsNotDir.java | 560 +++++++++++++++++++++ .../alloyexamples/Filesystem/FileSystem.java | 6 +- .../alloyexamples/Filesystem/impl/DirImpl.java | 1 + .../Filesystem/impl/FSObjectImpl.java | 2 + .../Filesystem/impl/FileSystemImpl.java | 18 +- .../Filesystem/impl/FilesystemFactoryImpl.java | 5 + .../Filesystem/impl/FilesystemPackageImpl.java | 36 +- .../alloyexamples/Filesystem/impl/ModelImpl.java | 3 + ..._ViatraSolver_polyhedral_typeHierarchy_Clp.json | 7 +- .../mit/inf/dslreasoner/run/FileSystemHint.xtend | 32 ++ .../run/FileSystemInconsistencyDetector.xtend | 6 +- .../mit/inf/dslreasoner/run/MetamodelLoader.xtend | 15 +- .../mit/inf/dslreasoner/run/SatelliteHint.xtend | 37 -- .../dslreasoner/run/script/MeasurementScript.xtend | 2 +- .../run/script/MeasurementScriptRunner.xtend | 2 +- 24 files changed, 1254 insertions(+), 115 deletions(-) create mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Dir.java create mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/RootIsNotDir.java create mode 100644 Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/FileSystemHint.xtend (limited to 'Tests/hu.bme.mit.inf.dslreasoner.run') diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/META-INF/MANIFEST.MF b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/META-INF/MANIFEST.MF index 1adef165..d5f7db65 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/META-INF/MANIFEST.MF +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/META-INF/MANIFEST.MF @@ -19,6 +19,7 @@ Require-Bundle: org.eclipse.viatra.addon.querybasedfeatures.runtime, org.eclipse.xtext.xbase.lib, org.eclipse.xtend.lib, org.eclipse.xtend.lib.macro -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 -Bundle-ActivationPolicy: lazy Import-Package: org.apache.log4j +Automatic-Module-Name: hu.bme.mit.inf.dslreasoner.domains.alloyexamples +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/model/FileSytem.ecore b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/model/FileSytem.ecore index 87ba7135..32874953 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/model/FileSytem.ecore +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/model/FileSytem.ecore @@ -5,7 +5,7 @@
    - diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/model/FileSytem.genmodel b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/model/FileSytem.genmodel index 355ac109..daa44727 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/model/FileSytem.genmodel +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/model/FileSytem.genmodel @@ -11,13 +11,13 @@ - + + + - - - + diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/patterns/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/FileSystem.vql b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/patterns/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/FileSystem.vql index 719a9d96..c785c2fc 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/patterns/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/FileSystem.vql +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/patterns/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/FileSystem.vql @@ -2,7 +2,7 @@ package hu.bme.mit.inf.dslreasoner.domains.alloyexamples import epackage "FS" -pattern patternContent(o1: FSObject, o2: FSObject) { +pattern patternContent(o1: Dir, o2: FSObject) { Dir.contents(o1,o2); } @@ -22,3 +22,13 @@ pattern contentInNotLive(parent : Dir, child: FSObject) { Dir.contents(parent,child); neg find live(_,child); } + +pattern dir(d: Dir) { + Dir(d); +} + +@Constraint(key={fs}, severity="error", message="error") +pattern rootIsNotDir(fs: FileSystem) { + FileSystem.root(fs, root); + neg find dir(root); +} 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 d7fd112a..6eae8535 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/plugin.xml +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/plugin.xml @@ -21,6 +21,8 @@ + + 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 1e7d444f..fa9b1325 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 @@ -50,3 +50,5 @@ /Opposite.java /OppositeDifferentClass.java /PatternContent.java +/.Dir.java._trace +/.RootIsNotDir.java._trace diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Dir.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Dir.java new file mode 100644 index 00000000..ad04c098 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Dir.java @@ -0,0 +1,533 @@ +/** + * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/patterns/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/FileSystem.vql + */ +package hu.bme.mit.inf.dslreasoner.domains.alloyexamples; + +import java.util.Arrays; +import java.util.Collection; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.function.Consumer; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import org.apache.log4j.Logger; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.viatra.query.runtime.api.IPatternMatch; +import org.eclipse.viatra.query.runtime.api.IQuerySpecification; +import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; +import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; +import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; +import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; +import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; +import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; +import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; +import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; +import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; +import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; +import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; +import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; +import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; +import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; +import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; +import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; +import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; + +/** + * A pattern-specific query specification that can instantiate Matcher in a type-safe way. + * + *

    Original source: + *

    + *         pattern dir(d: Dir) {
    + *         	Dir(d);
    + *         }
    + * 
    + * + * @see Matcher + * @see Match + * + */ +@SuppressWarnings("all") +public final class Dir extends BaseGeneratedEMFQuerySpecification { + /** + * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.alloyexamples.dir pattern, + * to be used in conjunction with {@link Matcher}. + * + *

    Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. + * Each instance is a (possibly partial) substitution of pattern parameters, + * usable to represent a match of the pattern in the result of a query, + * or to specify the bound (fixed) input parameters when issuing a query. + * + * @see Matcher + * + */ + public static abstract class Match extends BasePatternMatch { + private hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir fD; + + private static List parameterNames = makeImmutableList("d"); + + private Match(final hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir pD) { + this.fD = pD; + } + + @Override + public Object get(final String parameterName) { + if ("d".equals(parameterName)) return this.fD; + return null; + } + + public hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir getD() { + return this.fD; + } + + @Override + public boolean set(final String parameterName, final Object newValue) { + if (!isMutable()) throw new java.lang.UnsupportedOperationException(); + if ("d".equals(parameterName) ) { + this.fD = (hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir) newValue; + return true; + } + return false; + } + + public void setD(final hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir pD) { + if (!isMutable()) throw new java.lang.UnsupportedOperationException(); + this.fD = pD; + } + + @Override + public String patternName() { + return "hu.bme.mit.inf.dslreasoner.domains.alloyexamples.dir"; + } + + @Override + public List parameterNames() { + return Dir.Match.parameterNames; + } + + @Override + public Object[] toArray() { + return new Object[]{fD}; + } + + @Override + public Dir.Match toImmutable() { + return isMutable() ? newMatch(fD) : this; + } + + @Override + public String prettyPrint() { + StringBuilder result = new StringBuilder(); + result.append("\"d\"=" + prettyPrintValue(fD)); + return result.toString(); + } + + @Override + public int hashCode() { + return Objects.hash(fD); + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) + return true; + if (obj == null) { + return false; + } + if ((obj instanceof Dir.Match)) { + Dir.Match other = (Dir.Match) obj; + return Objects.equals(fD, other.fD); + } else { + // this should be infrequent + if (!(obj instanceof IPatternMatch)) { + return false; + } + IPatternMatch otherSig = (IPatternMatch) obj; + return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); + } + } + + @Override + public Dir specification() { + return Dir.instance(); + } + + /** + * Returns an empty, mutable match. + * Fields of the mutable match can be filled to create a partial match, usable as matcher input. + * + * @return the empty match. + * + */ + public static Dir.Match newEmptyMatch() { + return new Mutable(null); + } + + /** + * Returns a mutable (partial) match. + * Fields of the mutable match can be filled to create a partial match, usable as matcher input. + * + * @param pD the fixed value of pattern parameter d, or null if not bound. + * @return the new, mutable (partial) match object. + * + */ + public static Dir.Match newMutableMatch(final hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir pD) { + return new Mutable(pD); + } + + /** + * Returns a new (partial) match. + * This can be used e.g. to call the matcher with a partial match. + *

    The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. + * @param pD the fixed value of pattern parameter d, or null if not bound. + * @return the (partial) match object. + * + */ + public static Dir.Match newMatch(final hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir pD) { + return new Immutable(pD); + } + + private static final class Mutable extends Dir.Match { + Mutable(final hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir pD) { + super(pD); + } + + @Override + public boolean isMutable() { + return true; + } + } + + private static final class Immutable extends Dir.Match { + Immutable(final hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir pD) { + super(pD); + } + + @Override + public boolean isMutable() { + return false; + } + } + } + + /** + * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.alloyexamples.dir pattern, + * providing pattern-specific query methods. + * + *

    Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, + * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. + * + *

    Matches of the pattern will be represented as {@link Match}. + * + *

    Original source: + *

    +   * pattern dir(d: Dir) {
    +   * 	Dir(d);
    +   * }
    +   * 
    + * + * @see Match + * @see Dir + * + */ + public static class Matcher extends BaseMatcher { + /** + * Initializes the pattern matcher within an existing VIATRA Query engine. + * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. + * + * @param engine the existing VIATRA Query engine in which this matcher will be created. + * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation + * + */ + public static Dir.Matcher on(final ViatraQueryEngine engine) { + // check if matcher already exists + Matcher matcher = engine.getExistingMatcher(querySpecification()); + if (matcher == null) { + matcher = (Matcher)engine.getMatcher(querySpecification()); + } + return matcher; + } + + /** + * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation + * @return an initialized matcher + * @noreference This method is for internal matcher initialization by the framework, do not call it manually. + * + */ + public static Dir.Matcher create() { + return new Matcher(); + } + + private static final int POSITION_D = 0; + + private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(Dir.Matcher.class); + + /** + * Initializes the pattern matcher within an existing VIATRA Query engine. + * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. + * + * @param engine the existing VIATRA Query engine in which this matcher will be created. + * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation + * + */ + private Matcher() { + super(querySpecification()); + } + + /** + * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. + * @param pD the fixed value of pattern parameter d, or null if not bound. + * @return matches represented as a Match object. + * + */ + public Collection getAllMatches(final hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir pD) { + return rawStreamAllMatches(new Object[]{pD}).collect(Collectors.toSet()); + } + + /** + * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. + *

    + * NOTE: It is important not to modify the source model while the stream is being processed. + * If the match set of the pattern changes during processing, the contents of the stream is undefined. + * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. + * @param pD the fixed value of pattern parameter d, or null if not bound. + * @return a stream of matches represented as a Match object. + * + */ + public Stream streamAllMatches(final hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir pD) { + return rawStreamAllMatches(new Object[]{pD}); + } + + /** + * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. + * Neither determinism nor randomness of selection is guaranteed. + * @param pD the fixed value of pattern parameter d, or null if not bound. + * @return a match represented as a Match object, or null if no match is found. + * + */ + public Optional getOneArbitraryMatch(final hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir pD) { + return rawGetOneArbitraryMatch(new Object[]{pD}); + } + + /** + * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, + * under any possible substitution of the unspecified parameters (if any). + * @param pD the fixed value of pattern parameter d, or null if not bound. + * @return true if the input is a valid (partial) match of the pattern. + * + */ + public boolean hasMatch(final hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir pD) { + return rawHasMatch(new Object[]{pD}); + } + + /** + * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. + * @param pD the fixed value of pattern parameter d, or null if not bound. + * @return the number of pattern matches found. + * + */ + public int countMatches(final hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir pD) { + return rawCountMatches(new Object[]{pD}); + } + + /** + * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. + * Neither determinism nor randomness of selection is guaranteed. + * @param pD the fixed value of pattern parameter d, or null if not bound. + * @param processor the action that will process the selected match. + * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked + * + */ + public boolean forOneArbitraryMatch(final hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir pD, final Consumer processor) { + return rawForOneArbitraryMatch(new Object[]{pD}, processor); + } + + /** + * Returns a new (partial) match. + * This can be used e.g. to call the matcher with a partial match. + *

    The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. + * @param pD the fixed value of pattern parameter d, or null if not bound. + * @return the (partial) match object. + * + */ + public Dir.Match newMatch(final hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir pD) { + return Dir.Match.newMatch(pD); + } + + /** + * Retrieve the set of values that occur in matches for d. + * @return the Set of all values or empty set if there are no matches + * + */ + protected Stream rawStreamAllValuesOfd(final Object[] parameters) { + return rawStreamAllValues(POSITION_D, parameters).map(hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir.class::cast); + } + + /** + * Retrieve the set of values that occur in matches for d. + * @return the Set of all values or empty set if there are no matches + * + */ + public Set getAllValuesOfd() { + return rawStreamAllValuesOfd(emptyArray()).collect(Collectors.toSet()); + } + + /** + * Retrieve the set of values that occur in matches for d. + * @return the Set of all values or empty set if there are no matches + * + */ + public Stream streamAllValuesOfd() { + return rawStreamAllValuesOfd(emptyArray()); + } + + @Override + protected Dir.Match tupleToMatch(final Tuple t) { + try { + return Dir.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir) t.get(POSITION_D)); + } catch(ClassCastException e) { + LOGGER.error("Element(s) in tuple not properly typed!",e); + return null; + } + } + + @Override + protected Dir.Match arrayToMatch(final Object[] match) { + try { + return Dir.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir) match[POSITION_D]); + } catch(ClassCastException e) { + LOGGER.error("Element(s) in array not properly typed!",e); + return null; + } + } + + @Override + protected Dir.Match arrayToMatchMutable(final Object[] match) { + try { + return Dir.Match.newMutableMatch((hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir) match[POSITION_D]); + } catch(ClassCastException e) { + LOGGER.error("Element(s) in array not properly typed!",e); + return null; + } + } + + /** + * @return the singleton instance of the query specification of this pattern + * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded + * + */ + public static IQuerySpecification querySpecification() { + return Dir.instance(); + } + } + + private Dir() { + super(GeneratedPQuery.INSTANCE); + } + + /** + * @return the singleton instance of the query specification + * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded + * + */ + public static Dir instance() { + try{ + return LazyHolder.INSTANCE; + } catch (ExceptionInInitializerError err) { + throw processInitializerError(err); + } + } + + @Override + protected Dir.Matcher instantiate(final ViatraQueryEngine engine) { + return Dir.Matcher.on(engine); + } + + @Override + public Dir.Matcher instantiate() { + return Dir.Matcher.create(); + } + + @Override + public Dir.Match newEmptyMatch() { + return Dir.Match.newEmptyMatch(); + } + + @Override + public Dir.Match newMatch(final Object... parameters) { + return Dir.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir) parameters[0]); + } + + /** + * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Dir (visibility: PUBLIC, simpleName: Dir, identifier: hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Dir, deprecated: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.alloyexamples) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created + * not at the class load time of the outer class, + * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Dir (visibility: PUBLIC, simpleName: Dir, identifier: hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Dir, deprecated: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.alloyexamples) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. + * + *

    This workaround is required e.g. to support recursion. + * + */ + private static class LazyHolder { + private static final Dir INSTANCE = new Dir(); + + /** + * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. + * This initialization order is required to support indirect recursion. + * + *

    The static initializer is defined using a helper field to work around limitations of the code generator. + * + */ + private static final Object STATIC_INITIALIZER = ensureInitialized(); + + public static Object ensureInitialized() { + INSTANCE.ensureInitializedInternal(); + return null; + } + } + + private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { + private static final Dir.GeneratedPQuery INSTANCE = new GeneratedPQuery(); + + private final PParameter parameter_d = new PParameter("d", "hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("FS", "Dir")), PParameterDirection.INOUT); + + private final List parameters = Arrays.asList(parameter_d); + + private GeneratedPQuery() { + super(PVisibility.PUBLIC); + } + + @Override + public String getFullyQualifiedName() { + return "hu.bme.mit.inf.dslreasoner.domains.alloyexamples.dir"; + } + + @Override + public List getParameterNames() { + return Arrays.asList("d"); + } + + @Override + public List getParameters() { + return parameters; + } + + @Override + public Set doGetContainedBodies() { + setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); + Set bodies = new LinkedHashSet<>(); + { + PBody body = new PBody(this); + PVariable var_d = body.getOrCreateVariableByName("d"); + new TypeConstraint(body, Tuples.flatTupleOf(var_d), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("FS", "Dir"))); + body.setSymbolicParameters(Arrays.asList( + new ExportedParameter(body, var_d, parameter_d) + )); + // Dir(d) + new TypeConstraint(body, Tuples.flatTupleOf(var_d), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("FS", "Dir"))); + bodies.add(body); + } + return bodies; + } + } +} diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Live.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Live.java index ae0f0c58..14a4c5c0 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Live.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Live.java @@ -695,7 +695,7 @@ public final class Live extends BaseGeneratedEMFQuerySpecification new TypeConstraint(body, Tuples.flatTupleOf(var_this), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("FS", "FileSystem"))); PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); new TypeConstraint(body, Tuples.flatTupleOf(var_this, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("FS", "FileSystem", "root"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("FS", "Dir"))); + new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("FS", "FSObject"))); new Equality(body, var__virtual_0_, var_l); bodies.add(body); } @@ -714,7 +714,7 @@ public final class Live extends BaseGeneratedEMFQuerySpecification new TypeConstraint(body, Tuples.flatTupleOf(var_this), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("FS", "FileSystem"))); PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); new TypeConstraint(body, Tuples.flatTupleOf(var_this, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("FS", "FileSystem", "root"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("FS", "Dir"))); + new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("FS", "FSObject"))); new Equality(body, var__virtual_0_, var_root); // find patternContent+(root,l) new BinaryTransitiveClosure(body, Tuples.flatTupleOf(var_root, var_l), PatternContent.instance().getInternalQueryRepresentation()); diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/PatternContent.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/PatternContent.java index 690d3e27..5410b693 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/PatternContent.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/PatternContent.java @@ -3,6 +3,7 @@ */ package hu.bme.mit.inf.dslreasoner.domains.alloyexamples; +import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir; import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FSObject; import java.util.Arrays; import java.util.Collection; @@ -43,7 +44,7 @@ import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; * *

    Original source: *

    - *         pattern patternContent(o1: FSObject, o2: FSObject) {
    + *         pattern patternContent(o1: Dir, o2: FSObject) {
      *         	Dir.contents(o1,o2);
      *         }
      * 
    @@ -67,13 +68,13 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification parameterNames = makeImmutableList("o1", "o2"); - private Match(final FSObject pO1, final FSObject pO2) { + private Match(final Dir pO1, final FSObject pO2) { this.fO1 = pO1; this.fO2 = pO2; } @@ -85,7 +86,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecificationOriginal source: *
    -   * pattern patternContent(o1: FSObject, o2: FSObject) {
    +   * pattern patternContent(o1: Dir, o2: FSObject) {
        * 	Dir.contents(o1,o2);
        * }
        * 
    @@ -308,7 +309,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification getAllMatches(final FSObject pO1, final FSObject pO2) { + public Collection getAllMatches(final Dir pO1, final FSObject pO2) { return rawStreamAllMatches(new Object[]{pO1, pO2}).collect(Collectors.toSet()); } @@ -323,7 +324,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification streamAllMatches(final FSObject pO1, final FSObject pO2) { + public Stream streamAllMatches(final Dir pO1, final FSObject pO2) { return rawStreamAllMatches(new Object[]{pO1, pO2}); } @@ -335,7 +336,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification getOneArbitraryMatch(final FSObject pO1, final FSObject pO2) { + public Optional getOneArbitraryMatch(final Dir pO1, final FSObject pO2) { return rawGetOneArbitraryMatch(new Object[]{pO1, pO2}); } @@ -347,7 +348,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification processor) { + public boolean forOneArbitraryMatch(final Dir pO1, final FSObject pO2, final Consumer processor) { return rawForOneArbitraryMatch(new Object[]{pO1, pO2}, processor); } @@ -384,7 +385,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification rawStreamAllValuesOfo1(final Object[] parameters) { - return rawStreamAllValues(POSITION_O1, parameters).map(FSObject.class::cast); + protected Stream rawStreamAllValuesOfo1(final Object[] parameters) { + return rawStreamAllValues(POSITION_O1, parameters).map(Dir.class::cast); } /** @@ -402,7 +403,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification getAllValuesOfo1() { + public Set getAllValuesOfo1() { return rawStreamAllValuesOfo1(emptyArray()).collect(Collectors.toSet()); } @@ -411,7 +412,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification streamAllValuesOfo1() { + public Stream streamAllValuesOfo1() { return rawStreamAllValuesOfo1(emptyArray()); } @@ -425,7 +426,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification streamAllValuesOfo1(final PatternContent.Match partialMatch) { + public Stream streamAllValuesOfo1(final PatternContent.Match partialMatch) { return rawStreamAllValuesOfo1(partialMatch.toArray()); } @@ -439,7 +440,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification streamAllValuesOfo1(final FSObject pO2) { + public Stream streamAllValuesOfo1(final FSObject pO2) { return rawStreamAllValuesOfo1(new Object[]{null, pO2}); } @@ -448,7 +449,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification getAllValuesOfo1(final PatternContent.Match partialMatch) { + public Set getAllValuesOfo1(final PatternContent.Match partialMatch) { return rawStreamAllValuesOfo1(partialMatch.toArray()).collect(Collectors.toSet()); } @@ -457,7 +458,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification getAllValuesOfo1(final FSObject pO2) { + public Set getAllValuesOfo1(final FSObject pO2) { return rawStreamAllValuesOfo1(new Object[]{null, pO2}).collect(Collectors.toSet()); } @@ -512,7 +513,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification streamAllValuesOfo2(final FSObject pO1) { + public Stream streamAllValuesOfo2(final Dir pO1) { return rawStreamAllValuesOfo2(new Object[]{pO1, null}); } @@ -530,14 +531,14 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecification getAllValuesOfo2(final FSObject pO1) { + public Set getAllValuesOfo2(final Dir pO1) { return rawStreamAllValuesOfo2(new Object[]{pO1, null}).collect(Collectors.toSet()); } @Override protected PatternContent.Match tupleToMatch(final Tuple t) { try { - return PatternContent.Match.newMatch((FSObject) t.get(POSITION_O1), (FSObject) t.get(POSITION_O2)); + return PatternContent.Match.newMatch((Dir) t.get(POSITION_O1), (FSObject) t.get(POSITION_O2)); } catch(ClassCastException e) { LOGGER.error("Element(s) in tuple not properly typed!",e); return null; @@ -547,7 +548,7 @@ public final class PatternContent extends BaseGeneratedEMFQuerySpecificationasList( new ExportedParameter(body, var_o1, parameter_o1), diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/RootIsNotDir.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/RootIsNotDir.java new file mode 100644 index 00000000..22c31158 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/RootIsNotDir.java @@ -0,0 +1,560 @@ +/** + * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/patterns/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/FileSystem.vql + */ +package hu.bme.mit.inf.dslreasoner.domains.alloyexamples; + +import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Dir; +import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FileSystem; +import java.util.Arrays; +import java.util.Collection; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.function.Consumer; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import org.apache.log4j.Logger; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.viatra.query.runtime.api.IPatternMatch; +import org.eclipse.viatra.query.runtime.api.IQuerySpecification; +import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; +import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; +import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; +import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; +import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; +import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; +import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; +import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; +import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; +import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; +import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; +import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference; +import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; +import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; +import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; +import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; +import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; +import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; +import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; +import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; +import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; +import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; + +/** + * A pattern-specific query specification that can instantiate Matcher in a type-safe way. + * + *

    Original source: + *

    + *         {@literal @}Constraint(key={fs}, severity="error", message="error")
    + *         pattern rootIsNotDir(fs: FileSystem) {
    + *         	FileSystem.root(fs, root);
    + *         	neg find dir(root);
    + *         }
    + * 
    + * + * @see Matcher + * @see Match + * + */ +@SuppressWarnings("all") +public final class RootIsNotDir extends BaseGeneratedEMFQuerySpecification { + /** + * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.alloyexamples.rootIsNotDir pattern, + * to be used in conjunction with {@link Matcher}. + * + *

    Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. + * Each instance is a (possibly partial) substitution of pattern parameters, + * usable to represent a match of the pattern in the result of a query, + * or to specify the bound (fixed) input parameters when issuing a query. + * + * @see Matcher + * + */ + public static abstract class Match extends BasePatternMatch { + private FileSystem fFs; + + private static List parameterNames = makeImmutableList("fs"); + + private Match(final FileSystem pFs) { + this.fFs = pFs; + } + + @Override + public Object get(final String parameterName) { + if ("fs".equals(parameterName)) return this.fFs; + return null; + } + + public FileSystem getFs() { + return this.fFs; + } + + @Override + public boolean set(final String parameterName, final Object newValue) { + if (!isMutable()) throw new java.lang.UnsupportedOperationException(); + if ("fs".equals(parameterName) ) { + this.fFs = (FileSystem) newValue; + return true; + } + return false; + } + + public void setFs(final FileSystem pFs) { + if (!isMutable()) throw new java.lang.UnsupportedOperationException(); + this.fFs = pFs; + } + + @Override + public String patternName() { + return "hu.bme.mit.inf.dslreasoner.domains.alloyexamples.rootIsNotDir"; + } + + @Override + public List parameterNames() { + return RootIsNotDir.Match.parameterNames; + } + + @Override + public Object[] toArray() { + return new Object[]{fFs}; + } + + @Override + public RootIsNotDir.Match toImmutable() { + return isMutable() ? newMatch(fFs) : this; + } + + @Override + public String prettyPrint() { + StringBuilder result = new StringBuilder(); + result.append("\"fs\"=" + prettyPrintValue(fFs)); + return result.toString(); + } + + @Override + public int hashCode() { + return Objects.hash(fFs); + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) + return true; + if (obj == null) { + return false; + } + if ((obj instanceof RootIsNotDir.Match)) { + RootIsNotDir.Match other = (RootIsNotDir.Match) obj; + return Objects.equals(fFs, other.fFs); + } else { + // this should be infrequent + if (!(obj instanceof IPatternMatch)) { + return false; + } + IPatternMatch otherSig = (IPatternMatch) obj; + return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); + } + } + + @Override + public RootIsNotDir specification() { + return RootIsNotDir.instance(); + } + + /** + * Returns an empty, mutable match. + * Fields of the mutable match can be filled to create a partial match, usable as matcher input. + * + * @return the empty match. + * + */ + public static RootIsNotDir.Match newEmptyMatch() { + return new Mutable(null); + } + + /** + * Returns a mutable (partial) match. + * Fields of the mutable match can be filled to create a partial match, usable as matcher input. + * + * @param pFs the fixed value of pattern parameter fs, or null if not bound. + * @return the new, mutable (partial) match object. + * + */ + public static RootIsNotDir.Match newMutableMatch(final FileSystem pFs) { + return new Mutable(pFs); + } + + /** + * Returns a new (partial) match. + * This can be used e.g. to call the matcher with a partial match. + *

    The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. + * @param pFs the fixed value of pattern parameter fs, or null if not bound. + * @return the (partial) match object. + * + */ + public static RootIsNotDir.Match newMatch(final FileSystem pFs) { + return new Immutable(pFs); + } + + private static final class Mutable extends RootIsNotDir.Match { + Mutable(final FileSystem pFs) { + super(pFs); + } + + @Override + public boolean isMutable() { + return true; + } + } + + private static final class Immutable extends RootIsNotDir.Match { + Immutable(final FileSystem pFs) { + super(pFs); + } + + @Override + public boolean isMutable() { + return false; + } + } + } + + /** + * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.alloyexamples.rootIsNotDir pattern, + * providing pattern-specific query methods. + * + *

    Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, + * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. + * + *

    Matches of the pattern will be represented as {@link Match}. + * + *

    Original source: + *

    +   * {@literal @}Constraint(key={fs}, severity="error", message="error")
    +   * pattern rootIsNotDir(fs: FileSystem) {
    +   * 	FileSystem.root(fs, root);
    +   * 	neg find dir(root);
    +   * }
    +   * 
    + * + * @see Match + * @see RootIsNotDir + * + */ + public static class Matcher extends BaseMatcher { + /** + * Initializes the pattern matcher within an existing VIATRA Query engine. + * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. + * + * @param engine the existing VIATRA Query engine in which this matcher will be created. + * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation + * + */ + public static RootIsNotDir.Matcher on(final ViatraQueryEngine engine) { + // check if matcher already exists + Matcher matcher = engine.getExistingMatcher(querySpecification()); + if (matcher == null) { + matcher = (Matcher)engine.getMatcher(querySpecification()); + } + return matcher; + } + + /** + * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation + * @return an initialized matcher + * @noreference This method is for internal matcher initialization by the framework, do not call it manually. + * + */ + public static RootIsNotDir.Matcher create() { + return new Matcher(); + } + + private static final int POSITION_FS = 0; + + private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(RootIsNotDir.Matcher.class); + + /** + * Initializes the pattern matcher within an existing VIATRA Query engine. + * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. + * + * @param engine the existing VIATRA Query engine in which this matcher will be created. + * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation + * + */ + private Matcher() { + super(querySpecification()); + } + + /** + * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. + * @param pFs the fixed value of pattern parameter fs, or null if not bound. + * @return matches represented as a Match object. + * + */ + public Collection getAllMatches(final FileSystem pFs) { + return rawStreamAllMatches(new Object[]{pFs}).collect(Collectors.toSet()); + } + + /** + * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. + *

    + * NOTE: It is important not to modify the source model while the stream is being processed. + * If the match set of the pattern changes during processing, the contents of the stream is undefined. + * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. + * @param pFs the fixed value of pattern parameter fs, or null if not bound. + * @return a stream of matches represented as a Match object. + * + */ + public Stream streamAllMatches(final FileSystem pFs) { + return rawStreamAllMatches(new Object[]{pFs}); + } + + /** + * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. + * Neither determinism nor randomness of selection is guaranteed. + * @param pFs the fixed value of pattern parameter fs, or null if not bound. + * @return a match represented as a Match object, or null if no match is found. + * + */ + public Optional getOneArbitraryMatch(final FileSystem pFs) { + return rawGetOneArbitraryMatch(new Object[]{pFs}); + } + + /** + * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, + * under any possible substitution of the unspecified parameters (if any). + * @param pFs the fixed value of pattern parameter fs, or null if not bound. + * @return true if the input is a valid (partial) match of the pattern. + * + */ + public boolean hasMatch(final FileSystem pFs) { + return rawHasMatch(new Object[]{pFs}); + } + + /** + * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. + * @param pFs the fixed value of pattern parameter fs, or null if not bound. + * @return the number of pattern matches found. + * + */ + public int countMatches(final FileSystem pFs) { + return rawCountMatches(new Object[]{pFs}); + } + + /** + * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. + * Neither determinism nor randomness of selection is guaranteed. + * @param pFs the fixed value of pattern parameter fs, or null if not bound. + * @param processor the action that will process the selected match. + * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked + * + */ + public boolean forOneArbitraryMatch(final FileSystem pFs, final Consumer processor) { + return rawForOneArbitraryMatch(new Object[]{pFs}, processor); + } + + /** + * Returns a new (partial) match. + * This can be used e.g. to call the matcher with a partial match. + *

    The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. + * @param pFs the fixed value of pattern parameter fs, or null if not bound. + * @return the (partial) match object. + * + */ + public RootIsNotDir.Match newMatch(final FileSystem pFs) { + return RootIsNotDir.Match.newMatch(pFs); + } + + /** + * Retrieve the set of values that occur in matches for fs. + * @return the Set of all values or empty set if there are no matches + * + */ + protected Stream rawStreamAllValuesOffs(final Object[] parameters) { + return rawStreamAllValues(POSITION_FS, parameters).map(FileSystem.class::cast); + } + + /** + * Retrieve the set of values that occur in matches for fs. + * @return the Set of all values or empty set if there are no matches + * + */ + public Set getAllValuesOffs() { + return rawStreamAllValuesOffs(emptyArray()).collect(Collectors.toSet()); + } + + /** + * Retrieve the set of values that occur in matches for fs. + * @return the Set of all values or empty set if there are no matches + * + */ + public Stream streamAllValuesOffs() { + return rawStreamAllValuesOffs(emptyArray()); + } + + @Override + protected RootIsNotDir.Match tupleToMatch(final Tuple t) { + try { + return RootIsNotDir.Match.newMatch((FileSystem) t.get(POSITION_FS)); + } catch(ClassCastException e) { + LOGGER.error("Element(s) in tuple not properly typed!",e); + return null; + } + } + + @Override + protected RootIsNotDir.Match arrayToMatch(final Object[] match) { + try { + return RootIsNotDir.Match.newMatch((FileSystem) match[POSITION_FS]); + } catch(ClassCastException e) { + LOGGER.error("Element(s) in array not properly typed!",e); + return null; + } + } + + @Override + protected RootIsNotDir.Match arrayToMatchMutable(final Object[] match) { + try { + return RootIsNotDir.Match.newMutableMatch((FileSystem) match[POSITION_FS]); + } catch(ClassCastException e) { + LOGGER.error("Element(s) in array not properly typed!",e); + return null; + } + } + + /** + * @return the singleton instance of the query specification of this pattern + * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded + * + */ + public static IQuerySpecification querySpecification() { + return RootIsNotDir.instance(); + } + } + + private RootIsNotDir() { + super(GeneratedPQuery.INSTANCE); + } + + /** + * @return the singleton instance of the query specification + * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded + * + */ + public static RootIsNotDir instance() { + try{ + return LazyHolder.INSTANCE; + } catch (ExceptionInInitializerError err) { + throw processInitializerError(err); + } + } + + @Override + protected RootIsNotDir.Matcher instantiate(final ViatraQueryEngine engine) { + return RootIsNotDir.Matcher.on(engine); + } + + @Override + public RootIsNotDir.Matcher instantiate() { + return RootIsNotDir.Matcher.create(); + } + + @Override + public RootIsNotDir.Match newEmptyMatch() { + return RootIsNotDir.Match.newEmptyMatch(); + } + + @Override + public RootIsNotDir.Match newMatch(final Object... parameters) { + return RootIsNotDir.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FileSystem) parameters[0]); + } + + /** + * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.alloyexamples.RootIsNotDir (visibility: PUBLIC, simpleName: RootIsNotDir, identifier: hu.bme.mit.inf.dslreasoner.domains.alloyexamples.RootIsNotDir, deprecated: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.alloyexamples) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created + * not at the class load time of the outer class, + * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.alloyexamples.RootIsNotDir (visibility: PUBLIC, simpleName: RootIsNotDir, identifier: hu.bme.mit.inf.dslreasoner.domains.alloyexamples.RootIsNotDir, deprecated: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.alloyexamples) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. + * + *

    This workaround is required e.g. to support recursion. + * + */ + private static class LazyHolder { + private static final RootIsNotDir INSTANCE = new RootIsNotDir(); + + /** + * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. + * This initialization order is required to support indirect recursion. + * + *

    The static initializer is defined using a helper field to work around limitations of the code generator. + * + */ + private static final Object STATIC_INITIALIZER = ensureInitialized(); + + public static Object ensureInitialized() { + INSTANCE.ensureInitializedInternal(); + return null; + } + } + + private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { + private static final RootIsNotDir.GeneratedPQuery INSTANCE = new GeneratedPQuery(); + + private final PParameter parameter_fs = new PParameter("fs", "hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FileSystem", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("FS", "FileSystem")), PParameterDirection.INOUT); + + private final List parameters = Arrays.asList(parameter_fs); + + private GeneratedPQuery() { + super(PVisibility.PUBLIC); + } + + @Override + public String getFullyQualifiedName() { + return "hu.bme.mit.inf.dslreasoner.domains.alloyexamples.rootIsNotDir"; + } + + @Override + public List getParameterNames() { + return Arrays.asList("fs"); + } + + @Override + public List getParameters() { + return parameters; + } + + @Override + public Set doGetContainedBodies() { + setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); + Set bodies = new LinkedHashSet<>(); + { + PBody body = new PBody(this); + PVariable var_fs = body.getOrCreateVariableByName("fs"); + PVariable var_root = body.getOrCreateVariableByName("root"); + new TypeConstraint(body, Tuples.flatTupleOf(var_fs), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("FS", "FileSystem"))); + body.setSymbolicParameters(Arrays.asList( + new ExportedParameter(body, var_fs, parameter_fs) + )); + // FileSystem.root(fs, root) + new TypeConstraint(body, Tuples.flatTupleOf(var_fs), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("FS", "FileSystem"))); + PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); + new TypeConstraint(body, Tuples.flatTupleOf(var_fs, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("FS", "FileSystem", "root"))); + new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("FS", "FSObject"))); + new Equality(body, var__virtual_0_, var_root); + // neg find dir(root) + new NegativePatternCall(body, Tuples.flatTupleOf(var_root), Dir.instance().getInternalQueryRepresentation()); + bodies.add(body); + } + { + PAnnotation annotation = new PAnnotation("Constraint"); + annotation.addAttribute("key", Arrays.asList(new Object[] { + new ParameterReference("fs") + })); + annotation.addAttribute("severity", "error"); + annotation.addAttribute("message", "error"); + addAnnotation(annotation); + } + return bodies; + } + } +} diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/FileSystem.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/FileSystem.java index 1896e31e..f0066955 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/FileSystem.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/FileSystem.java @@ -33,12 +33,12 @@ public interface FileSystem extends EObject { *

    * * @return the value of the 'Root' containment reference. - * @see #setRoot(Dir) + * @see #setRoot(FSObject) * @see hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FilesystemPackage#getFileSystem_Root() * @model containment="true" required="true" * @generated */ - Dir getRoot(); + FSObject getRoot(); /** * Sets the value of the '{@link hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FileSystem#getRoot Root}' containment reference. @@ -48,7 +48,7 @@ public interface FileSystem extends EObject { * @see #getRoot() * @generated */ - void setRoot(Dir value); + void setRoot(FSObject value); /** * Returns the value of the 'Live' reference list. diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/DirImpl.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/DirImpl.java index 62df04af..c2d417d2 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/DirImpl.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/DirImpl.java @@ -66,6 +66,7 @@ public class DirImpl extends FSObjectImpl implements Dir { * * @generated */ + @Override public EList getContents() { if (contents == null) { contents = new EObjectContainmentWithInverseEList(FSObject.class, this, FilesystemPackage.DIR__CONTENTS, FilesystemPackage.FS_OBJECT__PARENT); diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FSObjectImpl.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FSObjectImpl.java index c8e73b4e..d87935d6 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FSObjectImpl.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FSObjectImpl.java @@ -53,6 +53,7 @@ public abstract class FSObjectImpl extends MinimalEObjectImpl.Container implemen * * @generated */ + @Override public Dir getParent() { if (eContainerFeatureID() != FilesystemPackage.FS_OBJECT__PARENT) return null; return (Dir)eInternalContainer(); @@ -73,6 +74,7 @@ public abstract class FSObjectImpl extends MinimalEObjectImpl.Container implemen * * @generated */ + @Override public void setParent(Dir newParent) { if (newParent != eInternalContainer() || (eContainerFeatureID() != FilesystemPackage.FS_OBJECT__PARENT && newParent != null)) { if (EcoreUtil.isAncestor(this, newParent)) diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FileSystemImpl.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FileSystemImpl.java index adf30f3a..e6859cab 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FileSystemImpl.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FileSystemImpl.java @@ -2,7 +2,6 @@ */ package hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.impl; -import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir; import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FSObject; import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FileSystem; import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FilesystemPackage; @@ -42,7 +41,7 @@ public class FileSystemImpl extends MinimalEObjectImpl.Container implements File * @generated * @ordered */ - protected Dir root; + protected FSObject root; /** * The cached setting delegate for the '{@link #getLive() Live}' reference list. @@ -78,7 +77,8 @@ public class FileSystemImpl extends MinimalEObjectImpl.Container implements File * * @generated */ - public Dir getRoot() { + @Override + public FSObject getRoot() { return root; } @@ -87,8 +87,8 @@ public class FileSystemImpl extends MinimalEObjectImpl.Container implements File * * @generated */ - public NotificationChain basicSetRoot(Dir newRoot, NotificationChain msgs) { - Dir oldRoot = root; + public NotificationChain basicSetRoot(FSObject newRoot, NotificationChain msgs) { + FSObject oldRoot = root; root = newRoot; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FilesystemPackage.FILE_SYSTEM__ROOT, oldRoot, newRoot); @@ -102,7 +102,8 @@ public class FileSystemImpl extends MinimalEObjectImpl.Container implements File * * @generated */ - public void setRoot(Dir newRoot) { + @Override + public void setRoot(FSObject newRoot) { if (newRoot != root) { NotificationChain msgs = null; if (root != null) @@ -122,6 +123,7 @@ public class FileSystemImpl extends MinimalEObjectImpl.Container implements File * @generated */ @SuppressWarnings("unchecked") + @Override public EList getLive() { return (EList)LIVE__ESETTING_DELEGATE.dynamicGet(this, null, 0, true, false); } @@ -165,7 +167,7 @@ public class FileSystemImpl extends MinimalEObjectImpl.Container implements File public void eSet(int featureID, Object newValue) { switch (featureID) { case FilesystemPackage.FILE_SYSTEM__ROOT: - setRoot((Dir)newValue); + setRoot((FSObject)newValue); return; } super.eSet(featureID, newValue); @@ -180,7 +182,7 @@ public class FileSystemImpl extends MinimalEObjectImpl.Container implements File public void eUnset(int featureID) { switch (featureID) { case FilesystemPackage.FILE_SYSTEM__ROOT: - setRoot((Dir)null); + setRoot((FSObject)null); return; } super.eUnset(featureID); diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FilesystemFactoryImpl.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FilesystemFactoryImpl.java index e40b0bd1..b4b09e15 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FilesystemFactoryImpl.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FilesystemFactoryImpl.java @@ -70,6 +70,7 @@ public class FilesystemFactoryImpl extends EFactoryImpl implements FilesystemFac * * @generated */ + @Override public FileSystem createFileSystem() { FileSystemImpl fileSystem = new FileSystemImpl(); return fileSystem; @@ -80,6 +81,7 @@ public class FilesystemFactoryImpl extends EFactoryImpl implements FilesystemFac * * @generated */ + @Override public Dir createDir() { DirImpl dir = new DirImpl(); return dir; @@ -90,6 +92,7 @@ public class FilesystemFactoryImpl extends EFactoryImpl implements FilesystemFac * * @generated */ + @Override public File createFile() { FileImpl file = new FileImpl(); return file; @@ -100,6 +103,7 @@ public class FilesystemFactoryImpl extends EFactoryImpl implements FilesystemFac * * @generated */ + @Override public Model createModel() { ModelImpl model = new ModelImpl(); return model; @@ -110,6 +114,7 @@ public class FilesystemFactoryImpl extends EFactoryImpl implements FilesystemFac * * @generated */ + @Override public FilesystemPackage getFilesystemPackage() { return (FilesystemPackage)getEPackage(); } diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FilesystemPackageImpl.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FilesystemPackageImpl.java index 87390fee..4c0ca4c5 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FilesystemPackageImpl.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FilesystemPackageImpl.java @@ -86,7 +86,7 @@ public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPac /** * Creates, registers, and initializes the Package for this model, and for any others upon which it depends. - * + * *

    This method is used to initialize {@link FilesystemPackage#eINSTANCE} when that field is accessed. * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. * @@ -100,7 +100,8 @@ public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPac if (isInited) return (FilesystemPackage)EPackage.Registry.INSTANCE.getEPackage(FilesystemPackage.eNS_URI); // Obtain or create and register package - FilesystemPackageImpl theFilesystemPackage = (FilesystemPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof FilesystemPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new FilesystemPackageImpl()); + Object registeredFilesystemPackage = EPackage.Registry.INSTANCE.get(eNS_URI); + FilesystemPackageImpl theFilesystemPackage = registeredFilesystemPackage instanceof FilesystemPackageImpl ? (FilesystemPackageImpl)registeredFilesystemPackage : new FilesystemPackageImpl(); isInited = true; @@ -113,7 +114,6 @@ public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPac // Mark meta-data to indicate it can't be changed theFilesystemPackage.freeze(); - // Update the registry and return the package EPackage.Registry.INSTANCE.put(FilesystemPackage.eNS_URI, theFilesystemPackage); return theFilesystemPackage; @@ -124,6 +124,7 @@ public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPac * * @generated */ + @Override public EClass getFileSystem() { return fileSystemEClass; } @@ -133,6 +134,7 @@ public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPac * * @generated */ + @Override public EReference getFileSystem_Root() { return (EReference)fileSystemEClass.getEStructuralFeatures().get(0); } @@ -142,6 +144,7 @@ public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPac * * @generated */ + @Override public EReference getFileSystem_Live() { return (EReference)fileSystemEClass.getEStructuralFeatures().get(1); } @@ -151,6 +154,7 @@ public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPac * * @generated */ + @Override public EClass getFSObject() { return fsObjectEClass; } @@ -160,6 +164,7 @@ public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPac * * @generated */ + @Override public EReference getFSObject_Parent() { return (EReference)fsObjectEClass.getEStructuralFeatures().get(0); } @@ -169,6 +174,7 @@ public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPac * * @generated */ + @Override public EClass getDir() { return dirEClass; } @@ -178,6 +184,7 @@ public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPac * * @generated */ + @Override public EReference getDir_Contents() { return (EReference)dirEClass.getEStructuralFeatures().get(0); } @@ -187,6 +194,7 @@ public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPac * * @generated */ + @Override public EClass getFile() { return fileEClass; } @@ -196,6 +204,7 @@ public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPac * * @generated */ + @Override public EClass getModel() { return modelEClass; } @@ -205,6 +214,7 @@ public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPac * * @generated */ + @Override public EReference getModel_Filesystems() { return (EReference)modelEClass.getEStructuralFeatures().get(0); } @@ -214,6 +224,7 @@ public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPac * * @generated */ + @Override public EReference getModel_OtherFSObjects() { return (EReference)modelEClass.getEStructuralFeatures().get(1); } @@ -223,6 +234,7 @@ public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPac * * @generated */ + @Override public FilesystemFactory getFilesystemFactory() { return (FilesystemFactory)getEFactoryInstance(); } @@ -296,7 +308,7 @@ public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPac // Initialize classes, features, and operations; add parameters initEClass(fileSystemEClass, FileSystem.class, "FileSystem", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getFileSystem_Root(), this.getDir(), null, "root", null, 1, 1, FileSystem.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getFileSystem_Root(), this.getFSObject(), null, "root", null, 1, 1, FileSystem.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getFileSystem_Live(), this.getFSObject(), null, "live", null, 0, -1, FileSystem.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED); initEClass(fsObjectEClass, FSObject.class, "FSObject", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); @@ -328,12 +340,12 @@ public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPac * @generated */ protected void createEcoreAnnotations() { - String source = "http://www.eclipse.org/emf/2002/Ecore"; + String source = "http://www.eclipse.org/emf/2002/Ecore"; addAnnotation - (this, - source, + (this, + source, new String[] { - "settingDelegates", "org.eclipse.viatra.query.querybasedfeature" + "settingDelegates", "org.eclipse.viatra.query.querybasedfeature" }); } @@ -344,12 +356,12 @@ public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPac * @generated */ protected void createOrgAnnotations() { - String source = "org.eclipse.viatra.query.querybasedfeature"; + String source = "org.eclipse.viatra.query.querybasedfeature"; addAnnotation - (getFileSystem_Live(), - source, + (getFileSystem_Live(), + source, new String[] { - "patternFQN", "hu.bme.mit.inf.dslreasoner.domains.alloyexamples.live" + "patternFQN", "hu.bme.mit.inf.dslreasoner.domains.alloyexamples.live" }); } diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/ModelImpl.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/ModelImpl.java index 4c236e8e..093b9972 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/ModelImpl.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/ModelImpl.java @@ -82,6 +82,7 @@ public class ModelImpl extends MinimalEObjectImpl.Container implements Model { * * @generated */ + @Override public FileSystem getFilesystems() { return filesystems; } @@ -106,6 +107,7 @@ public class ModelImpl extends MinimalEObjectImpl.Container implements Model { * * @generated */ + @Override public void setFilesystems(FileSystem newFilesystems) { if (newFilesystems != filesystems) { NotificationChain msgs = null; @@ -125,6 +127,7 @@ public class ModelImpl extends MinimalEObjectImpl.Container implements Model { * * @generated */ + @Override public EList getOtherFSObjects() { if (otherFSObjects == null) { otherFSObjects = new EObjectContainmentEList(FSObject.class, this, FilesystemPackage.MODEL__OTHER_FS_OBJECTS); 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/fs_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json index d7955ddd..a7e29a22 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/fs_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json @@ -6,10 +6,11 @@ "warmupIterations": 1, "iterations": 1, "domain": "fs", - "scope": "useful", + "scope": "none", "sizes": [50, 100, 150, 200, 250, 300, 350, 400, 450, 500], "solver": "ViatraSolver", "scopePropagator": "polyhedral", - "propagatedConstraints": "relations", - "polyhedronSolver": "Clp" + "propagatedConstraints": "hints", + "polyhedronSolver": "Clp", + "scopeHeuristic": "polyhedral" } diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/FileSystemHint.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/FileSystemHint.xtend new file mode 100644 index 00000000..8d6523b1 --- /dev/null +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/FileSystemHint.xtend @@ -0,0 +1,32 @@ +package hu.bme.mit.inf.dslreasoner.run + +import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic +import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic_Trace +import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.LinearTypeExpressionBuilderFactory +import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.patterns.PatternGenerator + +class FileSystemHint extends Ecore2LogicTraceBasedHint { + static val REMAINING_CONTENTS_ROOT = "hint_root" + + new(Ecore2Logic ecore2Logic, Ecore2Logic_Trace trace) { + super(ecore2Logic, trace) + } + + override getAdditionalPatterns(PatternGenerator it) ''' + pattern «REMAINING_CONTENTS_ROOT»(problem:LogicProblem, interpretation:PartialInterpretation, remainingContents:java Integer) { + find interpretation(problem, interpretation); + remainingContents == sum find remainingContents_root_reference_Dir_helper(problem, interpretation, _, #_) + } + ''' + + override createConstraintUpdater(LinearTypeExpressionBuilderFactory it) { + val dirCount = createBuilder.add(1, "Dir".type).build + + val remainingContentsRootMatcher = createMatcher(REMAINING_CONTENTS_ROOT) + + return [ p | + dirCount.tightenLowerBound(remainingContentsRootMatcher.getCount(p)) + ] + } + +} diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/FileSystemInconsistencyDetector.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/FileSystemInconsistencyDetector.xtend index e79a6261..f4f36951 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/FileSystemInconsistencyDetector.xtend +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/FileSystemInconsistencyDetector.xtend @@ -35,11 +35,11 @@ class FileSystemInconsistencyDetector extends ModelGenerationMethodBasedGlobalCo override checkGlobalConstraint(ThreadContext context) { var requiredNewObjects = - filesystem.countMatches*2 + - root.countMatches + root.countMatches*2 + + filesystem.countMatches val availableNewObjects = partialInterpretation.maxNewElements val res = availableNewObjects >= requiredNewObjects - //println('''[«availableNewObjects» >= «requiredNewObjects»] = «res»''') + println('''[«availableNewObjects» >= «requiredNewObjects»] = «res»''') return res } 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 54724226..4b0791d4 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 @@ -195,8 +195,9 @@ class YakinduLoader extends MetamodelLoader { this.workspace.readModel(EObject, "Yakindu.xmi").eResource.allContents.toList } - override additionalConstraints() { // #[] - #[[method|new SGraphInconsistencyDetector(method)]] + override additionalConstraints() { + //#[[method|new SGraphInconsistencyDetector(method)]] + emptyList } override getTypeQuantiles() { @@ -260,9 +261,17 @@ class FileSystemLoader extends MetamodelLoader { } override additionalConstraints() { - #[[method|new FileSystemInconsistencyDetector(method)]] + //#[[method|new FileSystemInconsistencyDetector(method)]] + emptyList } + override getTypeQuantiles() { + #{ + "Filesystem" -> new TypeQuantiles(0, 0.05), + "Dir" -> new TypeQuantiles(0.15, 0.3), + "File" -> new TypeQuantiles(0.25, 0.85) + } + } } class EcoreLoader extends MetamodelLoader { diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SatelliteHint.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SatelliteHint.xtend index e95c0c64..ef5b779e 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SatelliteHint.xtend +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/SatelliteHint.xtend @@ -9,8 +9,6 @@ import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.patterns.PatternGene class SatelliteHint extends Ecore2LogicTraceBasedHint { static val INTERFEROMETY_PAYLOAD = "hint_interferometryPayload" static val REMAINING_CONTENTS_KA_COMM_SUBSYSTEM = "hint_kaCommSubsystem" - static val HINT_SPACECRAFT_UHF_POSSIBLE_LINK = "hint_spacecraftWithUhfPossibleLink" - static val HINT_SPACECRAFT_UHF_ONLY_NO_LINK = "hint_spacecraftUhfOnlyNoLink" new(Ecore2Logic ecore2Logic, Ecore2Logic_Trace trace) { super(ecore2Logic, trace) @@ -32,54 +30,19 @@ class SatelliteHint extends Ecore2LogicTraceBasedHint { find interpretation(problem, interpretation); remainingContents == sum find «REMAINING_CONTENTS_KA_COMM_SUBSYSTEM»_helper(problem, interpretation, _, #_); } - - private pattern hint_spacecraftNotUhfOnly(problem:LogicProblem, interpretation:PartialInterpretation, spacecraft:DefinedElement) { - find interpretation(problem, interpretation); - find mustExist(problem, interpretation, spacecraft); - «typeIndexer.referInstanceOf("Spacecraft".type, Modality.MUST, "spacecraft")» - «relationDeclarationIndexer.referRelation("CommunicatingElement".relation("commSubsystem"), "spacecraft", "comm", Modality.MAY)» - neg «typeIndexer.referInstanceOf("UHFCommSubsystem".type, Modality.MUST, "comm")» - } - - private pattern hint_spacecraftWithUhf(problem:LogicProblem, interpretation:PartialInterpretation, spacecraft:DefinedElement) { - find interpretation(problem, interpretation); - find mustExist(problem, interpretation, spacecraft); - «typeIndexer.referInstanceOf("Spacecraft".type, Modality.MUST, "spacecraft")» - «relationDeclarationIndexer.referRelation("CommunicatingElement".relation("commSubsystem"), "spacecraft", "comm", Modality.MUST)» - «typeIndexer.referInstanceOf("UHFCommSubsystem".type, Modality.MUST, "comm")» - } - - pattern «HINT_SPACECRAFT_UHF_POSSIBLE_LINK»(problem:LogicProblem, interpretation:PartialInterpretation) { - find hint_spacecraftWithUhf(problem, interpretation, spacecraft); - find hint_spacecraftNotUhfOnly(problem, interpretation, spacecraft); - } - - pattern «HINT_SPACECRAFT_UHF_ONLY_NO_LINK»(problem:LogicProblem, interpretation:PartialInterpretation) { - find interpretation(problem, interpretation); - find mustExist(problem, interpretation, spacecraft); - «typeIndexer.referInstanceOf("Spacecraft".type, Modality.MUST, "spacecraft")» - neg find hint_spacecraftNotUhfOnly(problem, interpretation, spacecraft); - find currentInRelation_pattern_hu_bme_mit_inf_dslreasoner_domains_satellite_queries_noLinkToGroundStation(problem, interpretation, spacecraft); - } ''' override createConstraintUpdater(LinearTypeExpressionBuilderFactory it) { val interferometryPayloadCount = createBuilder.add(1, "InterferometryPayload".type).build val kaCommSubsystemWithoutSmallSatCount = createBuilder.add(1, "KaCommSubsystem".type).add(-2, "SmallSat".type). build - val uhfCommSubsystemCount = createBuilder.add(1, "UHFCommSubsystem".type).build val interferometryPayloadMatcher = createMatcher(INTERFEROMETY_PAYLOAD) val kaCommSubsystemRemainingContentsMatcher = createMatcher(REMAINING_CONTENTS_KA_COMM_SUBSYSTEM) - val uhfPossibleLinkMatcher = createMatcher(HINT_SPACECRAFT_UHF_POSSIBLE_LINK) - val uhfNoLinkMatcher = createMatcher(HINT_SPACECRAFT_UHF_ONLY_NO_LINK) return [ p | interferometryPayloadCount.tightenLowerBound(2 - interferometryPayloadMatcher.countMatches(p)) kaCommSubsystemWithoutSmallSatCount.tightenUpperBound(kaCommSubsystemRemainingContentsMatcher.getCount(p)) - if (uhfPossibleLinkMatcher.countMatches(p) == 0 && uhfNoLinkMatcher.countMatches(p) >= 1) { - uhfCommSubsystemCount.tightenLowerBound(1) - } ] } 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 5abff962..56a65091 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 @@ -22,7 +22,7 @@ class MeasurementScript { ScopeHeuristic scopeHeuristic def toCsvHeader() { - '''«domain»,«scope»,«solver»,«scopePropagator ?: "NULL"»,«propagatedConstraints ?: "NULL"»,«polyhedronSolver ?: "NULL"»''' + '''«domain»,«scope»,«solver»,«scopePropagator ?: "NULL"»,«propagatedConstraints ?: "NULL"»,«polyhedronSolver ?: "NULL"»,«scopeHeuristic ?: "NULL"»''' } } 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 48e750cb..bfbbf329 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 @@ -68,7 +68,7 @@ class MeasurementScriptRunner { this.script = script inputWorkspace = new FileSystemWorkspace(script.inputPath + "/", "") outputWorkspace = new FileSystemWorkspace(script.outputPath + - "/", '''«script.domain»_«script.solver»_«script.scope»_«script.scopePropagator ?: "na"»_«script.propagatedConstraints ?: "na"»_«script.polyhedronSolver ?: "na"»_''') + "/", '''«script.domain»_«script.solver»_«script.scope»_«script.scopePropagator ?: "na"»_«script.propagatedConstraints ?: "na"»_«script.polyhedronSolver ?: "na"»_«script.scopeHeuristic ?: "na"»_''') metamodelLoader = switch (script.domain) { case fs: new FileSystemLoader(inputWorkspace) case ecore: new EcoreLoader(inputWorkspace) -- cgit v1.2.3-54-g00ecf From be4fbe4fb10a27dd07d4139c1962af7c0de436ea Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Thu, 22 Aug 2019 20:43:03 +0200 Subject: Measurements WIP --- .../ide/.ApplicationConfigurationIdeModule.xtendbin | Bin 1701 -> 1701 bytes .../ide/.ApplicationConfigurationIdeSetup.xtendbin | Bin 2570 -> 2570 bytes ...licationConfigurationStandaloneRuntimeModule.xtend | 2 +- .../execution/EclipseBasedProgressMonitor.xtend | 2 +- .../execution/GenerationTaskExecutor.xtend | 4 ++-- .../application/execution/MetamodelLoader.xtend | 2 +- .../application/execution/NullWorkspace.xtend | 2 +- .../execution/PatternLanguageWithRSModule.xtend | 2 +- .../execution/PatternLanguageWithRSSetup.xtend | 2 +- .../application/execution/QueryLoader.xtend | 2 +- .../application/execution/ScopeLoader.xtend | 2 +- .../application/execution/ScriptConsole.xtend | 8 ++++---- .../application/execution/ScriptExecutor.xtend | 2 +- .../execution/StandaloneScriptExecutor.xtend | 12 ++++++------ .../util/ApplicationConfigurationParser.xtend | 2 +- .../application/validation/MetamodelValidator.xtend | 2 +- .../validation/QueryAndMetamodelValidator.xtend | 2 +- ...pplicationConfigurationValueConverterService.xtend | 2 +- .../.project | 1 - .../representations.aird | 2 -- .../cardinality/RelationConstraintCalculator.xtend | 2 +- .../dse/PartialModelAsLogicInterpretation.xtend | 2 +- .../viatrasolver/reasoner/dse/ScopeObjective.xtend | 2 +- ...ful_ViatraSolver_polyhedral_typeHierarchy_Clp.json | 5 +++-- 24 files changed, 31 insertions(+), 33 deletions(-) delete mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/representations.aird (limited to 'Tests/hu.bme.mit.inf.dslreasoner.run') 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 22db4093..47676d41 100644 Binary files a/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeModule.xtendbin and b/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeModule.xtendbin 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 3ad5d167..e477a075 100644 Binary files a/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeSetup.xtendbin and b/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeSetup.xtendbin differ diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/ApplicationConfigurationStandaloneRuntimeModule.xtend b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/ApplicationConfigurationStandaloneRuntimeModule.xtend index 2738dfff..55e01a4f 100644 --- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/ApplicationConfigurationStandaloneRuntimeModule.xtend +++ b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/ApplicationConfigurationStandaloneRuntimeModule.xtend @@ -50,4 +50,4 @@ class ApplicationConfigurationStandaloneRuntimeModule extends AbstractApplicatio // def Class bindITargetPlatformMetamodelLoader() { // TargetPlatformMetamodelsIndex // } -} \ No newline at end of file +} diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/EclipseBasedProgressMonitor.xtend b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/EclipseBasedProgressMonitor.xtend index be35b64a..df25151c 100644 --- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/EclipseBasedProgressMonitor.xtend +++ b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/EclipseBasedProgressMonitor.xtend @@ -24,4 +24,4 @@ class EclipseBasedProgressMonitor extends SolverProgressMonitor{ super.isCancelled() || internalMonitor.isCanceled } -} \ No newline at end of file +} diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/GenerationTaskExecutor.xtend b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/GenerationTaskExecutor.xtend index 807d217a..1ee69827 100644 --- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/GenerationTaskExecutor.xtend +++ b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/GenerationTaskExecutor.xtend @@ -304,7 +304,7 @@ class GenerationTaskExecutor { console.flushStatistics console.writeMessage("Model generation finished") } catch(Exception e) { - console.writeError(''' + console.writeError(''' Error occured («e.class.simpleName»): «e.message» «FOR s : e.stackTrace SEPARATOR "\n"» «s»«ENDFOR»''') } @@ -350,4 +350,4 @@ class GenerationTaskExecutor { return false } } -} \ No newline at end of file +} diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/MetamodelLoader.xtend b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/MetamodelLoader.xtend index 5e7f84f0..626329dc 100644 --- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/MetamodelLoader.xtend +++ b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/MetamodelLoader.xtend @@ -120,4 +120,4 @@ class MetamodelLoader { // } // return res // } -} \ No newline at end of file +} diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/NullWorkspace.xtend b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/NullWorkspace.xtend index 05081581..5e656e8f 100644 --- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/NullWorkspace.xtend +++ b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/NullWorkspace.xtend @@ -59,4 +59,4 @@ class NullWorkspace extends ReasonerWorkspace{ throw new UnsupportedOperationException(message) } override refreshFile(String name) { } -} \ No newline at end of file +} diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/PatternLanguageWithRSModule.xtend b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/PatternLanguageWithRSModule.xtend index 1269ec1f..3e598dd6 100644 --- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/PatternLanguageWithRSModule.xtend +++ b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/PatternLanguageWithRSModule.xtend @@ -43,4 +43,4 @@ class PatternLanguageWithRSModule extends EMFPatternLanguageRuntimeModule{ override Class bindITypeInferrer() { return EMFTypeInferrer; } -} \ No newline at end of file +} diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/PatternLanguageWithRSSetup.xtend b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/PatternLanguageWithRSSetup.xtend index dd5af673..c209cde5 100644 --- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/PatternLanguageWithRSSetup.xtend +++ b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/PatternLanguageWithRSSetup.xtend @@ -12,4 +12,4 @@ class PatternLanguageWithRSSetup extends EMFPatternLanguageStandaloneSetup{ override Injector createInjector() { return Guice::createInjector(new PatternLanguageWithRSModule()); } -} \ No newline at end of file +} diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/QueryLoader.xtend b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/QueryLoader.xtend index cfc91143..5a73845d 100644 --- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/QueryLoader.xtend +++ b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/QueryLoader.xtend @@ -144,4 +144,4 @@ class QueryLoader { } return res } -} \ No newline at end of file +} diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/ScopeLoader.xtend b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/ScopeLoader.xtend index dcaf74cd..6d6ad85e 100644 --- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/ScopeLoader.xtend +++ b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/ScopeLoader.xtend @@ -220,4 +220,4 @@ class ScopeLoader { else return specification.exactNumber } -} \ No newline at end of file +} diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/ScriptConsole.xtend b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/ScriptConsole.xtend index 0f89ba1e..2ce86a78 100644 --- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/ScriptConsole.xtend +++ b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/ScriptConsole.xtend @@ -88,7 +88,7 @@ abstract class ScriptConsole { def writeStatistics(LinkedHashMap statistics) { if (statisticsWorkspace !== null) { - val message = ''' + val message = ''' «FOR key : statistics.keySet SEPARATOR delimier»«key»«ENDFOR» «FOR value : statistics.values SEPARATOR delimier»«value»«ENDFOR»''' statisticsWorkspace.writeText(statisticsFileName, message); @@ -104,11 +104,11 @@ abstract class ScriptConsole { def flushStatistics() { if (statisticsWorkspace !== null) { - val message = ''' + val message = ''' «FOR key : statisticsHeaderBuffer SEPARATOR delimier»«key»«ENDFOR» - «FOR line : statisticsDataBuffer» + «FOR line : statisticsDataBuffer» «FOR key : statisticsHeaderBuffer SEPARATOR delimier»«IF line.containsKey(key)»«line.get(key)»«ELSE»«empty»«ENDIF»«ENDFOR» - «ENDFOR» + «ENDFOR» ''' statisticsWorkspace.writeText(statisticsFileName, message); statisticsHeaderBuffer.clear diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/ScriptExecutor.xtend b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/ScriptExecutor.xtend index 25036df6..3941179a 100644 --- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/ScriptExecutor.xtend +++ b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/ScriptExecutor.xtend @@ -250,4 +250,4 @@ class ScriptExecutor { } } } -} \ No newline at end of file +} diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/StandaloneScriptExecutor.xtend b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/StandaloneScriptExecutor.xtend index 4ed57903..42be3ed7 100644 --- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/StandaloneScriptExecutor.xtend +++ b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/StandaloneScriptExecutor.xtend @@ -71,11 +71,11 @@ class StandaloneScriptExecutor { throw new IllegalArgumentException(message) } } else { - val message = ''' - The Configuration Script contains «errors.size» error«IF errors.size>1»s«ENDIF»: - «FOR error : errors» - «"\t"»«error.message» - «ENDFOR» + val message = ''' + The Configuration Script contains «errors.size» error«IF errors.size>1»s«ENDIF»: + «FOR error : errors» + «"\t"»«error.message» + «ENDFOR» ''' throw new IllegalArgumentException(message) } @@ -98,4 +98,4 @@ class StandaloneScriptExecutor { return e.message } } -} \ No newline at end of file +} diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/util/ApplicationConfigurationParser.xtend b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/util/ApplicationConfigurationParser.xtend index ea738c5a..0d11bd31 100644 --- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/util/ApplicationConfigurationParser.xtend +++ b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/util/ApplicationConfigurationParser.xtend @@ -15,4 +15,4 @@ class ApplicationConfigurationParser { throw new IllegalArgumentException('''Content is not an ConfigurationScript! (got: «content.class.simpleName»)''') } } -} \ No newline at end of file +} diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/validation/MetamodelValidator.xtend b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/validation/MetamodelValidator.xtend index fccc433a..f736f6ba 100644 --- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/validation/MetamodelValidator.xtend +++ b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/validation/MetamodelValidator.xtend @@ -73,4 +73,4 @@ class MetamodelValidator { } } } -} \ No newline at end of file +} diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/validation/QueryAndMetamodelValidator.xtend b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/validation/QueryAndMetamodelValidator.xtend index e5488e50..7d79bbbb 100644 --- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/validation/QueryAndMetamodelValidator.xtend +++ b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/validation/QueryAndMetamodelValidator.xtend @@ -49,4 +49,4 @@ class QueryAndMetamodelValidator { ].flatten.filter(ENamedElement) ].flatten } -} \ No newline at end of file +} diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/valueconverter/ApplicationConfigurationValueConverterService.xtend b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/valueconverter/ApplicationConfigurationValueConverterService.xtend index 433f7148..840ffb09 100644 --- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/valueconverter/ApplicationConfigurationValueConverterService.xtend +++ b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/valueconverter/ApplicationConfigurationValueConverterService.xtend @@ -11,4 +11,4 @@ class ApplicationConfigurationValueConverterService extends DefaultTerminalConve def IValueConverter QualifiedName() { converter2 } -} \ No newline at end of file +} diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/.project b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/.project index e594a173..16db5fc5 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/.project +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/.project @@ -32,7 +32,6 @@ - org.eclipse.sirius.nature.modelingproject org.eclipse.jdt.core.javanature org.eclipse.pde.PluginNature org.eclipse.viatra.query.projectnature diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/representations.aird b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/representations.aird deleted file mode 100644 index efa8e366..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/representations.aird +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/RelationConstraintCalculator.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/RelationConstraintCalculator.xtend index 013e53e1..c92260ea 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/RelationConstraintCalculator.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/RelationConstraintCalculator.xtend @@ -44,7 +44,7 @@ class RelationMultiplicityConstraint { } def constrainsUnrepairable() { - constrainsUnfinished && canHaveMultipleSourcesPerTarget + constrainsUnfinished && canHaveMultipleSourcesPerTarget && false } def constrainsRemainingInverse() { diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/PartialModelAsLogicInterpretation.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/PartialModelAsLogicInterpretation.xtend index f61c7333..b63bfe8b 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/PartialModelAsLogicInterpretation.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/PartialModelAsLogicInterpretation.xtend @@ -163,4 +163,4 @@ class PartialModelAsLogicInterpretation implements LogicModelInterpretation{ override getAllStringsInStructure() { new TreeSet(this.stringForwardTrace.keySet) } -} \ No newline at end of file +} diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/ScopeObjective.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/ScopeObjective.xtend index e7967b00..69a734f8 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/ScopeObjective.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/ScopeObjective.xtend @@ -41,4 +41,4 @@ class ScopeObjective implements IObjective{ throw new UnsupportedOperationException("TODO: auto-generated method stub") } override getLevel() { 2 } -} \ No newline at end of file +} 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 index 5f8a01b1..b4d51684 100644 --- 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 @@ -3,14 +3,15 @@ "outputPath": "outputModels", "timeout": 1200, "saveModels": false, + "saveTemporaryFiles": true, "warmupIterations": 0, "iterations": 5, "domain": "Yakindu", - "scope": "quantiles", + "scope": "none", "sizes": [100], "solver": "ViatraSolver", "scopePropagator": "polyhedral", "propagatedConstraints": "hints", "polyhedronSolver": "Clp", - "scopeHeuristic": "basic" + "scopeHeuristic": "polyhedral" } -- cgit v1.2.3-54-g00ecf From 1f5cab77334817776618092501628ed70368dd6e Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Fri, 30 Aug 2019 15:52:45 +0200 Subject: FAM metamodel loader experiments --- .../ide/.ApplicationConfigurationIdeModule.xtendbin | Bin 1701 -> 1701 bytes .../ide/.ApplicationConfigurationIdeSetup.xtendbin | Bin 2570 -> 2570 bytes ...ful_ViatraSolver_polyhedral_typeHierarchy_Clp.json | 7 +++++-- .../bme/mit/inf/dslreasoner/run/MetamodelLoader.xtend | 15 ++++++++------- 4 files changed, 13 insertions(+), 9 deletions(-) (limited to 'Tests/hu.bme.mit.inf.dslreasoner.run') 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 47676d41..8925abcb 100644 Binary files a/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeModule.xtendbin and b/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeModule.xtendbin 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 e477a075..2b883b66 100644 Binary files a/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeSetup.xtendbin and b/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeSetup.xtendbin differ 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 index 26df3c74..1e2d4dd4 100644 --- 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 @@ -4,10 +4,13 @@ "timeout": 1200, "saveModels": true, "warmupIterations": 0, - "iterations": 1, + "iterations": 5, "domain": "FAM", "scope": "none", "sizes": [500], "solver": "ViatraSolver", - "scopePropagator": "basic" + "scopePropagator": "polyhedral", + "propagatedConstraints": "hints", + "polyhedronSolver": "Clp", + "scopeHeuristics": "polyhedral" } 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 4b0791d4..1be03eed 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 @@ -85,8 +85,9 @@ class FAMLoader extends MetamodelLoader { val List classes = package.EClassifiers.filter(EClass).toList val List enums = package.EClassifiers.filter(EEnum).toList val List literals = enums.map[ELiterals].flatten.toList - val List references = classes.map[EReferences].flatten.filter[name != "type" && name != "model"]. - toList + val List references = classes.map[EReferences].flatten.filter [ reference | + !#{"model", "type"}.contains(reference.name) + ].toList val List attributes = classes.map[EAttributes].flatten.toList return new EcoreMetamodelDescriptor(classes, #{}, false, enums, literals, references, attributes) } @@ -196,7 +197,7 @@ class YakinduLoader extends MetamodelLoader { } override additionalConstraints() { - //#[[method|new SGraphInconsistencyDetector(method)]] + // #[[method|new SGraphInconsistencyDetector(method)]] emptyList } @@ -261,7 +262,7 @@ class FileSystemLoader extends MetamodelLoader { } override additionalConstraints() { - //#[[method|new FileSystemInconsistencyDetector(method)]] + // #[[method|new FileSystemInconsistencyDetector(method)]] emptyList } @@ -386,11 +387,11 @@ class SatelliteLoader extends MetamodelLoader { } override additionalConstraints() { #[] } - + override getHints(Ecore2Logic ecore2Logic, Ecore2Logic_Trace trace) { #[new SatelliteHint(ecore2Logic, trace)] } - + override getTypeQuantiles() { #{ "CubeSat3U" -> new TypeQuantiles(0.1, 0.25), @@ -402,5 +403,5 @@ class SatelliteLoader extends MetamodelLoader { "InterferometryPayload" -> new TypeQuantiles(0.15, 0.25) } } - + } -- cgit v1.2.3-54-g00ecf From 78b145df05795a71bef18c73526b0c8ff6a53e7e Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Tue, 29 Oct 2019 17:33:59 +0100 Subject: MeasurementScriptRunner fix --- .../.classpath | 7 +++- .../build.properties | 3 +- ..._ViatraSolver_polyhedral_typeHierarchy_Clp.json | 7 ++-- ..._ViatraSolver_polyhedral_typeHierarchy_Clp.json | 6 +-- .../run/script/MeasurementScriptRunner.xtend | 47 ++++++++++++++++------ 5 files changed, 48 insertions(+), 22 deletions(-) (limited to 'Tests/hu.bme.mit.inf.dslreasoner.run') diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/.classpath b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/.classpath index 4a3597ed..e7847821 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/.classpath +++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/.classpath @@ -1,9 +1,12 @@ - + + + + + - diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/build.properties b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/build.properties index ce900fd9..e1651110 100644 --- a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/build.properties +++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/build.properties @@ -3,6 +3,5 @@ bin.includes = META-INF/,\ additional.bundles = org.apache.log4j,\ org.junit source.. = src/,\ - xtend-gen/,\ - src-gen/ + xtend-gen/ output.. = bin/ 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/ecore_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json index 42073422..72e97957 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/ecore_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json @@ -7,9 +7,10 @@ "iterations": 5, "domain": "ecore", "scope": "quantiles", - "sizes": [100], + "sizes": [50], "solver": "ViatraSolver", "scopePropagator": "polyhedral", - "propagatedConstraints": "relations", - "polyhedronSolver": "Clp" + "propagatedConstraints": "hints", + "polyhedronSolver": "Clp", + "scopeHeuristic": "polyhedral" } 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 index 474962e7..d5469948 100644 --- 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 @@ -1,14 +1,14 @@ { "inputPath": "initialModels", "outputPath": "outputModels", - "timeout": 1200, + "timeout": 120, "saveModels": true, "saveTemporaryFiles": true, "warmupIterations": 0, "iterations": 1, - "domain": "satellite", + "domain": "Yakindu", "scope": "quantiles", - "sizes": [50], + "sizes": [10, 20, 30, 40, 50, 60, 70, 80, 90, 100], "solver": "ViatraSolver", "scopePropagator": "polyhedral", "propagatedConstraints": "hints", 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 bfbbf329..1127f01a 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 @@ -1,11 +1,14 @@ package hu.bme.mit.inf.dslreasoner.run.script import com.google.gson.Gson +import hu.bme.mit.inf.dlsreasoner.alloy.reasoner.AlloySolver +import hu.bme.mit.inf.dlsreasoner.alloy.reasoner.AlloySolverConfiguration import hu.bme.mit.inf.dslreasoner.ecore2logic.EClassMapper import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2LogicConfiguration import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic_Trace import hu.bme.mit.inf.dslreasoner.logic.model.builder.DocumentationLevel +import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicSolverConfiguration import hu.bme.mit.inf.dslreasoner.logic.model.builder.TypeScopes import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.DefinedElement import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.IntLiteral @@ -138,12 +141,10 @@ class MeasurementScriptRunner { Thread.sleep(800) } - private def runExperiment(int modelSize) { - if (script.solver != Solver.ViatraSolver) { - throw new IllegalArgumentException("Only VIATRA-Generator is supported") - } + private def createViatraConfig() { val config = new ViatraReasonerConfiguration - config.solutionScope.numberOfRequiredSolutions = 1 + config.debugConfiguration.partialInterpretatioVisualiser = null + config.searchSpaceConstraints.additionalGlobalConstraints += metamodelLoader.additionalConstraints config.scopePropagatorStrategy = switch (script.scopePropagator) { case none: ScopePropagatorStrategy.None @@ -187,11 +188,28 @@ class MeasurementScriptRunner { default: throw new IllegalArgumentException("Unknown scope propagator: " + script.scopePropagator) } + config + } + + private def createAlloyConfig() { + val config = new AlloySolverConfiguration + config + } + + private def createConfig(int modelSize) { + val config = switch (solver : script.solver) { + case ViatraSolver: createViatraConfig() + case AlloySolver: createAlloyConfig() + default: throw new IllegalArgumentException("Unknown solver: " + solver) + } + config.solutionScope.numberOfRequiredSolutions = 1 config.runtimeLimit = script.timeout config.documentationLevel = if(script.saveTemporaryFiles) DocumentationLevel.NORMAL else DocumentationLevel.NONE - config.debugConfiguration.partialInterpretatioVisualiser = null - config.searchSpaceConstraints.additionalGlobalConstraints += metamodelLoader.additionalConstraints + config + } + private def runExperiment(int modelSize) { + val config = createConfig(modelSize) val modelLoadingStart = System.nanoTime val metamodelDescriptor = metamodelLoader.loadMetamodel val partialModelDescriptor = metamodelLoader.loadPartialModel @@ -214,8 +232,8 @@ class MeasurementScriptRunner { new Viatra2LogicConfiguration ).output initializeScope(config, modelSize, problem, ecore2Logic, modelGeneration.trace) - if (script.propagatedConstraints == ScopeConstraints.hints) { - config.hints = metamodelLoader.getHints(ecore2Logic, modelGeneration.trace) + if (config instanceof ViatraReasonerConfiguration && script.propagatedConstraints == ScopeConstraints.hints) { + (config as ViatraReasonerConfiguration).hints = metamodelLoader.getHints(ecore2Logic, modelGeneration.trace) } val domain2LogicTransformationTime = System.nanoTime - domain2LogicTransformationStart @@ -223,7 +241,11 @@ class MeasurementScriptRunner { outputWorkspace.writeModel(problem, "initial.logicproblem") } - val solver = new ViatraReasoner + val solver = switch (solver : script.solver) { + case ViatraSolver: new ViatraReasoner + case AlloySolver: new AlloySolver + default: throw new IllegalArgumentException("Unknown solver: " + solver) + } val result = solver.solve(problem, config, outputWorkspace) val statistics = result.statistics statistics.entries += createIntStatisticEntry => [ @@ -253,7 +275,7 @@ class MeasurementScriptRunner { new ExperimentResult(result.class.simpleName, statistics, modelResult) } - private def initializeScope(ViatraReasonerConfiguration config, int modelSize, LogicProblem problem, + private def initializeScope(LogicSolverConfiguration config, int modelSize, LogicProblem problem, EClassMapper eClassMapper, Ecore2Logic_Trace trace) { val knownElements = initializeKnownElements(problem, config.typeScopes) if (modelSize < 0) { @@ -278,7 +300,8 @@ class MeasurementScriptRunner { val currentCount = if(knownInstances === null) 0 else knownInstances.size val lowCount = Math.floor(modelSize * quantile.low) as int val highCount = Math.ceil((modelSize + MODEL_SIZE_GAP) * quantile.high) as int - config.typeScopes.minNewElementsByType.put(type, lowCount - currentCount) +// println('''«type.name» «lowCount» «highCount»''') + config.typeScopes.minNewElementsByType.put(type, Math.max(lowCount - currentCount, 0)) config.typeScopes.maxNewElementsByType.put(type, highCount - currentCount) } } -- cgit v1.2.3-54-g00ecf From 6a3ff9bb588bf47242a56b91e35479dbba38eb19 Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Thu, 7 May 2020 17:26:07 +0200 Subject: Scope unsat benchmarks --- .../.ApplicationConfigurationIdeModule.xtendbin | Bin 1701 -> 1701 bytes .../ide/.ApplicationConfigurationIdeSetup.xtendbin | Bin 2570 -> 2526 bytes .../Examples/ModelGenExampleFAM_plugin/.project | 6 + .../Examples/ModelGenExampleFAM_plugin/plugin.xml | 18 +- .../dslreasoner/domains/alloyexamples/Ecore.vql | 10 + .../plugin.xml | 2 + .../dslreasoner/domains/alloyexamples/.gitignore | 5 + .../alloyexamples/Unsat_loopInInheritance.java | 566 +++++++++++++++++ .../domains/alloyexamples/Unsat_subpackage.java | 704 +++++++++++++++++++++ .../domains/alloyexamples/internal/.gitignore | 4 + .../plugin.xml | 12 +- .../domains/satellite/queries/SatelliteQueries.vql | 13 + .../plugin.xml | 1 + .../partialsnapshot_mavo/yakindu/patterns.vql | 11 + .../.classpath | 26 +- .../META-INF/MANIFEST.MF | 7 +- .../NeighbourhoodBasedStateCoderFactory.xtend | 9 +- .../reasoner/ViatraReasonerConfiguration.xtend | 2 +- ..._ViatraSolver_polyhedral_typeHierarchy_Clp.json | 16 - .../configs/Yakindu.json | 13 + ..._ViatraSolver_polyhedral_typeHierarchy_Clp.json | 17 - .../configs/ecore.json | 17 + ..._ViatraSolver_polyhedral_typeHierarchy_Clp.json | 16 - ..._ViatraSolver_polyhedral_typeHierarchy_Clp.json | 16 - .../configs/satellite.json | 17 + ..._ViatraSolver_polyhedral_typeHierarchy_Clp.json | 17 - .../mit/inf/dslreasoner/run/MetamodelLoader.xtend | 63 +- .../dslreasoner/run/script/MeasurementScript.xtend | 13 +- .../run/script/MeasurementScriptRunner.xtend | 46 +- 29 files changed, 1511 insertions(+), 136 deletions(-) create mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Unsat_loopInInheritance.java create mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Unsat_subpackage.java create mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src-gen/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/internal/.gitignore delete mode 100644 Tests/hu.bme.mit.inf.dslreasoner.run/configs/FAM_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json create mode 100644 Tests/hu.bme.mit.inf.dslreasoner.run/configs/Yakindu.json delete mode 100644 Tests/hu.bme.mit.inf.dslreasoner.run/configs/Yakindu_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json create mode 100644 Tests/hu.bme.mit.inf.dslreasoner.run/configs/ecore.json delete mode 100644 Tests/hu.bme.mit.inf.dslreasoner.run/configs/ecore_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json delete mode 100644 Tests/hu.bme.mit.inf.dslreasoner.run/configs/fs_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json create mode 100644 Tests/hu.bme.mit.inf.dslreasoner.run/configs/satellite.json delete mode 100644 Tests/hu.bme.mit.inf.dslreasoner.run/configs/satellite_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json (limited to 'Tests/hu.bme.mit.inf.dslreasoner.run') 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 Binary files a/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeModule.xtendbin and b/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeModule.xtendbin 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 Binary files a/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeSetup.xtendbin and b/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeSetup.xtendbin 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 @@ -5,6 +5,11 @@ + + org.eclipse.xtext.ui.shared.xtextBuilder + + + org.eclipse.viatra.query.tooling.ui.projectbuilder @@ -30,5 +35,6 @@ org.eclipse.jdt.core.javanature org.eclipse.viatra.query.projectnature org.eclipse.pde.PluginNature + org.eclipse.xtext.ui.shared.xtextNature 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 @@ - - - - + + + + - - - - - - - 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) { find directSupertype+(a,a); } +pattern unsat_subpackage(a: EPackage, b: EPackage) { + EPackage.eSubpackages(a, b); +} + +@Constraint(key={p}, severity="error", message="error") +pattern unsat_loopInInheritance(p: EPackage) { + neg find unsat_subpackage(_, p); + neg find loopInInheritence(_); +} + pattern opposite(a:EReference, b: EReference) { EReference.eOpposite(a,b); } 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 @@ + + 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 @@ /.RootIsNotDir.java._trace /Dir.java /RootIsNotDir.java +/.Unsat_loopInInheritance.java._trace +/.Subpackage.java._trace +/.Unsat_subpackage.java._trace +/.Unsat_subpackageOrSelf.java._trace +/.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 @@ +/** + * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/patterns/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Ecore.vql + */ +package hu.bme.mit.inf.dslreasoner.domains.alloyexamples; + +import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.LoopInInheritence; +import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Unsat_subpackage; +import java.util.Arrays; +import java.util.Collection; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.function.Consumer; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import org.apache.log4j.Logger; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.viatra.query.runtime.api.IPatternMatch; +import org.eclipse.viatra.query.runtime.api.IQuerySpecification; +import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; +import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; +import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; +import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; +import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; +import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; +import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; +import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; +import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; +import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; +import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference; +import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; +import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; +import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; +import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; +import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; +import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; +import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; +import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; +import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; + +/** + * A pattern-specific query specification that can instantiate Matcher in a type-safe way. + * + *

    Original source: + *

    + *         {@literal @}Constraint(key={p}, severity="error", message="error")
    + *         pattern unsat_loopInInheritance(p: EPackage) {
    + *         	neg find unsat_subpackage(_, p);
    + *         	neg find loopInInheritence(_);
    + *         }
    + * 
    + * + * @see Matcher + * @see Match + * + */ +@SuppressWarnings("all") +public final class Unsat_loopInInheritance extends BaseGeneratedEMFQuerySpecification { + /** + * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.alloyexamples.unsat_loopInInheritance pattern, + * to be used in conjunction with {@link Matcher}. + * + *

    Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. + * Each instance is a (possibly partial) substitution of pattern parameters, + * usable to represent a match of the pattern in the result of a query, + * or to specify the bound (fixed) input parameters when issuing a query. + * + * @see Matcher + * + */ + public static abstract class Match extends BasePatternMatch { + private EPackage fP; + + private static List parameterNames = makeImmutableList("p"); + + private Match(final EPackage pP) { + this.fP = pP; + } + + @Override + public Object get(final String parameterName) { + switch(parameterName) { + case "p": return this.fP; + default: return null; + } + } + + @Override + public Object get(final int index) { + switch(index) { + case 0: return this.fP; + default: return null; + } + } + + public EPackage getP() { + return this.fP; + } + + @Override + public boolean set(final String parameterName, final Object newValue) { + if (!isMutable()) throw new java.lang.UnsupportedOperationException(); + if ("p".equals(parameterName) ) { + this.fP = (EPackage) newValue; + return true; + } + return false; + } + + public void setP(final EPackage pP) { + if (!isMutable()) throw new java.lang.UnsupportedOperationException(); + this.fP = pP; + } + + @Override + public String patternName() { + return "hu.bme.mit.inf.dslreasoner.domains.alloyexamples.unsat_loopInInheritance"; + } + + @Override + public List parameterNames() { + return Unsat_loopInInheritance.Match.parameterNames; + } + + @Override + public Object[] toArray() { + return new Object[]{fP}; + } + + @Override + public Unsat_loopInInheritance.Match toImmutable() { + return isMutable() ? newMatch(fP) : this; + } + + @Override + public String prettyPrint() { + StringBuilder result = new StringBuilder(); + result.append("\"p\"=" + prettyPrintValue(fP)); + return result.toString(); + } + + @Override + public int hashCode() { + return Objects.hash(fP); + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) + return true; + if (obj == null) { + return false; + } + if ((obj instanceof Unsat_loopInInheritance.Match)) { + Unsat_loopInInheritance.Match other = (Unsat_loopInInheritance.Match) obj; + return Objects.equals(fP, other.fP); + } else { + // this should be infrequent + if (!(obj instanceof IPatternMatch)) { + return false; + } + IPatternMatch otherSig = (IPatternMatch) obj; + return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); + } + } + + @Override + public Unsat_loopInInheritance specification() { + return Unsat_loopInInheritance.instance(); + } + + /** + * Returns an empty, mutable match. + * Fields of the mutable match can be filled to create a partial match, usable as matcher input. + * + * @return the empty match. + * + */ + public static Unsat_loopInInheritance.Match newEmptyMatch() { + return new Mutable(null); + } + + /** + * Returns a mutable (partial) match. + * Fields of the mutable match can be filled to create a partial match, usable as matcher input. + * + * @param pP the fixed value of pattern parameter p, or null if not bound. + * @return the new, mutable (partial) match object. + * + */ + public static Unsat_loopInInheritance.Match newMutableMatch(final EPackage pP) { + return new Mutable(pP); + } + + /** + * Returns a new (partial) match. + * This can be used e.g. to call the matcher with a partial match. + *

    The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. + * @param pP the fixed value of pattern parameter p, or null if not bound. + * @return the (partial) match object. + * + */ + public static Unsat_loopInInheritance.Match newMatch(final EPackage pP) { + return new Immutable(pP); + } + + private static final class Mutable extends Unsat_loopInInheritance.Match { + Mutable(final EPackage pP) { + super(pP); + } + + @Override + public boolean isMutable() { + return true; + } + } + + private static final class Immutable extends Unsat_loopInInheritance.Match { + Immutable(final EPackage pP) { + super(pP); + } + + @Override + public boolean isMutable() { + return false; + } + } + } + + /** + * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.alloyexamples.unsat_loopInInheritance pattern, + * providing pattern-specific query methods. + * + *

    Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, + * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. + * + *

    Matches of the pattern will be represented as {@link Match}. + * + *

    Original source: + *

    +   * {@literal @}Constraint(key={p}, severity="error", message="error")
    +   * pattern unsat_loopInInheritance(p: EPackage) {
    +   * 	neg find unsat_subpackage(_, p);
    +   * 	neg find loopInInheritence(_);
    +   * }
    +   * 
    + * + * @see Match + * @see Unsat_loopInInheritance + * + */ + public static class Matcher extends BaseMatcher { + /** + * Initializes the pattern matcher within an existing VIATRA Query engine. + * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. + * + * @param engine the existing VIATRA Query engine in which this matcher will be created. + * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation + * + */ + public static Unsat_loopInInheritance.Matcher on(final ViatraQueryEngine engine) { + // check if matcher already exists + Matcher matcher = engine.getExistingMatcher(querySpecification()); + if (matcher == null) { + matcher = (Matcher)engine.getMatcher(querySpecification()); + } + return matcher; + } + + /** + * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation + * @return an initialized matcher + * @noreference This method is for internal matcher initialization by the framework, do not call it manually. + * + */ + public static Unsat_loopInInheritance.Matcher create() { + return new Matcher(); + } + + private static final int POSITION_P = 0; + + private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(Unsat_loopInInheritance.Matcher.class); + + /** + * Initializes the pattern matcher within an existing VIATRA Query engine. + * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. + * + * @param engine the existing VIATRA Query engine in which this matcher will be created. + * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation + * + */ + private Matcher() { + super(querySpecification()); + } + + /** + * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. + * @param pP the fixed value of pattern parameter p, or null if not bound. + * @return matches represented as a Match object. + * + */ + public Collection getAllMatches(final EPackage pP) { + return rawStreamAllMatches(new Object[]{pP}).collect(Collectors.toSet()); + } + + /** + * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. + *

    + * NOTE: It is important not to modify the source model while the stream is being processed. + * If the match set of the pattern changes during processing, the contents of the stream is undefined. + * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. + * @param pP the fixed value of pattern parameter p, or null if not bound. + * @return a stream of matches represented as a Match object. + * + */ + public Stream streamAllMatches(final EPackage pP) { + return rawStreamAllMatches(new Object[]{pP}); + } + + /** + * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. + * Neither determinism nor randomness of selection is guaranteed. + * @param pP the fixed value of pattern parameter p, or null if not bound. + * @return a match represented as a Match object, or null if no match is found. + * + */ + public Optional getOneArbitraryMatch(final EPackage pP) { + return rawGetOneArbitraryMatch(new Object[]{pP}); + } + + /** + * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, + * under any possible substitution of the unspecified parameters (if any). + * @param pP the fixed value of pattern parameter p, or null if not bound. + * @return true if the input is a valid (partial) match of the pattern. + * + */ + public boolean hasMatch(final EPackage pP) { + return rawHasMatch(new Object[]{pP}); + } + + /** + * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. + * @param pP the fixed value of pattern parameter p, or null if not bound. + * @return the number of pattern matches found. + * + */ + public int countMatches(final EPackage pP) { + return rawCountMatches(new Object[]{pP}); + } + + /** + * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. + * Neither determinism nor randomness of selection is guaranteed. + * @param pP the fixed value of pattern parameter p, or null if not bound. + * @param processor the action that will process the selected match. + * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked + * + */ + public boolean forOneArbitraryMatch(final EPackage pP, final Consumer processor) { + return rawForOneArbitraryMatch(new Object[]{pP}, processor); + } + + /** + * Returns a new (partial) match. + * This can be used e.g. to call the matcher with a partial match. + *

    The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. + * @param pP the fixed value of pattern parameter p, or null if not bound. + * @return the (partial) match object. + * + */ + public Unsat_loopInInheritance.Match newMatch(final EPackage pP) { + return Unsat_loopInInheritance.Match.newMatch(pP); + } + + /** + * Retrieve the set of values that occur in matches for p. + * @return the Set of all values or empty set if there are no matches + * + */ + protected Stream rawStreamAllValuesOfp(final Object[] parameters) { + return rawStreamAllValues(POSITION_P, parameters).map(EPackage.class::cast); + } + + /** + * Retrieve the set of values that occur in matches for p. + * @return the Set of all values or empty set if there are no matches + * + */ + public Set getAllValuesOfp() { + return rawStreamAllValuesOfp(emptyArray()).collect(Collectors.toSet()); + } + + /** + * Retrieve the set of values that occur in matches for p. + * @return the Set of all values or empty set if there are no matches + * + */ + public Stream streamAllValuesOfp() { + return rawStreamAllValuesOfp(emptyArray()); + } + + @Override + protected Unsat_loopInInheritance.Match tupleToMatch(final Tuple t) { + try { + return Unsat_loopInInheritance.Match.newMatch((EPackage) t.get(POSITION_P)); + } catch(ClassCastException e) { + LOGGER.error("Element(s) in tuple not properly typed!",e); + return null; + } + } + + @Override + protected Unsat_loopInInheritance.Match arrayToMatch(final Object[] match) { + try { + return Unsat_loopInInheritance.Match.newMatch((EPackage) match[POSITION_P]); + } catch(ClassCastException e) { + LOGGER.error("Element(s) in array not properly typed!",e); + return null; + } + } + + @Override + protected Unsat_loopInInheritance.Match arrayToMatchMutable(final Object[] match) { + try { + return Unsat_loopInInheritance.Match.newMutableMatch((EPackage) match[POSITION_P]); + } catch(ClassCastException e) { + LOGGER.error("Element(s) in array not properly typed!",e); + return null; + } + } + + /** + * @return the singleton instance of the query specification of this pattern + * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded + * + */ + public static IQuerySpecification querySpecification() { + return Unsat_loopInInheritance.instance(); + } + } + + private Unsat_loopInInheritance() { + super(GeneratedPQuery.INSTANCE); + } + + /** + * @return the singleton instance of the query specification + * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded + * + */ + public static Unsat_loopInInheritance instance() { + try{ + return LazyHolder.INSTANCE; + } catch (ExceptionInInitializerError err) { + throw processInitializerError(err); + } + } + + @Override + protected Unsat_loopInInheritance.Matcher instantiate(final ViatraQueryEngine engine) { + return Unsat_loopInInheritance.Matcher.on(engine); + } + + @Override + public Unsat_loopInInheritance.Matcher instantiate() { + return Unsat_loopInInheritance.Matcher.create(); + } + + @Override + public Unsat_loopInInheritance.Match newEmptyMatch() { + return Unsat_loopInInheritance.Match.newEmptyMatch(); + } + + @Override + public Unsat_loopInInheritance.Match newMatch(final Object... parameters) { + return Unsat_loopInInheritance.Match.newMatch((org.eclipse.emf.ecore.EPackage) parameters[0]); + } + + /** + * Inner class allowing the singleton instance of {@link Unsat_loopInInheritance} to be created + * not at the class load time of the outer class, + * but rather at the first call to {@link Unsat_loopInInheritance#instance()}. + * + *

    This workaround is required e.g. to support recursion. + * + */ + private static class LazyHolder { + private static final Unsat_loopInInheritance INSTANCE = new Unsat_loopInInheritance(); + + /** + * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. + * This initialization order is required to support indirect recursion. + * + *

    The static initializer is defined using a helper field to work around limitations of the code generator. + * + */ + private static final Object STATIC_INITIALIZER = ensureInitialized(); + + public static Object ensureInitialized() { + INSTANCE.ensureInitializedInternal(); + return null; + } + } + + private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { + private static final Unsat_loopInInheritance.GeneratedPQuery INSTANCE = new GeneratedPQuery(); + + 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); + + private final List parameters = Arrays.asList(parameter_p); + + private GeneratedPQuery() { + super(PVisibility.PUBLIC); + } + + @Override + public String getFullyQualifiedName() { + return "hu.bme.mit.inf.dslreasoner.domains.alloyexamples.unsat_loopInInheritance"; + } + + @Override + public List getParameterNames() { + return Arrays.asList("p"); + } + + @Override + public List getParameters() { + return parameters; + } + + @Override + public Set doGetContainedBodies() { + setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); + Set bodies = new LinkedHashSet<>(); + { + PBody body = new PBody(this); + PVariable var_p = body.getOrCreateVariableByName("p"); + PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); + PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); + new TypeConstraint(body, Tuples.flatTupleOf(var_p), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EPackage"))); + body.setSymbolicParameters(Arrays.asList( + new ExportedParameter(body, var_p, parameter_p) + )); + // neg find unsat_subpackage(_, p) + new NegativePatternCall(body, Tuples.flatTupleOf(var___0_, var_p), Unsat_subpackage.instance().getInternalQueryRepresentation()); + // neg find loopInInheritence(_) + new NegativePatternCall(body, Tuples.flatTupleOf(var___1_), LoopInInheritence.instance().getInternalQueryRepresentation()); + bodies.add(body); + } + { + PAnnotation annotation = new PAnnotation("Constraint"); + annotation.addAttribute("key", Arrays.asList(new Object[] { + new ParameterReference("p") + })); + annotation.addAttribute("severity", "error"); + annotation.addAttribute("message", "error"); + addAnnotation(annotation); + } + return bodies; + } + } +} 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 @@ +/** + * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/patterns/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Ecore.vql + */ +package hu.bme.mit.inf.dslreasoner.domains.alloyexamples; + +import java.util.Arrays; +import java.util.Collection; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.function.Consumer; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import org.apache.log4j.Logger; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.viatra.query.runtime.api.IPatternMatch; +import org.eclipse.viatra.query.runtime.api.IQuerySpecification; +import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; +import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; +import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; +import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; +import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; +import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; +import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; +import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; +import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; +import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; +import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; +import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; +import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; +import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; +import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; +import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; +import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; +import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; +import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; + +/** + * A pattern-specific query specification that can instantiate Matcher in a type-safe way. + * + *

    Original source: + *

    + *         pattern unsat_subpackage(a: EPackage, b: EPackage) {
    + *         	EPackage.eSubpackages(a, b);
    + *         }
    + * 
    + * + * @see Matcher + * @see Match + * + */ +@SuppressWarnings("all") +public final class Unsat_subpackage extends BaseGeneratedEMFQuerySpecification { + /** + * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.alloyexamples.unsat_subpackage pattern, + * to be used in conjunction with {@link Matcher}. + * + *

    Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. + * Each instance is a (possibly partial) substitution of pattern parameters, + * usable to represent a match of the pattern in the result of a query, + * or to specify the bound (fixed) input parameters when issuing a query. + * + * @see Matcher + * + */ + public static abstract class Match extends BasePatternMatch { + private EPackage fA; + + private EPackage fB; + + private static List parameterNames = makeImmutableList("a", "b"); + + private Match(final EPackage pA, final EPackage pB) { + this.fA = pA; + this.fB = pB; + } + + @Override + public Object get(final String parameterName) { + switch(parameterName) { + case "a": return this.fA; + case "b": return this.fB; + default: return null; + } + } + + @Override + public Object get(final int index) { + switch(index) { + case 0: return this.fA; + case 1: return this.fB; + default: return null; + } + } + + public EPackage getA() { + return this.fA; + } + + public EPackage getB() { + return this.fB; + } + + @Override + public boolean set(final String parameterName, final Object newValue) { + if (!isMutable()) throw new java.lang.UnsupportedOperationException(); + if ("a".equals(parameterName) ) { + this.fA = (EPackage) newValue; + return true; + } + if ("b".equals(parameterName) ) { + this.fB = (EPackage) newValue; + return true; + } + return false; + } + + public void setA(final EPackage pA) { + if (!isMutable()) throw new java.lang.UnsupportedOperationException(); + this.fA = pA; + } + + public void setB(final EPackage pB) { + if (!isMutable()) throw new java.lang.UnsupportedOperationException(); + this.fB = pB; + } + + @Override + public String patternName() { + return "hu.bme.mit.inf.dslreasoner.domains.alloyexamples.unsat_subpackage"; + } + + @Override + public List parameterNames() { + return Unsat_subpackage.Match.parameterNames; + } + + @Override + public Object[] toArray() { + return new Object[]{fA, fB}; + } + + @Override + public Unsat_subpackage.Match toImmutable() { + return isMutable() ? newMatch(fA, fB) : this; + } + + @Override + public String prettyPrint() { + StringBuilder result = new StringBuilder(); + result.append("\"a\"=" + prettyPrintValue(fA) + ", "); + result.append("\"b\"=" + prettyPrintValue(fB)); + return result.toString(); + } + + @Override + public int hashCode() { + return Objects.hash(fA, fB); + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) + return true; + if (obj == null) { + return false; + } + if ((obj instanceof Unsat_subpackage.Match)) { + Unsat_subpackage.Match other = (Unsat_subpackage.Match) obj; + return Objects.equals(fA, other.fA) && Objects.equals(fB, other.fB); + } else { + // this should be infrequent + if (!(obj instanceof IPatternMatch)) { + return false; + } + IPatternMatch otherSig = (IPatternMatch) obj; + return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); + } + } + + @Override + public Unsat_subpackage specification() { + return Unsat_subpackage.instance(); + } + + /** + * Returns an empty, mutable match. + * Fields of the mutable match can be filled to create a partial match, usable as matcher input. + * + * @return the empty match. + * + */ + public static Unsat_subpackage.Match newEmptyMatch() { + return new Mutable(null, null); + } + + /** + * Returns a mutable (partial) match. + * Fields of the mutable match can be filled to create a partial match, usable as matcher input. + * + * @param pA the fixed value of pattern parameter a, or null if not bound. + * @param pB the fixed value of pattern parameter b, or null if not bound. + * @return the new, mutable (partial) match object. + * + */ + public static Unsat_subpackage.Match newMutableMatch(final EPackage pA, final EPackage pB) { + return new Mutable(pA, pB); + } + + /** + * Returns a new (partial) match. + * This can be used e.g. to call the matcher with a partial match. + *

    The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. + * @param pA the fixed value of pattern parameter a, or null if not bound. + * @param pB the fixed value of pattern parameter b, or null if not bound. + * @return the (partial) match object. + * + */ + public static Unsat_subpackage.Match newMatch(final EPackage pA, final EPackage pB) { + return new Immutable(pA, pB); + } + + private static final class Mutable extends Unsat_subpackage.Match { + Mutable(final EPackage pA, final EPackage pB) { + super(pA, pB); + } + + @Override + public boolean isMutable() { + return true; + } + } + + private static final class Immutable extends Unsat_subpackage.Match { + Immutable(final EPackage pA, final EPackage pB) { + super(pA, pB); + } + + @Override + public boolean isMutable() { + return false; + } + } + } + + /** + * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.alloyexamples.unsat_subpackage pattern, + * providing pattern-specific query methods. + * + *

    Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, + * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. + * + *

    Matches of the pattern will be represented as {@link Match}. + * + *

    Original source: + *

    +   * pattern unsat_subpackage(a: EPackage, b: EPackage) {
    +   * 	EPackage.eSubpackages(a, b);
    +   * }
    +   * 
    + * + * @see Match + * @see Unsat_subpackage + * + */ + public static class Matcher extends BaseMatcher { + /** + * Initializes the pattern matcher within an existing VIATRA Query engine. + * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. + * + * @param engine the existing VIATRA Query engine in which this matcher will be created. + * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation + * + */ + public static Unsat_subpackage.Matcher on(final ViatraQueryEngine engine) { + // check if matcher already exists + Matcher matcher = engine.getExistingMatcher(querySpecification()); + if (matcher == null) { + matcher = (Matcher)engine.getMatcher(querySpecification()); + } + return matcher; + } + + /** + * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation + * @return an initialized matcher + * @noreference This method is for internal matcher initialization by the framework, do not call it manually. + * + */ + public static Unsat_subpackage.Matcher create() { + return new Matcher(); + } + + private static final int POSITION_A = 0; + + private static final int POSITION_B = 1; + + private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(Unsat_subpackage.Matcher.class); + + /** + * Initializes the pattern matcher within an existing VIATRA Query engine. + * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. + * + * @param engine the existing VIATRA Query engine in which this matcher will be created. + * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation + * + */ + private Matcher() { + super(querySpecification()); + } + + /** + * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. + * @param pA the fixed value of pattern parameter a, or null if not bound. + * @param pB the fixed value of pattern parameter b, or null if not bound. + * @return matches represented as a Match object. + * + */ + public Collection getAllMatches(final EPackage pA, final EPackage pB) { + return rawStreamAllMatches(new Object[]{pA, pB}).collect(Collectors.toSet()); + } + + /** + * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. + *

    + * NOTE: It is important not to modify the source model while the stream is being processed. + * If the match set of the pattern changes during processing, the contents of the stream is undefined. + * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. + * @param pA the fixed value of pattern parameter a, or null if not bound. + * @param pB the fixed value of pattern parameter b, or null if not bound. + * @return a stream of matches represented as a Match object. + * + */ + public Stream streamAllMatches(final EPackage pA, final EPackage pB) { + return rawStreamAllMatches(new Object[]{pA, pB}); + } + + /** + * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. + * Neither determinism nor randomness of selection is guaranteed. + * @param pA the fixed value of pattern parameter a, or null if not bound. + * @param pB the fixed value of pattern parameter b, or null if not bound. + * @return a match represented as a Match object, or null if no match is found. + * + */ + public Optional getOneArbitraryMatch(final EPackage pA, final EPackage pB) { + return rawGetOneArbitraryMatch(new Object[]{pA, pB}); + } + + /** + * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, + * under any possible substitution of the unspecified parameters (if any). + * @param pA the fixed value of pattern parameter a, or null if not bound. + * @param pB the fixed value of pattern parameter b, or null if not bound. + * @return true if the input is a valid (partial) match of the pattern. + * + */ + public boolean hasMatch(final EPackage pA, final EPackage pB) { + return rawHasMatch(new Object[]{pA, pB}); + } + + /** + * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. + * @param pA the fixed value of pattern parameter a, or null if not bound. + * @param pB the fixed value of pattern parameter b, or null if not bound. + * @return the number of pattern matches found. + * + */ + public int countMatches(final EPackage pA, final EPackage pB) { + return rawCountMatches(new Object[]{pA, pB}); + } + + /** + * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. + * Neither determinism nor randomness of selection is guaranteed. + * @param pA the fixed value of pattern parameter a, or null if not bound. + * @param pB the fixed value of pattern parameter b, or null if not bound. + * @param processor the action that will process the selected match. + * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked + * + */ + public boolean forOneArbitraryMatch(final EPackage pA, final EPackage pB, final Consumer processor) { + return rawForOneArbitraryMatch(new Object[]{pA, pB}, processor); + } + + /** + * Returns a new (partial) match. + * This can be used e.g. to call the matcher with a partial match. + *

    The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. + * @param pA the fixed value of pattern parameter a, or null if not bound. + * @param pB the fixed value of pattern parameter b, or null if not bound. + * @return the (partial) match object. + * + */ + public Unsat_subpackage.Match newMatch(final EPackage pA, final EPackage pB) { + return Unsat_subpackage.Match.newMatch(pA, pB); + } + + /** + * Retrieve the set of values that occur in matches for a. + * @return the Set of all values or empty set if there are no matches + * + */ + protected Stream rawStreamAllValuesOfa(final Object[] parameters) { + return rawStreamAllValues(POSITION_A, parameters).map(EPackage.class::cast); + } + + /** + * Retrieve the set of values that occur in matches for a. + * @return the Set of all values or empty set if there are no matches + * + */ + public Set getAllValuesOfa() { + return rawStreamAllValuesOfa(emptyArray()).collect(Collectors.toSet()); + } + + /** + * Retrieve the set of values that occur in matches for a. + * @return the Set of all values or empty set if there are no matches + * + */ + public Stream streamAllValuesOfa() { + return rawStreamAllValuesOfa(emptyArray()); + } + + /** + * Retrieve the set of values that occur in matches for a. + *

    + * NOTE: It is important not to modify the source model while the stream is being processed. + * If the match set of the pattern changes during processing, the contents of the stream is undefined. + * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. + * + * @return the Stream of all values or empty set if there are no matches + * + */ + public Stream streamAllValuesOfa(final Unsat_subpackage.Match partialMatch) { + return rawStreamAllValuesOfa(partialMatch.toArray()); + } + + /** + * Retrieve the set of values that occur in matches for a. + *

    + * NOTE: It is important not to modify the source model while the stream is being processed. + * If the match set of the pattern changes during processing, the contents of the stream is undefined. + * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. + * + * @return the Stream of all values or empty set if there are no matches + * + */ + public Stream streamAllValuesOfa(final EPackage pB) { + return rawStreamAllValuesOfa(new Object[]{null, pB}); + } + + /** + * Retrieve the set of values that occur in matches for a. + * @return the Set of all values or empty set if there are no matches + * + */ + public Set getAllValuesOfa(final Unsat_subpackage.Match partialMatch) { + return rawStreamAllValuesOfa(partialMatch.toArray()).collect(Collectors.toSet()); + } + + /** + * Retrieve the set of values that occur in matches for a. + * @return the Set of all values or empty set if there are no matches + * + */ + public Set getAllValuesOfa(final EPackage pB) { + return rawStreamAllValuesOfa(new Object[]{null, pB}).collect(Collectors.toSet()); + } + + /** + * Retrieve the set of values that occur in matches for b. + * @return the Set of all values or empty set if there are no matches + * + */ + protected Stream rawStreamAllValuesOfb(final Object[] parameters) { + return rawStreamAllValues(POSITION_B, parameters).map(EPackage.class::cast); + } + + /** + * Retrieve the set of values that occur in matches for b. + * @return the Set of all values or empty set if there are no matches + * + */ + public Set getAllValuesOfb() { + return rawStreamAllValuesOfb(emptyArray()).collect(Collectors.toSet()); + } + + /** + * Retrieve the set of values that occur in matches for b. + * @return the Set of all values or empty set if there are no matches + * + */ + public Stream streamAllValuesOfb() { + return rawStreamAllValuesOfb(emptyArray()); + } + + /** + * Retrieve the set of values that occur in matches for b. + *

    + * NOTE: It is important not to modify the source model while the stream is being processed. + * If the match set of the pattern changes during processing, the contents of the stream is undefined. + * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. + * + * @return the Stream of all values or empty set if there are no matches + * + */ + public Stream streamAllValuesOfb(final Unsat_subpackage.Match partialMatch) { + return rawStreamAllValuesOfb(partialMatch.toArray()); + } + + /** + * Retrieve the set of values that occur in matches for b. + *

    + * NOTE: It is important not to modify the source model while the stream is being processed. + * If the match set of the pattern changes during processing, the contents of the stream is undefined. + * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. + * + * @return the Stream of all values or empty set if there are no matches + * + */ + public Stream streamAllValuesOfb(final EPackage pA) { + return rawStreamAllValuesOfb(new Object[]{pA, null}); + } + + /** + * Retrieve the set of values that occur in matches for b. + * @return the Set of all values or empty set if there are no matches + * + */ + public Set getAllValuesOfb(final Unsat_subpackage.Match partialMatch) { + return rawStreamAllValuesOfb(partialMatch.toArray()).collect(Collectors.toSet()); + } + + /** + * Retrieve the set of values that occur in matches for b. + * @return the Set of all values or empty set if there are no matches + * + */ + public Set getAllValuesOfb(final EPackage pA) { + return rawStreamAllValuesOfb(new Object[]{pA, null}).collect(Collectors.toSet()); + } + + @Override + protected Unsat_subpackage.Match tupleToMatch(final Tuple t) { + try { + return Unsat_subpackage.Match.newMatch((EPackage) t.get(POSITION_A), (EPackage) t.get(POSITION_B)); + } catch(ClassCastException e) { + LOGGER.error("Element(s) in tuple not properly typed!",e); + return null; + } + } + + @Override + protected Unsat_subpackage.Match arrayToMatch(final Object[] match) { + try { + return Unsat_subpackage.Match.newMatch((EPackage) match[POSITION_A], (EPackage) match[POSITION_B]); + } catch(ClassCastException e) { + LOGGER.error("Element(s) in array not properly typed!",e); + return null; + } + } + + @Override + protected Unsat_subpackage.Match arrayToMatchMutable(final Object[] match) { + try { + return Unsat_subpackage.Match.newMutableMatch((EPackage) match[POSITION_A], (EPackage) match[POSITION_B]); + } catch(ClassCastException e) { + LOGGER.error("Element(s) in array not properly typed!",e); + return null; + } + } + + /** + * @return the singleton instance of the query specification of this pattern + * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded + * + */ + public static IQuerySpecification querySpecification() { + return Unsat_subpackage.instance(); + } + } + + private Unsat_subpackage() { + super(GeneratedPQuery.INSTANCE); + } + + /** + * @return the singleton instance of the query specification + * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded + * + */ + public static Unsat_subpackage instance() { + try{ + return LazyHolder.INSTANCE; + } catch (ExceptionInInitializerError err) { + throw processInitializerError(err); + } + } + + @Override + protected Unsat_subpackage.Matcher instantiate(final ViatraQueryEngine engine) { + return Unsat_subpackage.Matcher.on(engine); + } + + @Override + public Unsat_subpackage.Matcher instantiate() { + return Unsat_subpackage.Matcher.create(); + } + + @Override + public Unsat_subpackage.Match newEmptyMatch() { + return Unsat_subpackage.Match.newEmptyMatch(); + } + + @Override + public Unsat_subpackage.Match newMatch(final Object... parameters) { + return Unsat_subpackage.Match.newMatch((org.eclipse.emf.ecore.EPackage) parameters[0], (org.eclipse.emf.ecore.EPackage) parameters[1]); + } + + /** + * Inner class allowing the singleton instance of {@link Unsat_subpackage} to be created + * not at the class load time of the outer class, + * but rather at the first call to {@link Unsat_subpackage#instance()}. + * + *

    This workaround is required e.g. to support recursion. + * + */ + private static class LazyHolder { + private static final Unsat_subpackage INSTANCE = new Unsat_subpackage(); + + /** + * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. + * This initialization order is required to support indirect recursion. + * + *

    The static initializer is defined using a helper field to work around limitations of the code generator. + * + */ + private static final Object STATIC_INITIALIZER = ensureInitialized(); + + public static Object ensureInitialized() { + INSTANCE.ensureInitializedInternal(); + return null; + } + } + + private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { + private static final Unsat_subpackage.GeneratedPQuery INSTANCE = new GeneratedPQuery(); + + 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); + + 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); + + private final List parameters = Arrays.asList(parameter_a, parameter_b); + + private GeneratedPQuery() { + super(PVisibility.PUBLIC); + } + + @Override + public String getFullyQualifiedName() { + return "hu.bme.mit.inf.dslreasoner.domains.alloyexamples.unsat_subpackage"; + } + + @Override + public List getParameterNames() { + return Arrays.asList("a","b"); + } + + @Override + public List getParameters() { + return parameters; + } + + @Override + public Set doGetContainedBodies() { + setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); + Set bodies = new LinkedHashSet<>(); + { + PBody body = new PBody(this); + PVariable var_a = body.getOrCreateVariableByName("a"); + PVariable var_b = body.getOrCreateVariableByName("b"); + new TypeConstraint(body, Tuples.flatTupleOf(var_a), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EPackage"))); + new TypeConstraint(body, Tuples.flatTupleOf(var_b), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EPackage"))); + body.setSymbolicParameters(Arrays.asList( + new ExportedParameter(body, var_a, parameter_a), + new ExportedParameter(body, var_b, parameter_b) + )); + // EPackage.eSubpackages(a, b) + new TypeConstraint(body, Tuples.flatTupleOf(var_a), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EPackage"))); + PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); + new TypeConstraint(body, Tuples.flatTupleOf(var_a, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.eclipse.org/emf/2002/Ecore", "EPackage", "eSubpackages"))); + new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EPackage"))); + new Equality(body, var__virtual_0_, var_b); + bodies.add(body); + } + return bodies; + } + } +} 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 @@ +/.EcoreAll.java._trace +/.SubpackageOrSelf.java._trace +/.Subpackage.java._trace +/.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 @@ - - - - + + + + @@ -11,6 +14,7 @@ + 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) { neg find indirectCommunicationLink(Spacecraft, GroundStation); } +//@Constraint(severity = "error", key = {Spacecraft}, message = "UNSAT") +//pattern unsat_linkToGroundStation(Spacecraft : Spacecraft) { +// ConstellationMission.groundStationNetwork(Mission, GroundStation); +// ConstellationMission.spacecraft(Mission, Spacecraft); +// find indirectCommunicationLink(Spacecraft, GroundStation); +//} + +@Constraint(severity = "error", key = {Mission}, message = "UNSAT") +pattern unsat_linkToGroundStation(Mission : InterferometryMission) { + InterferometryMission(Mission); + neg find noLinkToGroundStation(_); +} + @Constraint(severity = "error", key = {Spacecraft}, message = "Spacecraft has no potential communication path to the ground station.") 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 @@ + 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) { e1 != e2; } +@Constraint(severity="error", message="error", key = {sct}) +pattern unsat_multipleEntryInRegion(sct : Statechart) { + Statechart(sct); + neg find multipleEntryInRegion(_); +} + pattern transition(t : Transition, src : Vertex, trg : Vertex) { Transition.source(t, src); Transition.target(t, trg); @@ -197,6 +203,11 @@ pattern SynchronizedRegionDoesNotHaveMultipleRegions(s : Synchronization, v : Ve neg find hasMultipleRegions(c); } +//@Constraint(severity="error", message="error", key = {sct}) +//pattern unsat_SynchronizedRegionDoesNotHaveMultipleRegions(sct : Statechart) { +// Statechart(sct); +// neg find SynchronizedRegionDoesNotHaveMultipleRegions(_, _); +//} pattern hasMultipleRegions(composite: CompositeElement) { 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 @@ - - - - - - - - - - - + + + + + + + + + + + + + + + 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, org.eclipse.viatra.query.runtime.base.itc;bundle-version="1.3.0", hu.bme.mit.inf.dslreasoner.ecore2logic;bundle-version="1.0.0", org.eclipse.viatra.query.runtime;bundle-version="2.0.0" -Import-Package: org.apache.log4j;version="1.2.15" -Automatic-Module-Name: hu.bme.mit.inf.dlsreasoner.alloy.reasoner -Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-ActivationPolicy: lazy +Bundle-NativeCode: libminisat.so;osname=Linux;processor=x86_64 +Automatic-Module-Name: hu.bme.mit.inf.dlsreasoner.alloy.reasoner +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 exten override doCreateActivationCode(IPatternMatch match) { val size = match.specification.parameters.size val res = new ArrayList(size) - var int index = 0 var int equivalenceHash = 0 val prime = 31 - while (index < size) { - res.add(getCode(match.get(index))) - index++ + for (var int index = 0; index < size; index++) { + val matchArgument = match.get(index) + res.add(getCode(matchArgument)) for (var i = 0; i < index; i++) { - val number = if (match.get(index) === match.get(i)) { + val number = if (matchArgument === match.get(i)) { 1 } else { 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 { */ public var SearchSpaceConstraint searchSpaceConstraints = new SearchSpaceConstraint - public var ScopePropagatorStrategy scopePropagatorStrategy = new ScopePropagatorStrategy.Polyhedral( + public var ScopePropagatorStrategy scopePropagatorStrategy = ScopePropagatorStrategy.Polyhedral( PolyhedralScopePropagatorConstraints.Relational, PolyhedralScopePropagatorSolver.Clp) public var List 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 @@ -{ - "inputPath": "initialModels", - "outputPath": "outputModels", - "timeout": 1200, - "saveModels": true, - "warmupIterations": 0, - "iterations": 5, - "domain": "FAM", - "scope": "none", - "sizes": [500], - "solver": "ViatraSolver", - "scopePropagator": "polyhedral", - "propagatedConstraints": "hints", - "polyhedronSolver": "Clp", - "scopeHeuristics": "polyhedral" -} 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 @@ +{ + "inputPath": "initialModels", + "outputPath": "outputModels", + "timeout": 300, + "saveModels": true, + "saveTemporaryFiles": false, + "warmupIterations": 0, + "iterations": 30, + "domain": "Yakindu", + "scope": "unsat", + "sizes": [20], + "solver": "AlloySolver" +} 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 @@ -{ - "inputPath": "initialModels", - "outputPath": "outputModels", - "timeout": 1200, - "saveModels": false, - "saveTemporaryFiles": true, - "warmupIterations": 0, - "iterations": 5, - "domain": "Yakindu", - "scope": "none", - "sizes": [100], - "solver": "ViatraSolver", - "scopePropagator": "polyhedral", - "propagatedConstraints": "hints", - "polyhedronSolver": "Clp", - "scopeHeuristic": "polyhedral" -} diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/configs/ecore.json b/Tests/hu.bme.mit.inf.dslreasoner.run/configs/ecore.json new file mode 100644 index 00000000..36fb0ea2 --- /dev/null +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/configs/ecore.json @@ -0,0 +1,17 @@ +{ + "inputPath": "initialModels", + "outputPath": "outputModels", + "timeout": 300, + "saveModels": true, + "saveTemporaryFiles": false, + "warmupIterations": 0, + "iterations": 1, + "domain": "ecoreUnsat", + "scope": "none", + "sizes": [5, 10, 20, 30, 40, 50], + "solver": "ViatraSolver", + "scopePropagator": "polyhedral", + "propagatedConstraints": "hints", + "polyhedronSolver": "Clp", + "scopeHeuristic": "polyhedral" +} 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/ecore_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json deleted file mode 100644 index 72e97957..00000000 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/configs/ecore_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "inputPath": "initialModels", - "outputPath": "outputModels", - "timeout": 1200, - "saveModels": true, - "warmupIterations": 0, - "iterations": 5, - "domain": "ecore", - "scope": "quantiles", - "sizes": [50], - "solver": "ViatraSolver", - "scopePropagator": "polyhedral", - "propagatedConstraints": "hints", - "polyhedronSolver": "Clp", - "scopeHeuristic": "polyhedral" -} 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/fs_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json deleted file mode 100644 index a7e29a22..00000000 --- a/Tests/hu.bme.mit.inf.dslreasoner.run/configs/fs_useful_ViatraSolver_polyhedral_typeHierarchy_Clp.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "inputPath": "initialModels", - "outputPath": "outputModels", - "timeout": 1200, - "saveModels": true, - "warmupIterations": 1, - "iterations": 1, - "domain": "fs", - "scope": "none", - "sizes": [50, 100, 150, 200, 250, 300, 350, 400, 450, 500], - "solver": "ViatraSolver", - "scopePropagator": "polyhedral", - "propagatedConstraints": "hints", - "polyhedronSolver": "Clp", - "scopeHeuristic": "polyhedral" -} diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/configs/satellite.json b/Tests/hu.bme.mit.inf.dslreasoner.run/configs/satellite.json new file mode 100644 index 00000000..16abb5d0 --- /dev/null +++ b/Tests/hu.bme.mit.inf.dslreasoner.run/configs/satellite.json @@ -0,0 +1,17 @@ +{ + "inputPath": "initialModels", + "outputPath": "outputModels", + "timeout": 300, + "saveModels": true, + "saveTemporaryFiles": false, + "warmupIterations": 0, + "iterations": 30, + "domain": "satelliteUnsat", + "scope": "none", + "sizes": [10], + "solver": "ViatraSolver", + "scopePropagator": "polyhedral", + "propagatedConstraints": "hints", + "polyhedronSolver": "Clp", + "scopeHeuristic": "polyhedral" +} 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 @@ -{ - "inputPath": "initialModels", - "outputPath": "outputModels", - "timeout": 120, - "saveModels": true, - "saveTemporaryFiles": true, - "warmupIterations": 0, - "iterations": 1, - "domain": "Yakindu", - "scope": "quantiles", - "sizes": [10, 20, 30, 40, 50, 60, 70, 80, 90, 100], - "solver": "ViatraSolver", - "scopePropagator": "polyhedral", - "propagatedConstraints": "hints", - "polyhedronSolver": "Clp", - "scopeHeuristic": "polyhedral" -} 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 { } abstract class MetamodelLoader { + public static val UNSAT_PREFIX = "unsat_" + protected val ReasonerWorkspace workspace new(ReasonerWorkspace workspace) { @@ -61,6 +63,10 @@ abstract class MetamodelLoader { def Map getTypeQuantiles() { emptyMap } + + def Map getUnsatTypeQuantiles() { + throw new UnsupportedOperationException("This domain has no type quantiles for unsatisfiable problems") + } def List getHints(Ecore2Logic ecore2Logic, Ecore2Logic_Trace trace) { emptyList @@ -136,9 +142,15 @@ class YakinduLoader extends MetamodelLoader { public static val patternsWithComplexStates = #["outgoingFromExit", "outgoingFromFinal", "choiceHasNoOutgoing", "choiceHasNoIncoming"] + val boolean satisfiable + new(ReasonerWorkspace workspace) { + this(workspace, true) + } + + new(ReasonerWorkspace workspace, boolean satisfiable) { super(workspace) - YakindummPackage.eINSTANCE.eClass + this.satisfiable = satisfiable } def setUseSynchronization(boolean useSynchronization) { @@ -173,6 +185,8 @@ class YakinduLoader extends MetamodelLoader { useSynchInThisLoad || !patternsWithSynchronization.exists[spec.fullyQualifiedName.endsWith(it)] ].filter [ spec | useComplexStates || !patternsWithComplexStates.exists[spec.fullyQualifiedName.endsWith(it)] + ].filter [ + !satisfiable || !it.simpleName.startsWith(UNSAT_PREFIX) ].toList val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name == "Constraint"]].toSet val derivedFeatures = new LinkedHashMap @@ -213,6 +227,19 @@ class YakinduLoader extends MetamodelLoader { "Transition" -> new TypeQuantiles(0.581632653061224, 0.645161290322581) } } + + override getUnsatTypeQuantiles() { + #{ + "Choice" -> new TypeQuantiles(0.118279569892473, 0.154020979020979), + "Entry" -> new TypeQuantiles(0.2, 0.4), + "Exit" -> new TypeQuantiles(0, 0), + "FinalState" -> new TypeQuantiles(0, 0), + "Region" -> new TypeQuantiles(0.0294117647058824, 0.0633258678611422), + "State" -> new TypeQuantiles(0.132023636740618, 0.175925925925926), +// "Statechart" -> new TypeQuantiles(0.00961538461538462, 0.010752688172043), + "Transition" -> new TypeQuantiles(0.581632653061224, 0.645161290322581) + } + } override getHints(Ecore2Logic ecore2Logic, Ecore2Logic_Trace trace) { #[new SGraphHint(ecore2Logic, trace)] @@ -276,9 +303,15 @@ class FileSystemLoader extends MetamodelLoader { } class EcoreLoader extends MetamodelLoader { + val boolean satisfiable new(ReasonerWorkspace workspace) { + this(workspace, true) + } + + new(ReasonerWorkspace workspace, boolean satisfiable) { super(workspace) + this.satisfiable = satisfiable } override loadMetamodel() { @@ -307,7 +340,12 @@ class EcoreLoader extends MetamodelLoader { override loadQueries(EcoreMetamodelDescriptor metamodel) { val patternGroup = Ecore.instance val patterns = patternGroup.specifications.toList - val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name == "Constraint"]].toSet + val allWfPatterns = patterns.filter[it.allAnnotations.exists[it.name == "Constraint"]].toSet + val wfPatterns = if (satisfiable) { + allWfPatterns.filter[!it.simpleName.startsWith(UNSAT_PREFIX)].toSet + } else { + allWfPatterns + } val derivedFeatures = new HashMap return new ViatraQuerySetDescriptor( patterns, @@ -346,9 +384,15 @@ class EcoreLoader extends MetamodelLoader { } class SatelliteLoader extends MetamodelLoader { + val boolean satisfiable new(ReasonerWorkspace workspace) { + this(workspace, true) + } + + new(ReasonerWorkspace workspace, boolean satisfiable) { super(workspace) + this.satisfiable = satisfiable } override loadMetamodel() { @@ -371,7 +415,9 @@ class SatelliteLoader extends MetamodelLoader { override loadQueries(EcoreMetamodelDescriptor metamodel) { val i = SatelliteQueriesAll.instance - val patterns = i.specifications.toList + val patterns = i.specifications.filter [ + !satisfiable || !it.simpleName.startsWith(UNSAT_PREFIX) + ].toList val wfPatterns = patterns.filter[it.allAnnotations.exists[it.name == "Constraint"]].toSet val derivedFeatures = new LinkedHashMap val res = new ViatraQuerySetDescriptor( @@ -404,4 +450,15 @@ class SatelliteLoader extends MetamodelLoader { } } + override getUnsatTypeQuantiles() { + #{ + "CubeSat3U" -> new TypeQuantiles(0.1, 0.25), + "CubeSat6U" -> new TypeQuantiles(0.1, 0.25), + "SmallSat" -> new TypeQuantiles(0.1, 0.25), + "UHFCommSubsystem" -> new TypeQuantiles(0.08, 0.1), + "XCommSubsystem" -> new TypeQuantiles(0, 0.1), + "KaCommSubsystem" -> new TypeQuantiles(0, 0.05), + "InterferometryPayload" -> new TypeQuantiles(0.15, 0.25) + } + } } 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 { enum Domain { fs, ecore, + ecoreUnsat, Yakindu, + YakinduUnsat, FAM, - satellite + satellite, + satelliteUnsat } enum Scope { none, - quantiles + quantiles, + upperOnly, + unsat, + exactly } enum Solver { ViatraSolver, - AlloySolver + AlloySolver, + AlloyMiniSat } 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 import org.eclipse.viatra.query.runtime.api.ViatraQueryEngineOptions import org.eclipse.viatra.query.runtime.rete.matcher.ReteBackendFactory import org.eclipse.xtend.lib.annotations.Data +import hu.bme.mit.inf.dlsreasoner.alloy.reasoner.AlloyBackendSolver class MeasurementScriptRunner { static val MODEL_SIZE_GAP = 0 @@ -75,9 +76,12 @@ class MeasurementScriptRunner { metamodelLoader = switch (script.domain) { case fs: new FileSystemLoader(inputWorkspace) case ecore: new EcoreLoader(inputWorkspace) + case ecoreUnsat: new EcoreLoader(inputWorkspace, false) case Yakindu: new YakinduLoader(inputWorkspace) => [useSynchronization = false; useComplexStates = true] + case YakinduUnsat: new YakinduLoader(inputWorkspace, false) => [useSynchronization = false; useComplexStates = true] case FAM: new FAMLoader(inputWorkspace) case satellite: new SatelliteLoader(inputWorkspace) + case satelliteUnsat: new SatelliteLoader(inputWorkspace, false) default: throw new IllegalArgumentException("Unsupported domain: " + script.domain) } } @@ -191,15 +195,17 @@ class MeasurementScriptRunner { config } - private def createAlloyConfig() { + private def createAlloyConfig(AlloyBackendSolver backendSolver) { val config = new AlloySolverConfiguration + config.solver = backendSolver config } private def createConfig(int modelSize) { val config = switch (solver : script.solver) { case ViatraSolver: createViatraConfig() - case AlloySolver: createAlloyConfig() + case AlloySolver: createAlloyConfig(AlloyBackendSolver.SAT4J) + case AlloyMiniSat: createAlloyConfig(AlloyBackendSolver.MiniSatJNI) default: throw new IllegalArgumentException("Unknown solver: " + solver) } config.solutionScope.numberOfRequiredSolutions = 1 @@ -243,7 +249,8 @@ class MeasurementScriptRunner { val solver = switch (solver : script.solver) { case ViatraSolver: new ViatraReasoner - case AlloySolver: new AlloySolver + case AlloySolver, + case AlloyMiniSat: new AlloySolver default: throw new IllegalArgumentException("Unknown solver: " + solver) } val result = solver.solve(problem, config, outputWorkspace) @@ -284,14 +291,31 @@ class MeasurementScriptRunner { } else { val numberOfKnownElements = knownElements.values.flatten.toSet.size val newElementCount = modelSize - numberOfKnownElements - config.typeScopes.minNewElements = newElementCount - config.typeScopes.maxNewElements = newElementCount + MODEL_SIZE_GAP + switch (script.scope) { + case upperOnly: + config.typeScopes.maxNewElements = newElementCount + MODEL_SIZE_GAP + case exactly: { + config.typeScopes.minNewElements = newElementCount + config.typeScopes.maxNewElements = newElementCount + } + default: { + config.typeScopes.minNewElements = newElementCount + config.typeScopes.maxNewElements = newElementCount + MODEL_SIZE_GAP + } + } } - switch (script.scope) { - case none: + switch (scope : script.scope) { + case none, + case exactly: return - case quantiles: { - val quantiles = metamodelLoader.typeQuantiles + case quantiles, + case unsat, + case upperOnly: { + val quantiles = if (scope == Scope.unsat) { + metamodelLoader.unsatTypeQuantiles + } else { + metamodelLoader.typeQuantiles + } for (eClassInScope : eClassMapper.allClassesInScope(trace)) { val quantile = quantiles.get(eClassInScope.name) if (quantile !== null) { @@ -301,7 +325,9 @@ class MeasurementScriptRunner { val lowCount = Math.floor(modelSize * quantile.low) as int val highCount = Math.ceil((modelSize + MODEL_SIZE_GAP) * quantile.high) as int // println('''«type.name» «lowCount» «highCount»''') - config.typeScopes.minNewElementsByType.put(type, Math.max(lowCount - currentCount, 0)) + if (script.scope != Scope.upperOnly) { + config.typeScopes.minNewElementsByType.put(type, Math.max(lowCount - currentCount, 0)) + } config.typeScopes.maxNewElementsByType.put(type, highCount - currentCount) } } -- cgit v1.2.3-54-g00ecf