|
@@ -1,6 +1,7 @@
|
|
|
package ua.ansymo.hintco
|
|
|
|
|
|
import java.util.Deque
|
|
|
+import org.eclipse.core.runtime.Assert
|
|
|
|
|
|
class AlgebraicLoopVariantProcessor implements IVariantProcessor {
|
|
|
|
|
@@ -10,7 +11,23 @@ class AlgebraicLoopVariantProcessor implements IVariantProcessor {
|
|
|
runner = r
|
|
|
}
|
|
|
|
|
|
+ /*
|
|
|
+ * 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.
|
|
|
+ * 2. Find the best way to break the algebraic loops, that is, find the optimal trigger sequence.
|
|
|
+ * 3. Define the operation schedule from the optimal trigger sequence. As this breaks the loop, it means that some semantic adaptations have to be overridden.
|
|
|
+ * Since the last step is tricky when higher order approximations and power bond adaptations are used, these are not supported for now.
|
|
|
+ */
|
|
|
override process(Deque<VariantDiagram> ns, String variantID, ConstraintsStack constraints, HintConfiguration cs) {
|
|
|
+ val scenario = ModelQuery.findRootScenario(ns)
|
|
|
+
|
|
|
+ if (!scenario.eAllContents.filter(Scenario).empty) {
|
|
|
+ throw new UnsupportedOperationException("Algebraic loop optimization is not implemented for hierarchical co-simulation scenarios.")
|
|
|
+ }
|
|
|
+ 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.")
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|