|
@@ -2,6 +2,8 @@ package ua.ansymo.hintco
|
|
|
|
|
|
import java.util.Deque
|
|
import java.util.Deque
|
|
import org.eclipse.core.runtime.Assert
|
|
import org.eclipse.core.runtime.Assert
|
|
|
|
+import org.jgrapht.graph.DefaultWeightedEdge
|
|
|
|
+import org.jgrapht.graph.Multigraph
|
|
|
|
|
|
class AlgebraicLoopVariantProcessor implements IVariantProcessor {
|
|
class AlgebraicLoopVariantProcessor implements IVariantProcessor {
|
|
|
|
|
|
@@ -11,6 +13,20 @@ class AlgebraicLoopVariantProcessor implements IVariantProcessor {
|
|
runner = r
|
|
runner = r
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /*
|
|
|
|
+ * Transforms a scenario into a cosim unit graph.
|
|
|
|
+ * The scenario already has some ordering constraints, as cosim units and ports are both precedence nodes.
|
|
|
|
+ * The precendence constraints are placed in a way that it is easy to know whether two cosim units A and B should precede each other: whenever there is a precedence path that goes between them, of the following form:
|
|
|
|
+ * A -> B.in -> B where B.in is one of the input ports of B. If this is the case, then an edge should be created A --w-> B where w is the cost of extrapolating B.in.
|
|
|
|
+ * In every other case, there is no edge between A->B.
|
|
|
|
+ * This way, we preserve the extrapolation adaptations that have been defined by other hints.
|
|
|
|
+ */
|
|
|
|
+ def transformToCosimUnitGraph(Scenario scenario) {
|
|
|
|
+ val g = new Multigraph(DefaultWeightedEdge)
|
|
|
|
+
|
|
|
|
+ return g
|
|
|
|
+ }
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* This method will perform roughly the following steps:
|
|
* This method will perform roughly the following steps:
|
|
* 1. Transform the scenario (assumed to be non-hierarchical) into a graph where each node represents a cosim unit, and each connection between cosim units represents the cost of executing the latter after executing the former.
|
|
* 1. Transform the scenario (assumed to be non-hierarchical) into a graph where each node represents a cosim unit, and each connection between cosim units represents the cost of executing the latter after executing the former.
|
|
@@ -27,7 +43,6 @@ class AlgebraicLoopVariantProcessor implements IVariantProcessor {
|
|
scenario.eAllContents.filter(InterpolationAdaptation).forEach[adapt | Assert.isTrue(adapt.order == 0, "Only constant interpolations supported in algebraic loop optimizer. Adaptation " + adapt + " is not a constant interpolation.")]
|
|
scenario.eAllContents.filter(InterpolationAdaptation).forEach[adapt | Assert.isTrue(adapt.order == 0, "Only constant interpolations supported in algebraic loop optimizer. Adaptation " + adapt + " is not a constant interpolation.")]
|
|
Assert.isTrue(scenario.eAllContents.filter(PowerBondAdaptation).empty, "Powerbond adaptations cannot be used with algebraic loop optimizer, as the optimal trigger sequence may override these.")
|
|
Assert.isTrue(scenario.eAllContents.filter(PowerBondAdaptation).empty, "Powerbond adaptations cannot be used with algebraic loop optimizer, as the optimal trigger sequence may override these.")
|
|
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|