Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZoltan Ujhelyi2017-09-18 12:01:18 +0000
committerZoltan Ujhelyi2017-09-18 12:01:39 +0000
commit4191165c73f4ddfb7eb436650dd1f76792d1147b (patch)
tree359d8cb812b059deb16c0be1827607f0602b0792
parentd5c11dac49f643fd5dfe785027674dca0481bda7 (diff)
downloadorg.eclipse.viatra.examples-4191165c73f4ddfb7eb436650dd1f76792d1147b.tar.gz
org.eclipse.viatra.examples-4191165c73f4ddfb7eb436650dd1f76792d1147b.tar.xz
org.eclipse.viatra.examples-4191165c73f4ddfb7eb436650dd1f76792d1147b.zip
[469149] Updated transformation type configuration for generic LS
Change-Id: Idf7c82e18ecfa96c8580fda4061bcb7162c22c84 Signed-off-by: Zoltan Ujhelyi <ujhelyiz@incquerylabs.com>
-rw-r--r--cps/tests/org.eclipse.viatra.examples.cps.tests.util/samples/cps2dep_sample.properties4
-rw-r--r--cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.launcher/src/org/eclipse/viatra/examples/cps/xform/m2m/launcher/TransformationType.java84
2 files changed, 40 insertions, 48 deletions
diff --git a/cps/tests/org.eclipse.viatra.examples.cps.tests.util/samples/cps2dep_sample.properties b/cps/tests/org.eclipse.viatra.examples.cps.tests.util/samples/cps2dep_sample.properties
index b2b33da..33953f2 100644
--- a/cps/tests/org.eclipse.viatra.examples.cps.tests.util/samples/cps2dep_sample.properties
+++ b/cps/tests/org.eclipse.viatra.examples.cps.tests.util/samples/cps2dep_sample.properties
@@ -14,7 +14,7 @@ cps.xform.loglevel = INFO
# log level for generator
cps.generator.loglevel = INFO
-# log level for EMF-IncQuery and EVM
+# log level for VIATRA Query and EVM
org.eclipse.viatra.query.loglevel = INFO
# log level for BenchmarkResult
@@ -32,6 +32,8 @@ cps.persist.results = false
# BATCH_OPTIMIZED
# BATCH_VIATRA_QUERY_RETE
# BATCH_VIATRA_QUERY_LOCAL_SEARCH
+# BATCH_VIATRA_QUERY_LOCAL_SEARCH_GENERIC
+# BATCH_VIATRA_QUERY_LOCAL_SEARCH_WO_INDEXER
# BATCH_VIATRA_TRANSFORMATION
# INCR_VIATRA_QUERY_RESULT_TRACEABILITY
# INCR_VIATRA_EXPLICIT_TRACEABILITY
diff --git a/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.launcher/src/org/eclipse/viatra/examples/cps/xform/m2m/launcher/TransformationType.java b/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.launcher/src/org/eclipse/viatra/examples/cps/xform/m2m/launcher/TransformationType.java
index dcfc201..7ff4934 100644
--- a/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.launcher/src/org/eclipse/viatra/examples/cps/xform/m2m/launcher/TransformationType.java
+++ b/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.launcher/src/org/eclipse/viatra/examples/cps/xform/m2m/launcher/TransformationType.java
@@ -22,7 +22,6 @@ import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey
import org.eclipse.viatra.query.runtime.localsearch.matcher.integration.LocalSearchHints;
import org.eclipse.viatra.query.runtime.localsearch.planner.cost.IConstraintEvaluationContext;
import org.eclipse.viatra.query.runtime.localsearch.planner.cost.impl.StatisticsBasedConstraintCostFunction;
-import org.eclipse.viatra.query.runtime.localsearch.planner.cost.impl.VariableBindingBasedCostFunction;
import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
import org.eclipse.viatra.query.runtime.matchers.context.IInputKey;
import org.eclipse.viatra.query.runtime.rete.matcher.ReteBackendFactory;
@@ -44,57 +43,17 @@ public enum TransformationType {
},
BATCH_VIATRA_QUERY_LOCAL_SEARCH {
public CPSTransformationWrapper getWrapper() {
- QueryEvaluationHint hint = LocalSearchHints.getDefaultFlatten().build();
- return new BatchQueryLocalSearch(hint, hint);
+ QueryEvaluationHint hint = LocalSearchHints.getDefaultFlatten().build();
+ QueryEvaluationHint traceHint = LocalSearchHints.getDefaultFlatten().setCostFunction(new EndOfTransformationCostFunction()).build();
+ return new BatchQueryLocalSearch(hint, traceHint);
}
},
- BATCH_VIATRA_QUERY_LOCAL_SEARCH_TRACE_STATS {
+ BATCH_VIATRA_QUERY_LOCAL_SEARCH_GENERIC {
public CPSTransformationWrapper getWrapper() {
- QueryEvaluationHint hint = LocalSearchHints.getDefaultFlatten().build();
- final Map<IInputKey, IInputKey> substitutions = Maps.newHashMap();
- substitutions.put(new EClassTransitiveInstancesKey(TraceabilityPackage.Literals.CPS2_DEPLOYMENT_TRACE), new EClassTransitiveInstancesKey(CyberPhysicalSystemPackage.Literals.IDENTIFIABLE));
- substitutions.put(new EClassTransitiveInstancesKey(DeploymentPackage.Literals.DEPLOYMENT_ELEMENT), new EClassTransitiveInstancesKey(CyberPhysicalSystemPackage.Literals.IDENTIFIABLE));
- substitutions.put(new EStructuralFeatureInstancesKey(TraceabilityPackage.Literals.CPS2_DEPLOYMENT_TRACE__CPS_ELEMENTS), new EClassTransitiveInstancesKey(CyberPhysicalSystemPackage.Literals.IDENTIFIABLE));
- substitutions.put(new EStructuralFeatureInstancesKey(TraceabilityPackage.Literals.CPS2_DEPLOYMENT_TRACE__DEPLOYMENT_ELEMENTS), new EClassTransitiveInstancesKey(CyberPhysicalSystemPackage.Literals.IDENTIFIABLE));
- substitutions.put(new EStructuralFeatureInstancesKey(TraceabilityPackage.Literals.CPS_TO_DEPLOYMENT__TRACES), new EClassTransitiveInstancesKey(CyberPhysicalSystemPackage.Literals.IDENTIFIABLE));
- QueryEvaluationHint traceHint = LocalSearchHints.getDefaultFlatten().setCostFunction(new StatisticsBasedConstraintCostFunction() {
-
- @Override
- public long countTuples(IConstraintEvaluationContext input, IInputKey supplierKey) {
- if (supplierKey instanceof EClassTransitiveInstancesKey){
- EClass eclass = ((EClassTransitiveInstancesKey) supplierKey).getEmfKey();
- if (TraceabilityPackage.Literals.CPS_TO_DEPLOYMENT.equals(eclass)){
- return 1l;
- }
- }
- if (substitutions.containsKey(supplierKey)){
- return input.getRuntimeContext().countTuples(substitutions.get(supplierKey), null);
- }
-
- return input.getRuntimeContext().countTuples(supplierKey, null);
- }
- }).build();
- return new BatchQueryLocalSearch(hint, traceHint);
- }
- },
- BATCH_VIATRA_QUERY_LOCAL_SEARCH_NO_FLAT {
- public CPSTransformationWrapper getWrapper() {
- QueryEvaluationHint hint = LocalSearchHints.getDefault().build();
- return new BatchQueryLocalSearch(hint, hint);
- }
- },
- BATCH_VIATRA_QUERY_LOCAL_SEARCH_DUMB_PLANNER {
- public CPSTransformationWrapper getWrapper() {
- QueryEvaluationHint hint = LocalSearchHints.getDefaultFlatten().setCostFunction(new VariableBindingBasedCostFunction()).build();
- return new BatchQueryLocalSearch(hint, hint);
+ QueryEvaluationHint hint = LocalSearchHints.getDefaultGeneric().build();
+ return new BatchQueryLocalSearch(hint, hint);
}
},
- BATCH_VIATRA_QUERY_LOCAL_SEARCH_STATISTICS {
- public CPSTransformationWrapper getWrapper() {
- QueryEvaluationHint hint = LocalSearchHints.getDefault().setUseBase(false).build();
- return new BatchQueryLocalSearch(hint, hint);
- }
- },
BATCH_VIATRA_QUERY_LOCAL_SEARCH_WO_INDEXER {
public CPSTransformationWrapper getWrapper() {
QueryEvaluationHint hint = LocalSearchHints.getDefaultNoBase().build();
@@ -104,6 +63,7 @@ public enum TransformationType {
BATCH_VIATRA_TRANSFORMATION {
public CPSTransformationWrapper getWrapper() {return new BatchViatra();}
+ @Override
public boolean isDebuggable() {
return true;
}
@@ -120,11 +80,41 @@ public enum TransformationType {
INCR_VIATRA_TRANSFORMATION {
public CPSTransformationWrapper getWrapper() {return new ViatraTransformation();}
+ @Override
public boolean isDebuggable() {
return true;
}
};
+ private final class EndOfTransformationCostFunction extends StatisticsBasedConstraintCostFunction {
+ final Map<IInputKey, IInputKey> substitutions;
+
+ public EndOfTransformationCostFunction() {
+ super();
+ substitutions = Maps.newHashMap();
+ substitutions.put(new EClassTransitiveInstancesKey(TraceabilityPackage.Literals.CPS2_DEPLOYMENT_TRACE), new EClassTransitiveInstancesKey(CyberPhysicalSystemPackage.Literals.IDENTIFIABLE));
+ substitutions.put(new EClassTransitiveInstancesKey(DeploymentPackage.Literals.DEPLOYMENT_ELEMENT), new EClassTransitiveInstancesKey(CyberPhysicalSystemPackage.Literals.IDENTIFIABLE));
+ substitutions.put(new EStructuralFeatureInstancesKey(TraceabilityPackage.Literals.CPS2_DEPLOYMENT_TRACE__CPS_ELEMENTS), new EClassTransitiveInstancesKey(CyberPhysicalSystemPackage.Literals.IDENTIFIABLE));
+ substitutions.put(new EStructuralFeatureInstancesKey(TraceabilityPackage.Literals.CPS2_DEPLOYMENT_TRACE__DEPLOYMENT_ELEMENTS), new EClassTransitiveInstancesKey(CyberPhysicalSystemPackage.Literals.IDENTIFIABLE));
+ substitutions.put(new EStructuralFeatureInstancesKey(TraceabilityPackage.Literals.CPS_TO_DEPLOYMENT__TRACES), new EClassTransitiveInstancesKey(CyberPhysicalSystemPackage.Literals.IDENTIFIABLE));
+ }
+
+ @Override
+ public long countTuples(IConstraintEvaluationContext input, IInputKey supplierKey) {
+ if (supplierKey instanceof EClassTransitiveInstancesKey){
+ EClass eclass = ((EClassTransitiveInstancesKey) supplierKey).getEmfKey();
+ if (TraceabilityPackage.Literals.CPS_TO_DEPLOYMENT.equals(eclass)){
+ return 1l;
+ }
+ }
+ if (substitutions.containsKey(supplierKey)){
+ return input.getRuntimeContext().countTuples(substitutions.get(supplierKey), null);
+ }
+
+ return input.getRuntimeContext().countTuples(supplierKey, null);
+ }
+ }
+
public abstract CPSTransformationWrapper getWrapper();
public boolean isDebuggable() {

Back to the top