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

Exploration.alg: AF3-Adapter cleanup.

* Isolate the property readout (from annotations) in single adapters.
* Reintegrate the ReplicationBound annotation.
* Add an additional parameter to the SystemModelAdapter.
refs 3262
parent e69ff571
No related branches found
No related tags found
No related merge requests found
Showing
with 52 additions and 54 deletions
......@@ -35,7 +35,7 @@ import org.opt4j.core.problem.Creator;
public class PartitionMappingCreator extends ComposableCreatorBase<PartitionMappingEncoding> {
/** Constructor. */
public PartitionMappingCreator(SystemModelAdapter<?, ?, ?, ?, ?, ?> systemModelAdapter,
public PartitionMappingCreator(SystemModelAdapter<?, ?, ?, ?, ?, ?, ?> systemModelAdapter,
DecoderDependencyGraph depGraph) {
super(systemModelAdapter, depGraph);
}
......
PlatformCommunicationGraphCreator.java dca11304889fd796f721c4035940290a602659fb RED
PlatformCommunicationGraphCreator.java 072bb6445dc182931ef28e47dbaad19ae87cc3d6 RED
......@@ -32,7 +32,7 @@ public class PlatformCommunicationGraphCreator
extends ComposableCreatorBase<PlatformCommunicationGraphEncoding> {
/** Constructor. */
public PlatformCommunicationGraphCreator(
SystemModelAdapter<?, ?, ?, ?, ?, ?> systemModelAdapter,
SystemModelAdapter<?, ?, ?, ?, ?, ?, ?> systemModelAdapter,
DecoderDependencyGraph depGraph) {
super(systemModelAdapter, depGraph);
}
......
SafetyFunctionArchCreator.java 8727cb4ecce45135ad5f6815d2dd0cb4c700b1ce RED
SafetyFunctionArchCreator.java 26770ef069fd786ecf579cbb761a1071073c975d RED
......@@ -36,7 +36,7 @@ public class SafetyFunctionArchCreator<C>
/** Constructor. */
@Inject
public SafetyFunctionArchCreator(SystemModelAdapter<C, ?, ?, ?, ?, ?> systemModelAdapter,
public SafetyFunctionArchCreator(SystemModelAdapter<C, ?, ?, ?, ?, ?, ?> systemModelAdapter,
DecoderDependencyGraph execDepGraph) {
super(systemModelAdapter, execDepGraph);
}
......
AbstractTaskMappingCreator.java 64a04dad3e653ee9b5bd91dfa842e2043eda3e94 RED
FailSilentTaskMappingCreator.java 6aa1828a87ab6bdaa8077101e004fe4ddddd8a7f RED
FaultDetectionVotingTaskMappingCreator.java 2cc96c6197eaafa803b9794246ff40346802342a RED
TaskMappingCreator.java d3c381308b8c8cafda84feed0ea443f62ea563d3 RED
AbstractTaskMappingCreator.java 1e4473c63abb2aa49b0d85a96ad0de025f42bebb RED
FailSilentTaskMappingCreator.java ec7daa0d1bd3c42eedc69a5d955269e7ff3798d0 RED
FaultDetectionVotingTaskMappingCreator.java 34efb7f7574f833aac75c8f4f80d4d5da0dd9c37 RED
TaskMappingCreator.java e5aa46677ddc797f92847dfe3179a22424a780f8 RED
......@@ -45,7 +45,7 @@ public class AbstractTaskMappingCreator
/** Constructor */
@Inject
public AbstractTaskMappingCreator(DseSpecification dse,
SystemModelAdapter<?, ?, ?, ?, ?, ?> systemModelAdapter,
SystemModelAdapter<?, ?, ?, ?, ?, ?, ?> systemModelAdapter,
DecoderDependencyGraph execDepGraph) {
super(dse, systemModelAdapter, execDepGraph);
}
......
......@@ -45,7 +45,7 @@ public class FailSilentTaskMappingCreator
*/
@Inject
public FailSilentTaskMappingCreator(DseSpecification dse,
SystemModelAdapter<?, ?, ?, ?, ?, ?> systemModelAdapter,
SystemModelAdapter<?, ?, ?, ?, ?, ?, ?> systemModelAdapter,
DecoderDependencyGraph execDepGraph) {
super(dse, systemModelAdapter, execDepGraph);
}
......
......@@ -45,7 +45,7 @@ public class FaultDetectionVotingTaskMappingCreator extends
*/
@Inject
public FaultDetectionVotingTaskMappingCreator(DseSpecification dse,
SystemModelAdapter<?, ?, ?, ?, ?, ?> systemModelAdapter,
SystemModelAdapter<?, ?, ?, ?, ?, ?, ?> systemModelAdapter,
DecoderDependencyGraph execDepGraph) {
super(dse, systemModelAdapter, execDepGraph);
}
......
......@@ -43,7 +43,7 @@ public abstract class TaskMappingCreator<S extends TaskMappingEntry<ITaskAdapter
/** Constructor. */
@Inject
public TaskMappingCreator(DseSpecification dse,
SystemModelAdapter<?, ?, ?, ?, ?, ?> systemModelAdapter,
SystemModelAdapter<?, ?, ?, ?, ?, ?, ?> systemModelAdapter,
DecoderDependencyGraph execDepGraph) {
super(systemModelAdapter, execDepGraph);
this.dse = dse;
......
Partition.java b870fdd306818d8195b662daee9546feebb28e18 RED
PartitionMappingEncoding.java 09dd8deba0a922ba9f5bdf8138676e945095edfc RED
PartitionMappingEncoding.java 345a25f0324c07a8e4c5b83d2cabeae2ba7c9608 RED
PartitionMappingEntry.java 2f8f082e6bcd49dbe2f5ba88724850b54b20d637 RED
......@@ -52,7 +52,7 @@ public class PartitionMappingEncoding extends
/** Constructor. */
// TODO: The strategy can be replaced by lambdas for a cleaner design.
public PartitionMappingEncoding(SystemModelAdapter<?, ?, ?, ?, ?, ?> systemModelAdapter,
public PartitionMappingEncoding(SystemModelAdapter<?, ?, ?, ?, ?, ?, ?> systemModelAdapter,
CREATE_STARTEGY strategy) {
// Number of tasks to deploy
// TODO: This does not consider task replicas yet.
......
PlatformCommunicationGraphEncoding.java cf2aba24c9e569e37996e57b2df017f83a3e28db RED
PlatformCommunicationGraphEncoding.java 5cd55e1eb23fdb27389dd95ef7edaf16bb4bc01e RED
......@@ -18,8 +18,8 @@ package org.fortiss.af3.exploration.alg.dse.backend.opt4j.encoding.platform;
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.encoding.partitionmapping.PartitionMappingEncoding;
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.extensions.compositegene.genotype.ComposableGenotype;
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.extensions.compositegene.phenotype.ComposablePhenotype;
import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.ITaskAdapter;
import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.IResourceAdapter;
import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.ITaskAdapter;
import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.SystemModelAdapter;
import org.fortiss.af3.exploration.alg.graph.display.JGraphTVisualizer;
import org.fortiss.af3.exploration.alg.service.IExplorationEncoding;
......@@ -38,14 +38,14 @@ public class PlatformCommunicationGraphEncoding implements IExplorationEncoding,
ComposablePhenotype<PartitionMappingEncoding>, Cloneable {
/** Representation of input system model */
protected SystemModelAdapter<?, ?, ?, ?, ?, ?> systemModelAdapter;
protected SystemModelAdapter<?, ?, ?, ?, ?, ?, ?> systemModelAdapter;
/** The graph representing the communication structure of a platform. */
protected DirectedGraph<IResourceAdapter<?>, DefaultEdge> platformGraph;
/** Constructor for the initial version of the Graph w/o available Partitions. */
public PlatformCommunicationGraphEncoding(
SystemModelAdapter<?, ?, ?, ?, ?, ?> systemModelAdapter,
SystemModelAdapter<?, ?, ?, ?, ?, ?, ?> systemModelAdapter,
DirectedGraph<IResourceAdapter<?>, DefaultEdge> platformGraph) {
this.systemModelAdapter = systemModelAdapter;
this.platformGraph = platformGraph;
......@@ -53,7 +53,7 @@ public class PlatformCommunicationGraphEncoding implements IExplorationEncoding,
/** Copy constructor. */
protected PlatformCommunicationGraphEncoding(
SystemModelAdapter<?, ?, ?, ?, ?, ?> systemModelAdapter) {
SystemModelAdapter<?, ?, ?, ?, ?, ?, ?> systemModelAdapter) {
this.systemModelAdapter = systemModelAdapter;
}
......
AbstractTaskGraphEncoding.java 79c2482106c0fa2895dc5ca2760bc68e8199ea89 RED
InstantiatedAcyclicTaskGraphEncoding.java 5446f693086aaa2a0b39e1c8180af186a7c55809 RED
InstantiatedTaskGraphEncoding.java 1ffb6b33efb6673d51a8ef99822caf42f43b2782 RED
SafeTaskGraphEncoding.java 49f4c06f6db45e7751794bcc7e3892570c8daa29 RED
TaskGraphEncoding.java e9d40278aca607bd27a817c4859b493ef4c32ce3 RED
AbstractTaskGraphEncoding.java 5978cc6ab893cbd36e337da149b23f728885a923 RED
InstantiatedAcyclicTaskGraphEncoding.java d350697fc6ce436f0eb7466be1462b922f35f1ef RED
InstantiatedTaskGraphEncoding.java 9ac64514fb83bbc4f0258b3fc40ac40bd76a5f83 RED
SafeTaskGraphEncoding.java 2df896a20d2f1759b07de59385df00440a20e8a2 RED
TaskGraphEncoding.java 2b90454bea36e75301633fdeec83cf9a874d7269 RED
......@@ -31,7 +31,7 @@ public class AbstractTaskGraphEncoding<G extends ComposableGenotype, C>
extends TaskGraphEncoding<G, C, DefaultTaskGraph<?>> {
/** Constructor. See {@link TaskGraphEncoding#TaskGraphEncoding(SystemModelAdapter)}. */
public AbstractTaskGraphEncoding(SystemModelAdapter<C, ?, ?, ?, ?, ?> systemModelAdapter) {
public AbstractTaskGraphEncoding(SystemModelAdapter<C, ?, ?, ?, ?, ?, ?> systemModelAdapter) {
super(systemModelAdapter);
}
......
......@@ -39,14 +39,14 @@ public class InstantiatedAcyclicTaskGraphEncoding<T extends InstantiatedTaskMapp
* Constructor. See {@link TaskGraphEncoding#TaskGraphEncoding(SystemModelAdapter, Collection)}.
*/
public InstantiatedAcyclicTaskGraphEncoding(
SystemModelAdapter<C, ?, ?, ?, ?, ?> systemModelAdapter,
SystemModelAdapter<C, ?, ?, ?, ?, ?, ?> systemModelAdapter,
Collection<DefaultTaskGraph<?>> taskGraphs) {
super(systemModelAdapter, AcyclicTaskGraph.transformToAcyclicGraphs(taskGraphs));
}
/** Constructor. See {@link TaskGraphEncoding#TaskGraphEncoding(SystemModelAdapter)}. */
public InstantiatedAcyclicTaskGraphEncoding(
SystemModelAdapter<C, ?, ?, ?, ?, ?> systemModelAdapter) {
SystemModelAdapter<C, ?, ?, ?, ?, ?, ?> systemModelAdapter) {
super(systemModelAdapter);
}
......
......@@ -35,13 +35,14 @@ public class InstantiatedTaskGraphEncoding<T extends InstantiatedTaskMappingEntr
/**
* Constructor. See {@link TaskGraphEncoding#TaskGraphEncoding(SystemModelAdapter, Collection)}.
*/
public InstantiatedTaskGraphEncoding(SystemModelAdapter<C, ?, ?, ?, ?, ?> systemModelAdapter,
public InstantiatedTaskGraphEncoding(SystemModelAdapter<C, ?, ?, ?, ?, ?, ?> systemModelAdapter,
Collection<DefaultTaskGraph<?>> taskGraphs) {
super(systemModelAdapter, taskGraphs);
}
/** Constructor. See {@link TaskGraphEncoding#TaskGraphEncoding(SystemModelAdapter)}. */
public InstantiatedTaskGraphEncoding(SystemModelAdapter<C, ?, ?, ?, ?, ?> systemModelAdapter) {
public InstantiatedTaskGraphEncoding(
SystemModelAdapter<C, ?, ?, ?, ?, ?, ?> systemModelAdapter) {
super(systemModelAdapter);
}
......
......@@ -26,11 +26,11 @@ import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.taskgraph.TaskGraph;
*
* @author diewald
*/
public class SafeTaskGraphEncoding<C> extends
AbstractTaskGraphEncoding<SafetyFunctionArchEncoding<C>, C> {
public class SafeTaskGraphEncoding<C>
extends AbstractTaskGraphEncoding<SafetyFunctionArchEncoding<C>, C> {
/** Constructor. See {@link TaskGraphEncoding#TaskGraphEncoding(SystemModelAdapter)}. */
public SafeTaskGraphEncoding(SystemModelAdapter<C, ?, ?, ?, ?, ?> systemModelAdapter) {
public SafeTaskGraphEncoding(SystemModelAdapter<C, ?, ?, ?, ?, ?, ?> systemModelAdapter) {
super(systemModelAdapter);
}
......
......@@ -24,10 +24,10 @@ import java.util.stream.Collectors;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.extensions.compositegene.phenotype.ComposablePhenotype;
import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.ITaskAdapter;
import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.IExecutionUnitAdapter;
import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.ITaskAdapter;
import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.SystemModelAdapter;
import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.taskgraph.ChannelAdapterWeightedEdge;
import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.taskgraph.SignalAdapterWeightedEdge;
import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.taskgraph.TaskGraph;
import org.fortiss.af3.exploration.alg.service.IExplorationEncoding;
import org.fortiss.af3.platform.model.ExecutionUnit;
......@@ -43,7 +43,7 @@ public class TaskGraphEncoding<G extends Genotype, C, T extends TaskGraph>
implements IExplorationEncoding, ComposablePhenotype<G>, Cloneable {
/** References the {@link SystemModelAdapter} which adapts the input models. */
protected SystemModelAdapter<C, ?, ?, ?, ?, ?> systemModelAdapter;
protected SystemModelAdapter<C, ?, ?, ?, ?, ?, ?> systemModelAdapter;
/** {@link TaskGraph} that represents the deployable components and their signals. */
protected Collection<T> taskGraphs;
......@@ -65,7 +65,7 @@ public class TaskGraphEncoding<G extends Genotype, C, T extends TaskGraph>
* {@link ITaskAdapter}s as they are extracted from the input models.
*/
@SuppressWarnings("unchecked")
public TaskGraphEncoding(SystemModelAdapter<C, ?, ?, ?, ?, ?> systemModelAdapter) {
public TaskGraphEncoding(SystemModelAdapter<C, ?, ?, ?, ?, ?, ?> systemModelAdapter) {
this.systemModelAdapter = systemModelAdapter;
taskGraphs = (Collection<T>)systemModelAdapter.getTaskGraphs().stream().map(tg -> tg.copy())
......@@ -79,7 +79,7 @@ public class TaskGraphEncoding<G extends Genotype, C, T extends TaskGraph>
* Constructor that initializes {@code this} encoding with the collection of
* {@link ITaskAdapter}s as they are extracted from the input models.
*/
public TaskGraphEncoding(SystemModelAdapter<C, ?, ?, ?, ?, ?> systemModelAdapter,
public TaskGraphEncoding(SystemModelAdapter<C, ?, ?, ?, ?, ?, ?> systemModelAdapter,
Collection<T> taskGraphs) {
this(systemModelAdapter);
this.taskGraphs = taskGraphs;
......@@ -159,17 +159,17 @@ public class TaskGraphEncoding<G extends Genotype, C, T extends TaskGraph>
assert (taskGraph != null);
TaskGraph systemTG = systemModelAdapter.getTaskGraph(task);
Collection<ChannelAdapterWeightedEdge> incomingEdges =
Collection<SignalAdapterWeightedEdge> incomingEdges =
systemTG.getGraph().incomingEdgesOf(task);
Collection<ChannelAdapterWeightedEdge> outgoingEdges =
Collection<SignalAdapterWeightedEdge> outgoingEdges =
systemTG.getGraph().outgoingEdgesOf(task);
for(ChannelAdapterWeightedEdge edge : incomingEdges) {
for(SignalAdapterWeightedEdge edge : incomingEdges) {
ITaskAdapter<?> source = systemTG.getGraph().getEdgeSource(edge);
taskGraph.getGraph().addEdge(source, task, edge);
}
for(ChannelAdapterWeightedEdge edge : outgoingEdges) {
for(SignalAdapterWeightedEdge edge : outgoingEdges) {
ITaskAdapter<?> target = systemTG.getGraph().getEdgeTarget(edge);
taskGraph.getGraph().addEdge(task, target, edge);
}
......@@ -179,29 +179,28 @@ public class TaskGraphEncoding<G extends Genotype, C, T extends TaskGraph>
* Adds the signals of a cloned task by querying the existing signals from the clone's original
* task.
*/
public void addClonedSignalsOf(ITaskAdapter<C> originalTask,
ITaskAdapter<C> clonedTask) {
public void addClonedSignalsOf(ITaskAdapter<C> originalTask, ITaskAdapter<C> clonedTask) {
// The given task must be in the any of the task graphs!
T taskGraph = getGraphOf(originalTask, taskGraphs);
// TODO: This should be transformed into an exception.
assert (taskGraph != null);
Collection<ChannelAdapterWeightedEdge> incomingEdges =
Collection<SignalAdapterWeightedEdge> incomingEdges =
taskGraph.getGraph().incomingEdgesOf(originalTask);
Collection<ChannelAdapterWeightedEdge> outgoingEdges =
Collection<SignalAdapterWeightedEdge> outgoingEdges =
taskGraph.getGraph().outgoingEdgesOf(originalTask);
for(ChannelAdapterWeightedEdge edge : incomingEdges) {
for(SignalAdapterWeightedEdge edge : incomingEdges) {
ITaskAdapter<?> source = taskGraph.getGraph().getEdgeSource(edge);
taskGraph.getGraph().addEdge(source, clonedTask,
new ChannelAdapterWeightedEdge(edge.getChannelAdapter()));
new SignalAdapterWeightedEdge(edge.getSignalAdapter()));
}
for(ChannelAdapterWeightedEdge edge : outgoingEdges) {
for(SignalAdapterWeightedEdge edge : outgoingEdges) {
ITaskAdapter<?> target = taskGraph.getGraph().getEdgeTarget(edge);
taskGraph.getGraph().addEdge(clonedTask, target,
new ChannelAdapterWeightedEdge(edge.getChannelAdapter()));
new SignalAdapterWeightedEdge(edge.getSignalAdapter()));
}
}
......@@ -279,8 +278,7 @@ public class TaskGraphEncoding<G extends Genotype, C, T extends TaskGraph>
* @return The asociated {@link ITaskAdapter}, or {@code null} if none can be
* identified.
*/
public synchronized ITaskAdapter<C>
getDeployableComponentOf(EObject originalEObject) {
public synchronized ITaskAdapter<C> getDeployableComponentOf(EObject originalEObject) {
for(ITaskAdapter<C> deployableComponentAdapter : deployableComponents) {
if(deployableComponentAdapter.getObject() == originalEObject) {
return deployableComponentAdapter;
......@@ -302,8 +300,7 @@ public class TaskGraphEncoding<G extends Genotype, C, T extends TaskGraph>
* only those {@link ITaskAdapter} are searched which can be actually executed on
* {@link ExecutionUnit}s, i.e. "abstract" components are not considered.
*/
public ITaskAdapter<C>
getReplicableDeployableComponentOf(EObject originalEObject) {
public ITaskAdapter<C> getReplicableDeployableComponentOf(EObject originalEObject) {
for(ITaskAdapter<C> deployableComponentAdapter : replicableComponents) {
if(deployableComponentAdapter.getObject() == originalEObject) {
return deployableComponentAdapter;
......
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