Skip to content
Snippets Groups Projects
Commit fbefcaea authored by Alexander Diewald's avatar Alexander Diewald
Browse files

Exploration: DSE project MM improvements & DSE Backend Unification

=================
| Exploration

exploration.ecore
=================
- ExplorationSpecification
  - targets: non-contained (Migrator!)
  - Add superSet reference to pass required SuperSets to the DSE backend.
- Remove ExplorationSolution interface: No Migration needed.
- Rename ExplorationSolutionSet --> ExplorationSolution
  - Deprecated inputModelAdapter: No migration needed, only used in MOEA.
  - Renaming: targetSpecification --> explorationSpec
    - targetSpecification marked @deprecated
    - No mirgator needed: Class was not used in previous stable releases.
- Add EClass SuperSetMap: Relates types of elements to SuperSets
  - solution: EJavaClassToSuperSetMap (containment!)
- Add EClass EJavaClassToSuperSetMap: internal map of "SuperSetMap"
  - key: Class
  - Value: SuperSet (NO containment!)
- ExplorationSolution
  - Renamed solutionModelMap -> solutionSets
    (Type EJavaClassToEJavaObjectMap -> EJavaClassToSuperSetMap)
  - Adjust EOperations to modifications in backend map.
- SingleExplorationSolution
  - Add the solution state for single solutions.
  - Adjust EOperations to modifications in backend map.
- Removed EJavaClassToEJavaObjectMap

dseproject.ecore
================
- DSE:
  - Add EReference target: ExplorationTarget (containment)
  - Remove explorationSpecification (Migrator!)
- Add an ExplorationTargetPool that contains all ExplorationTargets of a DSE
  project.
- DSERun:
  - Add EReference explorationSolution (containment)
  - Remove EReference visualization (Migrator!)
  
dsl_v2.ecore
============
- Overwrite the accept method for the Sum expression: Do not return null if the
  associated set is empty, evaluate to Zero, instead.

New Migrators
=============
- DSEExplorationTargetContainmentMigrator
  Migrates the set of explorationTargets to the DSE project
- VisualizationToExpSolutionMigrator:
  Migrates the Visualization data to the ExplorationSolution representation that
  allows a better traceability.
  
Other Business
==============
- Adjust plugin.xml to account for recently removed Objective- and
  ConstraintExpression classes. Now, ExplorationObjective and
  ExplorationConstraint is used.
  
=================
| Exploration.alg

- Adjust the Opt4JBackend to be comply to the new DSE Backend Specification
- The output type detection in the base decoder is more robust.
- The ITaskAdapter temporally references its corresponding component to ease
  the refactoring of the DSE backend interface. This shall not be needed when
  the transformation framework is integrated again.
- Temporally transform the internal solutions to a superset of
  ComponentToExecutionUnitAllocations to create s solution model. Workaround
  until the transformation framework is integrated again.
- Misc adjustment for backend changes.

=================
| Exploration.smt

- Adjust the Z3Backend to be comply to the new DSE Backend Specification
- Base the results of the DeploymentRun2 and SolverRun2 on the
  ExplorationSolution (see above).

================
| Exploration.ui

- Adjust the GUI logic to account for the changed containment relations.
- Update the DSE project import wizard for the Meta-Model changes.
- Move the ExplorationSolutionVisualizationUtils class to the UI plugin (here).
  It is used to transform ExplorationSolutions to a Visualization representation
  (i.e., DataSetCollection).
- Use doubles instead of ints in the SpiderChartUtils. Although not a proper
  solution, this covers more cases... Instead the generic should be reflected.
refs 3273
parent 0ac78eeb
No related branches found
No related tags found
No related merge requests found
Showing
with 178 additions and 120 deletions
......@@ -225,13 +225,13 @@
<evaluator
module="org.fortiss.af3.exploration.alg.dse.evaluator.objective.MappingEvaluatorObjective">
<modelElementClass
modelElementClass="org.fortiss.af3.exploration.model.ObjectiveExpression">
modelElementClass="org.fortiss.af3.exploration.model.ExplorationObjective">
</modelElementClass>
</evaluator>
<evaluator
module="org.fortiss.af3.exploration.alg.dse.evaluator.constraint.MappingEvaluatorConstraint">
<modelElementClass
modelElementClass="org.fortiss.af3.exploration.model.ConstraintExpression">
modelElementClass="org.fortiss.af3.exploration.model.ExplorationConstraint">
</modelElementClass>
</evaluator>
</extension>
......
Opt4JDseBackend.java 50254b3b5058ed77e8a868f3545fde16153217b1 RED
Opt4JDseBackend.java 1e40a39efe861ae007a3629c4955e5ccceee8a92 RED
......@@ -16,7 +16,6 @@
package org.fortiss.af3.exploration.alg.backend;
import static org.fortiss.af3.exploration.alg.util.DesignSpaceExplorationModelElementFactory.createDefaultDesignSpaceExploration;
import static org.fortiss.af3.exploration.util.DesignSpaceExplorationModelElementFactory.createExplorationSpecification;
import static org.fortiss.tooling.common.util.LambdaUtils.getFirst;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getParentsWithType;
......@@ -37,16 +36,13 @@ import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.af3.AF3SystemModelAdapt
import org.fortiss.af3.exploration.alg.plot.XYPlotter;
import org.fortiss.af3.exploration.alg.service.IExplorationEncoding;
import org.fortiss.af3.exploration.backend.IDseBackend;
import org.fortiss.af3.exploration.backend.RuleSetContainer;
import org.fortiss.af3.exploration.backend.SuperSetMap;
import org.fortiss.af3.exploration.dsl_v2.model.expression.SuperSet;
import org.fortiss.af3.exploration.model.ExplorationSolution;
import org.fortiss.af3.exploration.model.ExplorationSpecification;
import org.fortiss.af3.exploration.model.IExplorationFeature;
import org.fortiss.af3.exploration.model.solutions.ExplorationSolutionSet;
import org.fortiss.af3.exploration.model.SuperSetMap;
import org.fortiss.af3.exploration.model.solutions.ExplorationSolution;
import org.fortiss.af3.exploration.moea.model.DseSpecification;
import org.fortiss.af3.exploration.moea.model.feature.FeatureFactory;
import org.fortiss.af3.exploration.projectmodel.RuleSet;
import org.fortiss.af3.platform.model.ExecutionUnit;
import org.fortiss.af3.platform.model.PlatformArchitecture;
import org.fortiss.af3.task.model.Signal;
......@@ -66,9 +62,8 @@ import org.jfree.ui.RefineryUtilities;
public class Opt4JDseBackend implements IDseBackend {
/** Specifies the required input models from the DSE. */
private final Collection<Class<?>> requiredInputModels =
Arrays.asList(ComponentArchitecture.class, TaskArchitecture.class,
PlatformArchitecture.class, RuleSetContainer.class);
private final Collection<Class<?>> requiredInputModels = Arrays.asList(
ComponentArchitecture.class, TaskArchitecture.class, PlatformArchitecture.class);
// TODO: Remove after migration to AF3 visiualization
/** Last {@link XYPlotter} (in order to close it before creating a new one. */
......@@ -83,30 +78,25 @@ public class Opt4JDseBackend implements IDseBackend {
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override
public Optional<ExplorationSolution> executeDSE(RuleSetContainer expSpec,
Set<Class<? extends IModelElement>> solutionModels, SuperSetMap superSets,
public Optional<ExplorationSolution> executeDSE(ExplorationSpecification expSpec,
Set<Class<? extends IModelElement>> solutionModelTypes,
Collection<IExplorationFeature> explorationModules, IProgressMonitor monitor,
int timeoutMS) throws Exception {
ExplorationSolutionSet explorationSolutionSet;
ExplorationSolution explorationSolution;
SystemModelAdapter<?, ?, ?, ?, ?, ?, ?> systemModelAdapter;
SuperSetMap superSets = expSpec.getSearchSpace();
// TODO: Find a cleaner way to extract the model context.
TaskArchitecture taskArchitecture =
getArchModel(superSets, TaskArchitecture.class, Task.class);
ITopLevelElement context =
IPersistencyService.getInstance().getTopLevelElementFor(taskArchitecture);
ExplorationSpecification spec = createExplorationSpecification();
for(RuleSet ruleSet : expSpec) {
context.runAsNonDirtyingCommand(
() -> spec.getTargets().addAll(ruleSet.getExplorationTargets()));
}
// Input to DSE: {@link SystemModelAdapter} and {@link DesignSpaceExploration}.
// SystemModelAdapter systemModelAdapter;
systemModelAdapter = new AF3SystemModelAdapter(superSets.get(Task.class),
superSets.get(ComponentToTaskAllocationEntry.class),
superSets.get(ExecutionUnit.class), superSets.get(Signal.class));
DseSpecification dseSpec = createDefaultDesignSpaceExploration(spec, context);
DseSpecification dseSpec = createDefaultDesignSpaceExploration(expSpec, context);
// Set the requested solutions.
Set<Class<?>> solutionTypes = new HashSet<>();
......@@ -130,10 +120,8 @@ public class Opt4JDseBackend implements IDseBackend {
}
CompositeExplorationSolution<?> expResult =
explorer.explore(dseSpec, systemModelAdapter, solPhenotypeTypes, monitor, true);
explorationSolutionSet = expResult.convertToExplorationSolution();
explorationSolutionSet.setInputModelAdapter(systemModelAdapter);
explorationSolutionSet.setTargetSpecification(spec);
explorationSolution = expResult.convertToExplorationSolution();
explorationSolution.setExplorationSpec(expSpec);
} catch(Exception ex) {
// TODO: readd code to present the schedule which failed... Use the LoggingService from
// the kernel.
......@@ -147,7 +135,7 @@ public class Opt4JDseBackend implements IDseBackend {
// }
throw ex;
}
return Optional.of(explorationSolutionSet);
return Optional.of(explorationSolution);
}
/**
......@@ -170,7 +158,7 @@ public class Opt4JDseBackend implements IDseBackend {
* each solution.
*/
@Override
public void plotResult(ExplorationSolutionSet solutionSet) {
public void plotResult(ExplorationSolution solutionSet) {
if(solutionSet != null) {
// Keep only one DSE result window
if(lastPlotter != null) {
......@@ -179,7 +167,7 @@ public class Opt4JDseBackend implements IDseBackend {
// draw figure
// FIXME: Unchecked cast to ExplorationSolutionSet
XYPlotter plotter = new XYPlotter(solutionSet.getTargetSpecification(), solutionSet,
XYPlotter plotter = new XYPlotter(solutionSet.getExplorationSpec(), solutionSet,
"Design Space Exploration Result (generations: " + "N/A" + ")");
plotter.createPlot();
plotter.pack();
......
CompositeExplorationSolution.java 528283a3dd57500539b2e11dd3d3eb35512de9b8 RED
CompositeExplorationSolution.java 80437fd1a7022e8718b8116533afdf12015e4398 RED
DSEFactory.java 0a2f2cc6a197e760c1f8223339ffa5f16856b184 RED
Explorer.java 4e23a668d0b0ad236e77eec2634efe2a0a6d0a23 RED
ImplicitExplorationTargetFactory.java 0b10dc4e8385bbdee0217dac783203080eb723f0 RED
......
......@@ -15,22 +15,34 @@
+--------------------------------------------------------------------------*/
package org.fortiss.af3.exploration.alg.dse;
import static org.fortiss.af3.exploration.alg.util.DesignSpaceExplorationModelElementFactory.createSingleExplorationSolutionMap;
import static org.fortiss.af3.allocation.utils.AllocationModelElementFactory.createAllocationEntry;
import static org.fortiss.af3.exploration.util.DSMLModelElementFactory.createSuperSet;
import static org.fortiss.af3.exploration.util.DesignSpaceExplorationModelElementFactory.createSingleExplorationSolution;
import static org.fortiss.tooling.common.util.LambdaUtils.getFirst;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.encoding.partitionmapping.Partition;
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.encoding.partitionmapping.PartitionMappingEncoding;
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.encoding.taskmapping.instantiatedmapping.InstantiatedTaskMappingEncoding;
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.encoding.taskmapping.instantiatedmapping.InstantiatedTaskMappingEntry;
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.extensions.compositegene.phenotype.Phenotype;
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.solution.IExplorationSolution;
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.solution.IScheduleSolution;
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.solution.StrictTTSchedule;
import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.ITaskAdapter;
import org.fortiss.af3.exploration.dsl_v2.model.expression.SuperSet;
import org.fortiss.af3.exploration.model.ExplorationTarget;
import org.fortiss.af3.exploration.model.solutions.ExplorationResult;
import org.fortiss.af3.exploration.model.solutions.ExplorationSolutionSet;
import org.fortiss.af3.exploration.model.solutions.SingleExplorationSolutionMap;
import org.fortiss.af3.exploration.model.solutions.ExplorationSolution;
import org.fortiss.af3.exploration.model.solutions.SingleExplorationSolution;
import org.fortiss.af3.exploration.model.solutions.SolutionState;
import org.fortiss.af3.exploration.model.solutions.SolutionsFactory;
import org.fortiss.af3.platform.model.allocation.ComponentToExecutionUnitAllocationEntry;
import org.fortiss.tooling.base.model.element.IModelElement;
import org.opt4j.core.Value;
/**
......@@ -122,28 +134,22 @@ public class CompositeExplorationSolution<P extends Phenotype> {
}
/**
* Returns {@code this} {@link CompositeExplorationSolution} as a {@link ExplorationSolutionSet}
* Returns {@code this} {@link CompositeExplorationSolution} as a {@link ExplorationSolution}
* .
*/
@SuppressWarnings("unchecked")
public <T> ExplorationSolutionSet convertToExplorationSolution() throws Exception {
ExplorationSolutionSet expSol = SolutionsFactory.eINSTANCE.createExplorationSolutionSet();
public <T> ExplorationSolution convertToExplorationSolution() throws Exception {
ExplorationSolution expSol =
org.fortiss.af3.exploration.util.DesignSpaceExplorationModelElementFactory
.createExplorationSolution();
for(Entry<IExplorationSolution<?>, SolutionQuantification> singleSolutionEntry : explorationResultMap
.entrySet()) {
SingleExplorationSolutionMap expSolutionMap = createSingleExplorationSolutionMap();
SingleExplorationSolution singleExpSolution = createSingleExplorationSolution();
IExplorationSolution<?> singleSolution = singleSolutionEntry.getKey();
// Be transparent, provide all Phenotypes
for(Class<? extends Phenotype> subSolutionType : singleSolution
.getAllSubSolutionClasses()) {
// TODO: Dirty cast, remove.
expSolutionMap.putSolutionModel((Class<T>)subSolutionType,
(T)singleSolution.getSubSolution(subSolutionType));
}
for(Entry<ExplorationTarget<?>, Value<?>> solEntry : singleSolutionEntry.getValue()
.entrySet()) {
if(expSolutionMap.containsKey(solEntry.getKey())) {
if(singleExpSolution.containsKey(solEntry.getKey())) {
throw new Exception(
"Could not convert to the ExplorationResult to an ExplorationSolutionSet. The exist multiple results for the ExplorationTarget " +
solEntry.getKey().getName() +
......@@ -155,9 +161,42 @@ public class CompositeExplorationSolution<P extends Phenotype> {
@SuppressWarnings("rawtypes") ExplorationResult res =
SolutionsFactory.eINSTANCE.createExplorationResult();
res.setResult(solEntry.getValue().getDouble());
expSolutionMap.put((ExplorationTarget<?>)solEntry.getKey(), res);
singleExpSolution.put((ExplorationTarget<?>)solEntry.getKey(), res);
}
// FIXME: HACK: Currently, only the Deployment exploration is used, whereas the solution
// transformation framework is non-functional at the moment.
InstantiatedTaskMappingEncoding<InstantiatedTaskMappingEntry> tm =
singleSolution.getSubSolution(InstantiatedTaskMappingEncoding.class);
PartitionMappingEncoding pmEncoding =
singleSolution.getSubSolution(PartitionMappingEncoding.class);
SuperSet<ComponentToExecutionUnitAllocationEntry> compExecUnitAllocs =
createSuperSet("Optimized_Allocations");
for(Partition resource : tm.getResources()) {
for(ITaskAdapter<?> task : tm.getRequesters(resource)) {
Component af3Component = task.getAssignedComponent();
ComponentToExecutionUnitAllocationEntry allocEntry =
createAllocationEntry(ComponentToExecutionUnitAllocationEntry.class);
allocEntry.getSourceElements().add(af3Component);
allocEntry.setTargetElement(
(IModelElement)getFirst(pmEncoding.getAllocatedResourcesFor(resource))
.get().getObject());
compExecUnitAllocs.getEntries().add(allocEntry);
}
}
expSol.getSolutions().add(expSolutionMap);
singleExpSolution.getSolutionSets().put(ComponentToExecutionUnitAllocationEntry.class,
compExecUnitAllocs);
// Invalid solutions are filtered before.
singleExpSolution.setSolutionState(SolutionState.OPTIMIZED);
expSol.getSolutions().add(singleExpSolution);
}
if(expSol.getSolutions().isEmpty()) {
expSol.setSolutionState(SolutionState.UNKNOWN);
} else {
expSol.setSolutionState(SolutionState.OPTIMIZED);
}
return expSol;
......
ComposableDecoder.java 197abec80b880e25fccfc66d61b471b0b5d7e10f RED
ComposableDecoderBase.java 6c2368511fede062e017d76e6be8e5a22132d97f RED
ComposableDecoderBase.java 96e7e4b9f24902b2699e04401225935108cc0d29 YELLOW
CompositeDecoder.java 9d34dd0b342e6433ab894974f9430531ce2de39a RED
CompositeDecoderBase.java 1bc1860ed616010f7f459ed6579989f155f607c2 RED
PhenotypeDecoder.java 44079e8545aaf8b8729919f0b07c774c3ca0df06 RED
......@@ -56,8 +56,10 @@ public abstract class ComposableDecoderBase<G extends ComposableGenotype, P exte
@SuppressWarnings("unchecked")
@Override
public Class<? super P> getOutputType() {
if(genotype.getType() instanceof Class) {
if(phenotype.getType() instanceof Class) {
return (Class<? super P>)phenotype.getType();
} else if(phenotype.getRawType() != null) {
return phenotype.getRawType();
}
return null;
}
......
EnergyObjectiveEvaluator.java ad2b868aa3dce2c7708ee6cc90f357b79a4cf799 RED
FailSilentReliabilityEvaluator.java 83211c8e2b69579c424a486cd6845bb8d1bb69fa RED
FaultDetectionVotingReliabilityEvaluator.java 189fdfd0daed3348c510a6aeac0bd391e835c524 RED
MappingEvaluatorObjective.java d92d716e5a8ecb531896e66c0254e3a4602d46d8 RED
MappingEvaluatorObjective.java 5a1e083a5f18be458b73c6fc4fd9d37b9f69d213 RED
ReliabilityEvaluatorBase.java 98fa54270cba25137112fe55f3551fbd8064ac28 RED
......@@ -86,8 +86,9 @@ public class MappingEvaluatorObjective extends TaskMappingEvaluator {
assert (minMaxTerm != null);
// The minMax Term is always non-zero.
// TODO: redefine the
@SuppressWarnings("null") Number retVal = minMaxTerm.accept(this, Number.class);
// FIXME: Using "BigInteger" as a type is a hack: It is a workaround to comply with the
// construction of objectives in the UI.
@SuppressWarnings("null") Number retVal = minMaxTerm.accept(this, BigInteger.class);
return retVal instanceof BigInteger ? new IntegerValue(retVal.intValue())
: new DoubleValue(retVal.doubleValue());
......
......@@ -3,4 +3,4 @@ ComponentArchitectureInitializer.java 52d1f756c194774a4ac5b96ac4f2014dc9b5a6b7 R
ComponentArchitectureInserter.java 9ab94811d460d06fa1ce2f72e40911beb7982e94 RED
ComponentArchitectureInstantiator.java 41fddd490e8b45b39bb3725d1e2a93a63b737169 RED
ComponentArchitectureReplicator.java 59ee5ee2ad6331150b53293e1a549b788a52ee00 RED
ComponentArchitectureTransformer.java 9eded58c64a6077a3a5cb13cf3d7d78779b70a49 RED
ComponentArchitectureTransformer.java f4a1ea1337dcb3aeaa99900034dd9ada9b9ee5a7 RED
......@@ -26,12 +26,12 @@ import org.fortiss.af3.exploration.alg.dse.modeltransformation.ITransformationSt
import org.fortiss.af3.exploration.alg.dse.modeltransformation.base.TransformationStrategyBase;
import org.fortiss.af3.exploration.alg.dse.modeltransformation.deployment.ExplorationSolutionToDeployment;
import org.fortiss.af3.exploration.alg.dse.sysmodel.mapping.IMappingEncoding;
import org.fortiss.af3.exploration.model.solutions.SingleExplorationSolutionMap;
import org.fortiss.af3.exploration.model.solutions.SingleExplorationSolution;
import org.fortiss.tooling.kernel.model.INamedElement;
/**
* {@link ITransformationStrategy} for {@link ComponentArchitecture}s based on an
* {@link SingleExplorationSolutionMap} explored by the DSE.
* {@link SingleExplorationSolution} explored by the DSE.
*
* @author diewald
*/
......
......@@ -11,7 +11,7 @@ IResourceAdapter.java 634866895c9d1aa427f3c8d47e69acd807d0b582 RED
IResourceConnectionAdapter.java 7e20a8c3e60a9892597301556c891ba2dd43387f RED
ISafetyFunctionAdapter.java f20249e7c37f54774a9e8eaa0566a85492c80654 RED
ISignalAdapter.java 4f04154c5802a4f1a5469df90652852e16727421 RED
ITaskAdapter.java 97ad40c0ca14be2fb4fd070214a3d6ebe5be914a RED
ITaskAdapter.java ea35d5d3c9482c3a3f4452eec7fa0e825552be59 RED
ITransmissionUnitAdapter.java 8965b73bfe9ef232a2a6d5427f7001761716d583 RED
InternalComponentParameters.java 2b19f4eeddee84e4c6e558ed9a1613cba33b7665 RED
SystemModelAdapter.java 3621d4aaaeb8b5913194dc4cc6182c20f305149b RED
......@@ -27,27 +27,30 @@ import org.fortiss.af3.component.model.Component;
* @author barner
*/
public interface ITaskAdapter<T> extends IRequestAdapter<T>, Cloneable {
/** TEMP HACK: Returns the AF3 component realized in this task. */
// FIXME: Remove after updating the transformation framework for SuperSets.
Component getAssignedComponent();
/**
* Returns the WCET if this {@link ITaskAdapter} would be executed on the given
* {@link IExecutionUnitAdapter}.
*/
public Double getWcet(IExecutionUnitAdapter<?> executionUnit);
Double getWcet(IExecutionUnitAdapter<?> executionUnit);
/**
* Returns the consumed energy if this {@link ITaskAdapter} would be executed on
* the given {@link IExecutionUnitAdapter}.
*/
public Double getEnergyConsumption(IExecutionUnitAdapter<?> executionUnit);
Double getEnergyConsumption(IExecutionUnitAdapter<?> executionUnit);
/** Returns the minimum required safety integrity level of the deployable component. */
public Enumerator getRequiredSafetyIntegrityLevel();
Enumerator getRequiredSafetyIntegrityLevel();
/** Returns the period of the deployable component. */
public Double getPeriod();
Double getPeriod();
/** Sets the period of the deployable component. */
public void setPeriod(double period);
void setPeriod(double period);
/**
* Predicates whether this {@link ITaskAdapter} must be instantiated by another
......@@ -55,25 +58,25 @@ public interface ITaskAdapter<T> extends IRequestAdapter<T>, Cloneable {
* {@link ITaskAdapter}s are given that may be used to instantiate this
* {@link ITaskAdapter}.
*/
public boolean isInstantiationRequired();
boolean isInstantiationRequired();
/**
* Returns those {@link ITaskAdapter}s that may be used to instantiate this
* {@link ITaskAdapter}.
*/
public Collection<ITaskAdapter<T>> getReplacementComponents();
Collection<ITaskAdapter<T>> getReplacementComponents();
/**
* Predicates whether this {@link ITaskAdapter} instantiates an abstract
* {@link ITaskAdapter}.
*/
public boolean isInstantiation();
boolean isInstantiation();
/**
* Returns the {@link ITaskAdapter} instantiated by this
* {@link ITaskAdapter} (if applicable).
*/
public ITaskAdapter<T> getReplacedComponent();
ITaskAdapter<T> getReplacedComponent();
/**
* Sets the replacedComponent reference of {@code this} {@link ITaskAdapter} to
......@@ -81,26 +84,26 @@ public interface ITaskAdapter<T> extends IRequestAdapter<T>, Cloneable {
* {@link ITaskAdapter}s.
*/
// TODO: If possible, find a way to eliminate this suppresswarning.
public void setReplacedComponent(@SuppressWarnings("rawtypes") ITaskAdapter abstractComponent);
void setReplacedComponent(@SuppressWarnings("rawtypes") ITaskAdapter abstractComponent);
/**
* Whenever an {@link ITaskAdapter} is copied/cloned its references wrt. the task
* instantiation need to be updated. Hence, after cloning, this method should be called for each
* copied/cloned {@link ITaskAdapter}.
*/
public void updateInstatiationData();
void updateInstatiationData();
/**
* Returns the minimum number of replications allowed for this
* {@link ITaskAdapter}.
*/
public int getMinReplication();
int getMinReplication();
/**
* Returns the maximum number of replications allowed for this
* {@link ITaskAdapter}.
*/
public int getMaxReplication();
int getMaxReplication();
/**
* Clones the {@link ITaskAdapter} on which this method is called. If
......@@ -108,5 +111,5 @@ public interface ITaskAdapter<T> extends IRequestAdapter<T>, Cloneable {
* constructed {@link ITaskAdapter}s must be replicated for each instantiated
* encoding.
*/
public ITaskAdapter<T> clone();
ITaskAdapter<T> clone();
}
......@@ -8,6 +8,6 @@ AF3RequestAdapter.java 7cfea424beeacaac81b48efd4e1c24270dcb3929 RED
AF3ResourceAdapter.java 00070d4e3ec7f19a672b6295c546fa1d30d7fc50 RED
AF3ResourceConnectionAdapter.java 0e791fd7d9602f4cf00f54c6254d31f1c9cc72b0 RED
AF3SignalAdapter.java bc102b65b929393808eb747572f9ae05b04a8856 RED
AF3SystemModelAdapter.java e9f93d7710e2b00a6a420687b8fd161974e10dee RED
AF3TaskAdapter.java a3cfe04d7b235cc61031c5477de2cb54ac810aac RED
AF3SystemModelAdapter.java e6ea1aaae3c4867cfc38487d7534e847794fdb82 RED
AF3TaskAdapter.java ac021d7af31888d89d1cb58ec64bf7f551da160b RED
AF3TransmissionUnitAdapter.java 0ce1a08c29d75a05fb49668d02abddd852487a4c RED
......@@ -20,6 +20,7 @@ import static org.fortiss.af3.exploration.alg.util.AF3Utils.getConnectionTypeDir
import static org.fortiss.af3.exploration.alg.util.ExplorationAlgUtils.findTargetPorts;
import static org.fortiss.tooling.base.ui.annotation.view.AnnotationViewPartBase.isUpdateEnabled;
import static org.fortiss.tooling.base.ui.annotation.view.AnnotationViewPartBase.setUpdateEnabled;
import static org.fortiss.tooling.common.util.LambdaUtils.filter;
import static org.fortiss.tooling.common.util.LambdaUtils.getFirst;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getChildrenWithType;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getFirstParentWithType;
......@@ -154,7 +155,7 @@ public class AF3SystemModelAdapter extends
// Multimap<Component, ITaskAdapter<Component>> componentToReplacementAdapter =
// createComponentReplacementAdapters(systemParameters.getReplacementComponents());
Multimap<Task, ITaskAdapter<Task>> componentToReplacementAdapter = HashMultimap.create();
this.tasks = createTaskAdapters(componentToReplacementAdapter);
this.tasks = createTaskAdapters(componentTaskAllocs, componentToReplacementAdapter);
// TODO(#3264): The three lines below belong to this issue.
// componentReplacementAdapters = componentToReplacementAdapter.values();
......@@ -204,10 +205,26 @@ public class AF3SystemModelAdapter extends
* @throws Exception
*/
private Collection<ITaskAdapter<Task>> createTaskAdapters(
SuperSet<ComponentToTaskAllocationEntry> componentTaskAllocs,
Multimap<Task, ITaskAdapter<Task>> componentReplacementAdapters) throws Exception {
Collection<ITaskAdapter<Task>> rval = new HashSet<>();
for(Task currentTask : taskObjects) {
rval.add(new AF3TaskAdapter(currentTask));
Optional<ComponentToTaskAllocationEntry> assocComponent =
getFirst(filter(componentTaskAllocs.getEntries(),
e -> e.getTargetElement() == currentTask));
if(!assocComponent.isPresent()) {
throw new Exception("The task " + currentTask.getName() +
" is not associated with any Component. This is required for the" +
" Execution of the DSE.");
}
if(assocComponent.get().getSourceElements().size() != 1) {
throw new Exception("The task " + currentTask.getName() +
" is associated with none or more than one Components. Currently, it is" +
" required that each task has exactly one allocated component.");
}
Component af3Component =
(Component)getFirst(assocComponent.get().getSourceElements()).get();
rval.add(new AF3TaskAdapter(currentTask, af3Component));
}
return rval;
}
......
......@@ -39,6 +39,10 @@ import org.fortiss.af3.timing.model.annotation.Period;
* @author barner
*/
public class AF3TaskAdapter extends AF3RequestAdapter<Task> implements ITaskAdapter<Task> {
/** References the realized AF3 component. */
// FIXME: Remove after updating the transformation framework for SuperSets.
private Component af3Component;
/** Map of possible Wcets defined by the deployment target. */
@SuppressWarnings("unused")
private Map<IExecutionUnitAdapter<?>, Double> wcetMap;
......@@ -73,7 +77,7 @@ public class AF3TaskAdapter extends AF3RequestAdapter<Task> implements ITaskAdap
* @throws InvalidModelException
* if a required annotation cannot be found.
*/
public AF3TaskAdapter(Task af3Task) throws InvalidModelException {
public AF3TaskAdapter(Task af3Task, Component af3Component) throws InvalidModelException {
super(af3Task);
// TODO(#3262): Use the Allocation Table to retrieve WCET and EnergyConsumption values.
......@@ -90,14 +94,17 @@ public class AF3TaskAdapter extends AF3RequestAdapter<Task> implements ITaskAdap
minReplication = replicationSpec.getMinReplication();
maxReplication = replicationSpec.getMaxReplication();
// FIXME: Remove after updating the transformation framework for SuperSets.
this.af3Component = af3Component;
replacementComponents = new HashSet<ITaskAdapter<Component>>();
}
// TODO(#3264): Remove this method, component adapters are used.
public AF3TaskAdapter(Task task,
public AF3TaskAdapter(Task task, Component af3Component,
Collection<ITaskAdapter<Component>> componentReplacementAdapters)
throws InvalidModelException {
this(task);
this(task, af3Component);
replacementComponents = componentReplacementAdapters;
}
......@@ -107,9 +114,9 @@ public class AF3TaskAdapter extends AF3RequestAdapter<Task> implements ITaskAdap
* @throws InvalidModelException
* if a required annotation cannot be found.
*/
public AF3TaskAdapter(Task task, ITaskAdapter<Task> replacedComponent)
public AF3TaskAdapter(Task task, Component af3Component, ITaskAdapter<Task> replacedComponent)
throws InvalidModelException {
this(task);
this(task, af3Component);
// this.replacedComponent = replacedComponent;
}
......@@ -211,4 +218,10 @@ public class AF3TaskAdapter extends AF3RequestAdapter<Task> implements ITaskAdap
}
return null;
}
/** {@inheritDoc} */
@Override
public Component getAssignedComponent() {
return af3Component;
}
}
......@@ -4,4 +4,4 @@ ScheduleLabelGenerator.java 0ceecedfec9802bbcaa33525d61e1a60a70d3841 RED
SchedulePlotter.java 29b1156c9419d4ff3314c4b2c932aeb46f4749f8 RED
ScheduleToolTipGenerator.java cedfa0dd7ebc7b48d7cc70e966eebaeee9636caf RED
TaskSeriesCollectionFromSchedule.java b53b7af649c48980520ad572da8c7bbdbae0aed5 RED
XYPlotter.java 0c384f5d560260225cee5bb65710842613b395b9 RED
XYPlotter.java 4fd144980d0d55bccbe8840c8e049b9bf3d41118 RED
......@@ -52,8 +52,6 @@ import org.fortiss.af3.component.model.ComponentArchitecture;
import org.fortiss.af3.deployment.model.Deployment;
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.encoding.taskmapping.instantiatedmapping.InstantiatedTaskMappingEncoding;
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.encoding.taskmapping.instantiatedmapping.InstantiatedTaskMappingEntry;
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.solution.IScheduleSolution;
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.solution.StrictTTSchedule;
import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.SystemModelAdapter;
import org.fortiss.af3.exploration.alg.guava.MutableSubClassToInstanceMap;
import org.fortiss.af3.exploration.alg.guava.SubClassToInstanceMap;
......@@ -62,8 +60,8 @@ import org.fortiss.af3.exploration.model.ExplorationConstraint;
import org.fortiss.af3.exploration.model.ExplorationSpecification;
import org.fortiss.af3.exploration.model.ExplorationTarget;
import org.fortiss.af3.exploration.model.solutions.ExplorationResult;
import org.fortiss.af3.exploration.model.solutions.ExplorationSolutionSet;
import org.fortiss.af3.exploration.model.solutions.SingleExplorationSolutionMap;
import org.fortiss.af3.exploration.model.solutions.ExplorationSolution;
import org.fortiss.af3.exploration.model.solutions.SingleExplorationSolution;
import org.fortiss.af3.platform.model.PlatformArchitecture;
import org.fortiss.af3.project.model.FileProject;
import org.fortiss.tooling.kernel.extension.data.ITopLevelElement;
......@@ -158,13 +156,13 @@ public class XYPlotter extends JFrame implements ChartMouseListener, ActionListe
private JFreeChart currentChart;
/** holds/buffers the solution that has been selected in the chart */
private SingleExplorationSolutionMap currentSolution;
private SingleExplorationSolution currentSolution;
/** the DSE model containing the objective and constraint description */
private ExplorationSpecification expSpec;
/** The overall exploration result */
private ExplorationSolutionSet explorationResult;
private ExplorationSolution explorationResult;
/** The {@link SystemModelAdapter} that references the explored system. */
private SystemModelAdapter<?, ?, ?, ?, ?, ?, ?> exploredSystemModel;
......@@ -178,7 +176,7 @@ public class XYPlotter extends JFrame implements ChartMouseListener, ActionListe
/**
* maps the coordinates from the created points in the chart to a specific solution of the DSE
*/
private Map<XYDataItem, SingleExplorationSolutionMap> coordinateToSolution;
private Map<XYDataItem, SingleExplorationSolution> coordinateToSolution;
/** buffer for the list of goals that exist in the DSE model */
private List<ExplorationTarget<?>> goalList;
......@@ -200,17 +198,11 @@ public class XYPlotter extends JFrame implements ChartMouseListener, ActionListe
* @param title
* title of the dialog window
*/
public XYPlotter(ExplorationSpecification expSpec, ExplorationSolutionSet explorationResult,
public XYPlotter(ExplorationSpecification expSpec, ExplorationSolution explorationResult,
String title) {
super(title);
this.expSpec = expSpec;
this.explorationResult = explorationResult;
if(explorationResult
.getInputModelAdapter() instanceof SystemModelAdapter<?, ?, ?, ?, ?, ?, ?>) {
this.exploredSystemModel = (SystemModelAdapter<?, ?, ?, ?, ?, ?, ?>)explorationResult
.getInputModelAdapter();
}
// TODO: throw an Exception if the SystemModelAdapter is not there.
Xaxis = null;
Yaxis = null;
......@@ -466,7 +458,7 @@ public class XYPlotter extends JFrame implements ChartMouseListener, ActionListe
// add the result to series
coordinateToSolution.clear();
for(SingleExplorationSolutionMap solution : explorationResult.getSolutions()) {
for(SingleExplorationSolution solution : explorationResult.getSolutions()) {
/* Retrieve the solution values of the selected objectives. */
Map<ExplorationTarget<?>, ExplorationResult<?>> objValues =
solution.getSolutionMap().map();
......@@ -507,10 +499,10 @@ public class XYPlotter extends JFrame implements ChartMouseListener, ActionListe
XYDataItem item = new XYDataItem(x, y);
currentSolution = coordinateToSolution.get(item);
Optional<SingleExplorationSolutionMap> singleExpSol = explorationResult.getSolutions()
Optional<SingleExplorationSolution> singleExpSol = explorationResult.getSolutions()
.stream().filter(r -> r == currentSolution).findAny();
if(singleExpSol.isPresent()) {
SingleExplorationSolutionMap currentSolMap = singleExpSol.get();
SingleExplorationSolution currentSolMap = singleExpSol.get();
Map<ExplorationTarget<?>, ExplorationResult<?>> objectiveValues =
currentSolMap.getSolutionMap().map();
......@@ -600,21 +592,24 @@ public class XYPlotter extends JFrame implements ChartMouseListener, ActionListe
}
}
} else if("showschedule".equals(e.getActionCommand())) {
IScheduleSolution<?> scheduleSolution =
currentSolution.getSolutionModel(IScheduleSolution.class);
if(scheduleSolution instanceof StrictTTSchedule<?, ?>) {
SchedulePlotter sp = new SchedulePlotter((StrictTTSchedule<?, ?>)scheduleSolution);
sp.createPlot();
} else if(currentSolution == null) {
// No solution has been selected
JOptionPane.showMessageDialog(this,
"Cannot display a schedule : No Exploration Solution Selected!");
} else {
// The selected solution does not have a valid schedule type
JOptionPane.showMessageDialog(this,
"Cannot display a schedule : The selected solution provides no supported schedule!",
"Invalid schedule detected", JOptionPane.ERROR_MESSAGE);
}
JOptionPane.showMessageDialog(this,
"The schedule view is currently disabled due to a rework of the solution" +
" transformation framework.");
// IScheduleSolution<?> scheduleSolution =
// currentSolution.getSolutionModel(IScheduleSolution.class);
// if(scheduleSolution instanceof StrictTTSchedule<?, ?>) {
// SchedulePlotter sp = new SchedulePlotter((StrictTTSchedule<?, ?>)scheduleSolution);
// sp.createPlot();
// } else if(currentSolution == null) {
// // No solution has been selected
// JOptionPane.showMessageDialog(this,
// "Cannot display a schedule : No Exploration Solution Selected!");
// } else {
// // The selected solution does not have a valid schedule type
// JOptionPane.showMessageDialog(this,
// "Cannot display a schedule : The selected solution provides no supported schedule!",
// "Invalid schedule detected", JOptionPane.ERROR_MESSAGE);
// }
}
}
......@@ -624,7 +619,7 @@ public class XYPlotter extends JFrame implements ChartMouseListener, ActionListe
*
* @throws Exception
*/
private Deployment transformSingleDeployment(SingleExplorationSolutionMap solutionMap,
private Deployment transformSingleDeployment(SingleExplorationSolution solutionMap,
String deploymentName, boolean generateSCSpec) throws Exception {
// Deployment generation has NOT been cancelled.
if(deploymentName.isEmpty()) {
......@@ -713,7 +708,7 @@ public class XYPlotter extends JFrame implements ChartMouseListener, ActionListe
Collection<Deployment> transformedDeployments = new ArrayList<>();
Integer deploymentNumber = 1;
for(SingleExplorationSolutionMap solution : explorationResult.getSolutions()) {
for(SingleExplorationSolution solution : explorationResult.getSolutions()) {
transformedDeployments.add(transformSingleDeployment(solution,
deploymentName + "_" + deploymentNumber, generateSCSpec));
deploymentNumber++;
......
......@@ -8,5 +8,5 @@ IExplorationModule.java 8990c654e649f043fa9813b8bf9113ac7bd42d27 RED
IExplorationRepairService.java e923c43c49e0c83daef71707d5fdb66444f859f8 RED
IExplorationService.java 891b8c4ce01e40ab31bf69231a63fd61c57ac98e RED
IExplorationTargetEvaluator.java 9b39b44f64ad8195583b00f8e3852bbc912f75fc RED
IExplorationTransformationService.java aa63b9453ad395a111016cfd7fa7a30f35f4ea17 RED
IRepairModule.java c494db967181595e03557cbaef210514b2cfad66 RED
IExplorationTransformationService.java cb6f6f17d0def73ec680af98f30aa0f391723227 RED
IRepairModule.java 498a5b0ff519482af41db2916b1eefd1142cc9df RED
......@@ -24,7 +24,7 @@ import org.fortiss.af3.exploration.alg.dse.modeltransformation.ITransformationMo
import org.fortiss.af3.exploration.alg.dse.modeltransformation.ITransformationStrategy;
import org.fortiss.af3.exploration.alg.guava.SubClassToInstanceMap;
import org.fortiss.af3.exploration.alg.service.internal.ExplorationTransformationService;
import org.fortiss.af3.exploration.model.solutions.SingleExplorationSolutionMap;
import org.fortiss.af3.exploration.model.solutions.SingleExplorationSolution;
import org.fortiss.tooling.kernel.extension.data.ITopLevelElement;
import com.google.common.collect.ClassToInstanceMap;
......@@ -107,7 +107,7 @@ public interface IExplorationTransformationService
*/
<U extends EObject, S extends EObject> ClassToInstanceMap<U> getTransformedModels(
TransformationContext context, ITopLevelElement modelContext,
SingleExplorationSolutionMap solution, SubClassToInstanceMap<S> baseModels,
SingleExplorationSolution solution, SubClassToInstanceMap<S> baseModels,
Collection<Class<? extends EObject>> transformedModelTypes, String transformedModelName)
throws Exception;
......@@ -135,7 +135,7 @@ public interface IExplorationTransformationService
* demanded model, or if some required solution encoding was not passed.
*/
<U extends EObject, S extends EObject> U getTransformedModel(TransformationContext context,
ITopLevelElement modelContext, SingleExplorationSolutionMap solution,
ITopLevelElement modelContext, SingleExplorationSolution solution,
SubClassToInstanceMap<S> baseModels, Class<U> transformedModelType,
String transformedModelName) throws Exception;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment