diff --git a/org.fortiss.af3.exploration.alg/.classpath b/org.fortiss.af3.exploration.alg/.classpath index 00cba46552ec46802617357ac8cb3914d42fe7a5..fae71bc9c8a5002c7abf572924b8c9c29754501b 100644 --- a/org.fortiss.af3.exploration.alg/.classpath +++ b/org.fortiss.af3.exploration.alg/.classpath @@ -14,12 +14,10 @@ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src"/> <classpathentry kind="src" path="generated-src"/> - <classpathentry kind="lib" path="lib/jgrapht-core-0.9.0.jar" sourcepath="lib/jgrapht-0.9.0-src.jar"/> <classpathentry exported="true" kind="lib" path="lib/opt4j-core-3.1.3.jar" sourcepath="lib/opt4j-source-3.1.3.jar"/> <classpathentry kind="lib" path="lib/opt4j-operators-3.1.3.jar" sourcepath="lib/opt4j-source-3.1.3.jar"/> <classpathentry exported="true" kind="lib" path="lib/aopalliance-1.0.jar"/> <classpathentry exported="true" kind="lib" path="lib/apfloat.jar"/> - <classpathentry exported="true" kind="lib" path="lib/jgrapht-ext-0.9.0.jar"/> <classpathentry exported="true" kind="lib" path="lib/jgraphx-2.0.0.1.jar"/> <classpathentry kind="lib" path="lib/guice-assistedinject-4.0.jar" sourcepath="lib/guice-assistedinject-4.0-sources.jar"/> <classpathentry kind="lib" path="lib/guice-4.0.jar" sourcepath="lib/guice-4.0-sources.jar"/> diff --git a/org.fortiss.af3.exploration.alg/META-INF/MANIFEST.MF b/org.fortiss.af3.exploration.alg/META-INF/MANIFEST.MF index 2034cd74c7bf729fe864499fe3ae3e1596f66a3b..139f0ac0c99c1971dc755a96b053834642496aa8 100644 --- a/org.fortiss.af3.exploration.alg/META-INF/MANIFEST.MF +++ b/org.fortiss.af3.exploration.alg/META-INF/MANIFEST.MF @@ -4,12 +4,10 @@ Bundle-Name: Exploration Algorithms Bundle-SymbolicName: org.fortiss.af3.exploration.alg;singleton:=true Bundle-Version: 2.13.0.qualifier Bundle-ClassPath: ., - lib/jgrapht-core-0.9.0.jar, lib/opt4j-core-3.1.3.jar, lib/opt4j-operators-3.1.3.jar, lib/aopalliance-1.0.jar, lib/apfloat.jar, - lib/jgrapht-ext-0.9.0.jar, lib/jgraphx-2.0.0.1.jar, lib/guice-assistedinject-4.0.jar, lib/guice-4.0.jar, diff --git a/org.fortiss.af3.exploration.alg/build.properties b/org.fortiss.af3.exploration.alg/build.properties index c386e92f795ba56ccbab37f94568f90d1eeeabfa..7bb41c51fe86ac498c67d6b850d5330cf8951142 100644 --- a/org.fortiss.af3.exploration.alg/build.properties +++ b/org.fortiss.af3.exploration.alg/build.properties @@ -6,13 +6,11 @@ bin.includes = .,\ plugin.properties,\ lib/aopalliance-1.0.jar,\ lib/apfloat.jar,\ - lib/jgrapht-core-0.9.0.jar,\ lib/licenses/,\ lib/opt4j-core-3.1.3.jar,\ lib/opt4j-operators-3.1.3.jar,\ lib/opt4j-satdecoding-3.1.3.jar,\ lib/opt4j-viewer-3.1.3.jar,\ - lib/jgrapht-ext-0.9.0.jar,\ lib/jgraphx-2.0.0.1.jar,\ lib/guice-assistedinject-4.0.jar,\ lib/guice-4.0.jar,\ diff --git a/org.fortiss.af3.exploration.alg/lib/jgrapht-0.9.0-src.jar b/org.fortiss.af3.exploration.alg/lib/jgrapht-0.9.0-src.jar deleted file mode 100644 index 1c5c5c91460cc81a3ace08f2b72ad42697c59c5f..0000000000000000000000000000000000000000 Binary files a/org.fortiss.af3.exploration.alg/lib/jgrapht-0.9.0-src.jar and /dev/null differ diff --git a/org.fortiss.af3.exploration.alg/lib/jgrapht-core-0.9.0.jar b/org.fortiss.af3.exploration.alg/lib/jgrapht-core-0.9.0.jar deleted file mode 100644 index 88aecca16086b067886a08cb415e384ea8bcda35..0000000000000000000000000000000000000000 Binary files a/org.fortiss.af3.exploration.alg/lib/jgrapht-core-0.9.0.jar and /dev/null differ diff --git a/org.fortiss.af3.exploration.alg/lib/jgrapht-ext-0.9.0.jar b/org.fortiss.af3.exploration.alg/lib/jgrapht-ext-0.9.0.jar deleted file mode 100644 index a0dc32a1777a81a884923605dfa152bc74be96fd..0000000000000000000000000000000000000000 Binary files a/org.fortiss.af3.exploration.alg/lib/jgrapht-ext-0.9.0.jar and /dev/null differ diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/.ratings b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/.ratings index 09629640790fc796517b65d2b55d14b69dd82bf9..e8b8d3944b2da30e15b6cbdb646db13fc6d6a63a 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/.ratings +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/.ratings @@ -1,6 +1,6 @@ -CompositeExplorationSolution.java 88849af9f8a52684cc523f89e235599e16dd9ac3 RED -DSEFactory.java 0a2f2cc6a197e760c1f8223339ffa5f16856b184 RED -Explorer.java 2194a74cbe51ca9e7dafb008dcefb51a54064dc8 RED -ImplicitExplorationTargetFactory.java 6c16c6712886b549dda0a73aef4a4c3fe18c1850 RED -SolutionQuantification.java efd31f192c3adbf1a4434452a19eb836a17390e2 RED -TaskMappingFactory.java 5e41df9d45e338dbcfa95bc3818ca17774951893 RED +CompositeExplorationSolution.java 88849af9f8a52684cc523f89e235599e16dd9ac3 RED +DSEFactory.java 9058870515a9162b0ec14685fc19bf6d1dfed0c2 RED +Explorer.java 2194a74cbe51ca9e7dafb008dcefb51a54064dc8 RED +ImplicitExplorationTargetFactory.java 6c16c6712886b549dda0a73aef4a4c3fe18c1850 RED +SolutionQuantification.java efd31f192c3adbf1a4434452a19eb836a17390e2 RED +TaskMappingFactory.java 5e41df9d45e338dbcfa95bc3818ca17774951893 RED diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/DSEFactory.java b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/DSEFactory.java index ae8a0f876a1db3372d116066db10aa1e736980ab..9058870515a9162b0ec14685fc19bf6d1dfed0c2 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/DSEFactory.java +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/DSEFactory.java @@ -68,7 +68,6 @@ import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.SystemModelAdapter; import org.fortiss.af3.exploration.moea.model.DseSpecification; import org.fortiss.af3.exploration.moea.model.feature.SafetyExploration; import org.fortiss.af3.exploration.moea.model.parameters.ExecutionModel; -import org.jgrapht.experimental.dag.DirectedAcyclicGraph.CycleFoundException; /** * Factory to create exploration problems solved by the DSE. It is used to create the single parts @@ -118,7 +117,8 @@ public class DSEFactory { * if (one of) the sub problem(s) cannot be registered. */ @SuppressWarnings("unchecked") - public <C, S extends InstantiatedTaskMappingEntry, T extends InstantiatedTaskMappingEncoding<S>> + public + <C, S extends InstantiatedTaskMappingEntry, T extends InstantiatedTaskMappingEncoding<S>> void createSubProblems(ArchitectureExplorationProblemModule archExpProblemModule, DseSpecification dse, DecoderDependencyGraph execDepGraph) throws Exception { // Java-limitation: it is not possible to pass the generic to the static methods. @@ -194,18 +194,19 @@ public class DSEFactory { * The design space exploration description. * @param execDepGraph * Dependency graph defining the execution order. - * @throws CycleFoundException + * @throws IllegalArgumentException * if a cyclic dependency is discovered when registering the problem. */ @SuppressWarnings("unchecked") private void createPartitionMappingProblem( ArchitectureExplorationProblemModule archExpProblemModule, DseSpecification dse, - DecoderDependencyGraph execDepGraph) throws CycleFoundException { + DecoderDependencyGraph execDepGraph) throws IllegalArgumentException { Class<PartitionMappingEncoding> pmEnodingClass = PartitionMappingEncoding.class; - PartitionMappingCreator pmCreator = new PartitionMappingCreator(execDepGraph, - (Collection<IExecutionUnitAdapter<?>>)(Collection<?>)systemModelAdapter - .getDeploymentTargets(), - systemModelAdapter.getDeployableComponents().size()); + PartitionMappingCreator pmCreator = + new PartitionMappingCreator(execDepGraph, + (Collection<IExecutionUnitAdapter<?>>)(Collection<?>)systemModelAdapter + .getDeploymentTargets(), systemModelAdapter + .getDeployableComponents().size()); @SuppressWarnings("rawtypes") List<ComposableDecoder> pmDecoders = new ArrayList<>(); PartitionMappingIdentityDecoder pmDecoder = new PartitionMappingIdentityDecoder(); @@ -226,20 +227,19 @@ public class DSEFactory { @SuppressWarnings("unchecked") private void createPlatformCommunicationGraphProblem( ArchitectureExplorationProblemModule archExpProblemModule, - DecoderDependencyGraph execDepGraph) throws CycleFoundException { + DecoderDependencyGraph execDepGraph) throws IllegalArgumentException { Class<PlatformCommunicationGraphEncoding> pmEnodingClass = PlatformCommunicationGraphEncoding.class; - PlatformCommunicationGraphCreator pmCreator = new PlatformCommunicationGraphCreator( - execDepGraph, - (Collection<IExecutionUnitAdapter<?>>)(Collection<?>)systemModelAdapter - .getDeploymentTargets(), - (Collection<IMemoryUnitAdapter<?>>)(Collection<?>)systemModelAdapter - .getMemoryUnits(), - (Collection<IGatewayUnitAdapter<?>>)(Collection<?>)systemModelAdapter - .getGatewayUnits(), - (Collection<ITransmissionUnitAdapter<?>>)(Collection<?>)systemModelAdapter - .getTransmissionUnits(), - systemModelAdapter.getResouceConnections()); + PlatformCommunicationGraphCreator pmCreator = + new PlatformCommunicationGraphCreator(execDepGraph, + (Collection<IExecutionUnitAdapter<?>>)(Collection<?>)systemModelAdapter + .getDeploymentTargets(), + (Collection<IMemoryUnitAdapter<?>>)(Collection<?>)systemModelAdapter + .getMemoryUnits(), + (Collection<IGatewayUnitAdapter<?>>)(Collection<?>)systemModelAdapter + .getGatewayUnits(), + (Collection<ITransmissionUnitAdapter<?>>)(Collection<?>)systemModelAdapter + .getTransmissionUnits(), systemModelAdapter.getResouceConnections()); @SuppressWarnings("rawtypes") List<ComposableDecoder> pmDecoders = new ArrayList<>(); PartitionMappingDecoderGraph pmgDecoder = new PartitionMappingDecoderGraph(); @@ -269,8 +269,8 @@ public class DSEFactory { @SuppressWarnings("unchecked") private <S extends InstantiatedTaskMappingEntry, T extends InstantiatedTaskMappingEncoding<S>> void createAbstractTaskMappingProblem(TaskMappingFactory<S, T> tmFactory, - ArchitectureExplorationProblemModule archExpProblemModule, DseSpecification dse, - DecoderDependencyGraph execDepGraph) throws Exception { + ArchitectureExplorationProblemModule archExpProblemModule, + DseSpecification dse, DecoderDependencyGraph execDepGraph) throws Exception { Class<AbstractTaskMappingEncoding> tmEnodingClass = AbstractTaskMappingEncoding.class; AbstractTaskMappingCreator tmCreator = tmFactory.createAbstractTaskMappingCreator(dse, execDepGraph); @@ -310,8 +310,8 @@ public class DSEFactory { @SuppressWarnings("unchecked") private <S extends InstantiatedTaskMappingEntry, T extends InstantiatedTaskMappingEncoding<S>> void createTaskMappingInstantiationProblem(TaskMappingFactory<S, T> tmFactory, - ArchitectureExplorationProblemModule archExpProblemModule, DseSpecification dse, - DecoderDependencyGraph execDepGraph) throws Exception { + ArchitectureExplorationProblemModule archExpProblemModule, + DseSpecification dse, DecoderDependencyGraph execDepGraph) throws Exception { // These suppress warnings are required since type erasure in Java does not allow to pass // XY<Z>.class. StrictTTDecoder<S, T> tmDecoder = tmFactory.createStrictTTDecoder(dse); @@ -352,8 +352,8 @@ public class DSEFactory { */ @SuppressWarnings("unchecked") public <S extends TaskMappingEntry<?, Partition>> - TaskMappingFactory<?, ? extends TaskMappingEncoding<?, S>> - createTaskMappingFactory(ExecutionModel execModel) throws UnsupportedDataTypeException { + TaskMappingFactory<?, ? extends TaskMappingEncoding<?, S>> createTaskMappingFactory( + ExecutionModel execModel) throws UnsupportedDataTypeException { // TODO: Remove the error-prone casting. Remove the differentiation between the failure // modes here as well? switch(execModel) { diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/create/platform/.ratings b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/create/platform/.ratings index 8581fab183fd7b440ada1fc4e78bd8385033085d..8002e52c4f0e51c058003c00d26e6615fbfe1664 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/create/platform/.ratings +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/create/platform/.ratings @@ -1 +1 @@ -PlatformCommunicationGraphCreator.java fd016186eea8e716f9f6699b46c5d386acf2db8a RED +PlatformCommunicationGraphCreator.java 8646b13de703d33b83b0729820cc747cf1b28fb8 RED diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/create/platform/PlatformCommunicationGraphCreator.java b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/create/platform/PlatformCommunicationGraphCreator.java index 54301f92ded2065b76a45ad27aeb6a8dcbac01fb..8646b13de703d33b83b0729820cc747cf1b28fb8 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/create/platform/PlatformCommunicationGraphCreator.java +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/create/platform/PlatformCommunicationGraphCreator.java @@ -31,7 +31,6 @@ import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.IResourceConnectionAdap import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.IResourceConnectionAdapter.ConnectionType; import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.ITransmissionUnitAdapter; import org.fortiss.af3.exploration.alg.service.IExplorationEncoding; -import org.jgrapht.DirectedGraph; import org.jgrapht.Graphs; import org.jgrapht.graph.DefaultDirectedGraph; import org.jgrapht.graph.DefaultEdge; @@ -40,8 +39,8 @@ import org.jgrapht.graph.DefaultEdge; * * @author diewald */ -public class PlatformCommunicationGraphCreator - extends ComposableCreatorBase<PlatformCommunicationGraphEncoding> { +public class PlatformCommunicationGraphCreator extends + ComposableCreatorBase<PlatformCommunicationGraphEncoding> { /** Execution Units present in the input models. */ private Collection<IExecutionUnitAdapter<?>> execUnits; /** Memories present in the input models. */ @@ -72,9 +71,9 @@ public class PlatformCommunicationGraphCreator @Override public PlatformCommunicationGraphEncoding createComposable(FlatGenotypeMap createdGenotypes, FlatPhenotypeMap<Phenotype> decodedPhenotypes) { - DirectedGraph<IResourceAdapter<?>, DefaultEdge> tempPlatformCommGraph = + DefaultDirectedGraph<IResourceAdapter<?>, DefaultEdge> tempPlatformCommGraph = new DefaultDirectedGraph<IResourceAdapter<?>, DefaultEdge>(DefaultEdge.class); - DirectedGraph<IResourceAdapter<?>, DefaultEdge> platformGraph = + DefaultDirectedGraph<IResourceAdapter<?>, DefaultEdge> platformGraph = new DefaultDirectedGraph<IResourceAdapter<?>, DefaultEdge>(DefaultEdge.class); // Add all resources present in the platform as vertices to the "connection graph" @@ -91,12 +90,10 @@ public class PlatformCommunicationGraphCreator // If the current resource is a child of a {@link TransmissionUnit} (like a NoC // router), respect the direction of connections such that complex networks are // correctly reflected. - if(connection - .getConnectionType(currentReceiverResource) == ConnectionType.OUTGOING) { + if(connection.getConnectionType(currentReceiverResource) == ConnectionType.OUTGOING) { Graphs.addEdgeWithVertices(platformGraph, connection.getSourceResource(), currentReceiverResource); - } else if(connection - .getConnectionType(currentReceiverResource) == ConnectionType.INCOMING) { + } else if(connection.getConnectionType(currentReceiverResource) == ConnectionType.INCOMING) { Graphs.addEdgeWithVertices(platformGraph, currentReceiverResource, connection.getSourceResource()); } else { diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/encoding/platform/.ratings b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/encoding/platform/.ratings index d5a16a58dda581a60afc1af2c6111c6167b389d3..989043b3799ca9343bf1e656843bce2bf7dd1640 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/encoding/platform/.ratings +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/encoding/platform/.ratings @@ -1 +1 @@ -PlatformCommunicationGraphEncoding.java 69cdf4968c8572f70b4360b0c027cf6cbfd28a92 RED +PlatformCommunicationGraphEncoding.java a7a3d7b1e05ea0ab4350042693eda3ad8bf6b76e RED diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/encoding/platform/PlatformCommunicationGraphEncoding.java b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/encoding/platform/PlatformCommunicationGraphEncoding.java index e44f92b6a282bcb9dff02ed1a81653af69bb215d..a7a3d7b1e05ea0ab4350042693eda3ad8bf6b76e 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/encoding/platform/PlatformCommunicationGraphEncoding.java +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/encoding/platform/PlatformCommunicationGraphEncoding.java @@ -15,6 +15,7 @@ +--------------------------------------------------------------------------*/ package org.fortiss.af3.exploration.alg.dse.backend.opt4j.encoding.platform; +import org.eclipse.draw2d.graph.DirectedGraph; 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; @@ -22,7 +23,7 @@ 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.graph.display.JGraphTVisualizer; import org.fortiss.af3.exploration.alg.service.IExplorationEncoding; -import org.jgrapht.DirectedGraph; +import org.jgrapht.graph.DefaultDirectedGraph; import org.jgrapht.graph.DefaultEdge; /** @@ -33,14 +34,14 @@ import org.jgrapht.graph.DefaultEdge; * * @author diewald */ -public class PlatformCommunicationGraphEncoding implements IExplorationEncoding, ComposableGenotype, - ComposablePhenotype<PartitionMappingEncoding>, Cloneable { +public class PlatformCommunicationGraphEncoding implements IExplorationEncoding, + ComposableGenotype, ComposablePhenotype<PartitionMappingEncoding>, Cloneable { /** The graph representing the communication structure of a platform. */ - protected DirectedGraph<IResourceAdapter<?>, DefaultEdge> platformGraph; + protected DefaultDirectedGraph<IResourceAdapter<?>, DefaultEdge> platformGraph; /** Constructor for the initial version of the Graph w/o available Partitions. */ public PlatformCommunicationGraphEncoding( - DirectedGraph<IResourceAdapter<?>, DefaultEdge> platformGraph) { + DefaultDirectedGraph<IResourceAdapter<?>, DefaultEdge> platformGraph) { this.platformGraph = platformGraph; } @@ -59,7 +60,7 @@ public class PlatformCommunicationGraphEncoding implements IExplorationEncoding, * Returns the actual graph that contains information about the {@link IResourceAdapter}s and * their connections. */ - public DirectedGraph<IResourceAdapter<?>, DefaultEdge> getActualGraph() { + public DefaultDirectedGraph<IResourceAdapter<?>, DefaultEdge> getActualGraph() { return platformGraph; } diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/extensions/compositegene/decode/.ratings b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/extensions/compositegene/decode/.ratings index 2600abd4ca919e10048b6ec059fa6897e82b3e7b..f96bde06e71885af80e04d7213144c8f469da8e7 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/extensions/compositegene/decode/.ratings +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/extensions/compositegene/decode/.ratings @@ -1,5 +1,5 @@ -ComposableDecoder.java 197abec80b880e25fccfc66d61b471b0b5d7e10f RED -ComposableDecoderBase.java 96e7e4b9f24902b2699e04401225935108cc0d29 YELLOW -CompositeDecoder.java 9d34dd0b342e6433ab894974f9430531ce2de39a RED -CompositeDecoderBase.java 1bc1860ed616010f7f459ed6579989f155f607c2 RED -PhenotypeDecoder.java 44079e8545aaf8b8729919f0b07c774c3ca0df06 RED +ComposableDecoder.java 197abec80b880e25fccfc66d61b471b0b5d7e10f RED +ComposableDecoderBase.java 96e7e4b9f24902b2699e04401225935108cc0d29 YELLOW +CompositeDecoder.java 0e49de95488e00a96fc5c37b68f2ff65aeb35680 RED +CompositeDecoderBase.java e290933d9adfdde85acfb635118b326651472e12 RED +PhenotypeDecoder.java 44079e8545aaf8b8729919f0b07c774c3ca0df06 RED diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/extensions/compositegene/decode/CompositeDecoder.java b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/extensions/compositegene/decode/CompositeDecoder.java index d22c97b5cbf4bb3935b20326e3e1f8a78696bb14..0e49de95488e00a96fc5c37b68f2ff65aeb35680 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/extensions/compositegene/decode/CompositeDecoder.java +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/extensions/compositegene/decode/CompositeDecoder.java @@ -20,7 +20,6 @@ import java.util.Map; 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.backend.opt4j.extensions.compositegene.phenotype.CompositePhenotype; -import org.jgrapht.experimental.dag.DirectedAcyclicGraph.CycleFoundException; import org.opt4j.core.Genotype; import org.opt4j.core.genotype.CompositeGenotype; import org.opt4j.core.problem.Decoder; @@ -43,18 +42,18 @@ public interface CompositeDecoder<C extends CompositeGenotype<Class<? extends Co * Map relating the sub-{@link Genotype}s with their decoding result (aka phenotype). * @return The {@link CompositeGenotype} {#link P} or {@code null} if the merge fails. */ - <CP extends ComposablePhenotype<? extends Genotype>> P - mergeSubPhenotypes(Map<Class<CP>, CP> subPhenotypes); + <CP extends ComposablePhenotype<? extends Genotype>> P mergeSubPhenotypes( + Map<Class<CP>, CP> subPhenotypes); /** * Adds a {@link ComposableDecoder} for the given {@link ComposablePhenotype}. The decoding * will triggered automatically and user defined merge function will consider the resulting * {@link ComposablePhenotype} of this {@link ComposableDecoder}. * - * @throws CycleFoundException + * @throws IllegalArgumentException * if a circular dependency between decoders exist. */ - // TODO: add doc for exception. - <G extends ComposableGenotype, CP extends ComposablePhenotype<G>, D extends ComposableDecoder<G, CP>> - void registerSubDecoder(Class<G> subGenotype, D subDecoder) throws CycleFoundException; + <G extends ComposableGenotype, CP extends ComposablePhenotype<G>, D extends ComposableDecoder<G, CP>> + void registerSubDecoder(Class<G> subGenotype, D subDecoder) + throws IllegalArgumentException; } diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/extensions/compositegene/decode/CompositeDecoderBase.java b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/extensions/compositegene/decode/CompositeDecoderBase.java index 15d6562ec6fef8d5287a851c68ca054ef2af9182..e290933d9adfdde85acfb635118b326651472e12 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/extensions/compositegene/decode/CompositeDecoderBase.java +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/extensions/compositegene/decode/CompositeDecoderBase.java @@ -33,7 +33,6 @@ import org.fortiss.af3.exploration.alg.dse.backend.opt4j.extensions.compositegen import org.fortiss.af3.exploration.alg.dse.backend.opt4j.extensions.compositegene.phenotype.FlatPhenotypeMap; import org.fortiss.af3.exploration.alg.dse.backend.opt4j.extensions.compositegene.phenotype.Phenotype; import org.fortiss.af3.exploration.alg.service.IExplorationEncoding; -import org.jgrapht.experimental.dag.DirectedAcyclicGraph.CycleFoundException; import org.opt4j.core.Genotype; import org.opt4j.core.genotype.CompositeGenotype; import org.opt4j.core.problem.Decoder; @@ -119,9 +118,12 @@ public abstract class CompositeDecoderBase<C extends CompositeGenotype<Class<? e (ComposableDecoder<ComposableGenotype, ComposablePhenotype<?>>)decoder; subDecoders.put(castedDecoder, registeredSubDecoders.get(decoder)); } else { - throw new DecodingException(genotype, decoder, "The sub-decoder " + - decoder.getClass().getSimpleName() + - " has been found in the dependency graph but it has not been regirstered at this composite decoder."); + throw new DecodingException( + genotype, + decoder, + "The sub-decoder " + + decoder.getClass().getSimpleName() + + " has been found in the dependency graph but it has not been regirstered at this composite decoder."); } } } @@ -142,8 +144,9 @@ public abstract class CompositeDecoderBase<C extends CompositeGenotype<Class<? e // shall not be just overridden. if(Genotype.class.isAssignableFrom(decType)) { CP oldGenotype = genotype.get(decType); - curPhenotype = castedDecoder.updateComposable(decodeableGenotype, oldGenotype, - decodedPhenotypes); + curPhenotype = + castedDecoder.updateComposable(decodeableGenotype, oldGenotype, + decodedPhenotypes); } else { curPhenotype = castedDecoder.decodeComposable(decodeableGenotype, decodedPhenotypes); @@ -223,12 +226,14 @@ public abstract class CompositeDecoderBase<C extends CompositeGenotype<Class<? e /** * {@inheritDoc} * - * @throws CycleFoundException + * @throws IllegalArgumentException */ @SuppressWarnings("unchecked") @Override - public <G extends ComposableGenotype, CP extends ComposablePhenotype<G>, D extends ComposableDecoder<G, CP>> - void registerSubDecoder(Class<G> subGenotype, D subDecoder) throws CycleFoundException { + public + <G extends ComposableGenotype, CP extends ComposablePhenotype<G>, D extends ComposableDecoder<G, CP>> + void registerSubDecoder(Class<G> subGenotype, D subDecoder) + throws IllegalArgumentException { if(subGenotype == null || subDecoder == null) { return; } diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/extensions/compositegene/problem/.ratings b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/extensions/compositegene/problem/.ratings index 3f1af4a6dbe4dbba05fcfa8f8585e775707df9f4..d5092a8bec282662c6cb3c1ce7e6058c7f47a26c 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/extensions/compositegene/problem/.ratings +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/extensions/compositegene/problem/.ratings @@ -1 +1 @@ -CompositeProblemModuleBase.java 6a94bd41f5c78a9559878c05b6fa881de2c70d24 RED +CompositeProblemModuleBase.java 91129f8e0fe83c7c858f1255a86d5e924baf316d RED diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/extensions/compositegene/problem/CompositeProblemModuleBase.java b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/extensions/compositegene/problem/CompositeProblemModuleBase.java index 24f2ed011fb9295edae5fbc3b7a3c91158f35df5..91129f8e0fe83c7c858f1255a86d5e924baf316d 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/extensions/compositegene/problem/CompositeProblemModuleBase.java +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/extensions/compositegene/problem/CompositeProblemModuleBase.java @@ -25,7 +25,6 @@ import org.fortiss.af3.exploration.alg.dse.backend.opt4j.extensions.compositegen import org.fortiss.af3.exploration.alg.dse.backend.opt4j.extensions.compositegene.phenotype.ComposablePhenotype; import org.fortiss.af3.exploration.alg.dse.backend.opt4j.extensions.compositegene.phenotype.CompositePhenotype; import org.fortiss.af3.exploration.alg.dse.backend.opt4j.problem.ProblemModuleBase; -import org.jgrapht.experimental.dag.DirectedAcyclicGraph.CycleFoundException; import org.opt4j.core.Genotype; import org.opt4j.core.genotype.CompositeGenotype; import org.opt4j.core.problem.Creator; @@ -53,13 +52,13 @@ public abstract class CompositeProblemModuleBase<C extends CompositeGenotype<Cla * {@link Decoder} to derive sub-solutions from the sub encodings. If the given * {@code subDecoder} equals {@code null} no {@link Decoder} will be registered for * the given {@subGenotype}. - * @throws CycleFoundException + * @throws IllegalArgumentException */ // TODO: document exception. public <CG extends ComposableGenotype, CP extends ComposablePhenotype<CG>, CC extends ComposableCreator<CG>, D extends ComposableDecoder<CG, CP>> void registerSubProblem(Class<CG> subGenotypeClass, CC subCreator, D subDecoder) - throws CycleFoundException { + throws IllegalArgumentException { creator.registerSubCreator(subCreator); if(subDecoder != null) { decoder.registerSubDecoder(subGenotypeClass, subDecoder); @@ -75,13 +74,13 @@ public abstract class CompositeProblemModuleBase<C extends CompositeGenotype<Cla * Creator for initial encodings of the particular sub problem (starting points). * @param subDecoders * Collection of {@link Decoder}s to derive sub-solutions from the sub encodings. - * @throws CycleFoundException + * @throws IllegalArgumentException */ // TODO: document exception. public <CG extends ComposableGenotype, CP extends ComposablePhenotype<CG>, CC extends ComposableCreator<CG>, D extends ComposableDecoder<CG, CP>> void registerSubProblem(Class<CG> subGenotypeClass, CC subCreator, List<D> subDecoders) - throws CycleFoundException { + throws IllegalArgumentException { creator.registerSubCreator(subCreator); if(subDecoders != null) { for(D currDecoder : subDecoders) { diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/problem/comm/.ratings b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/problem/comm/.ratings index e73620a3b1fdc59387c2f9248150c90bc949a7f0..4a601b184e825d202dbb497e925b0cf5a5d3851c 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/problem/comm/.ratings +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/problem/comm/.ratings @@ -1 +1 @@ -MessageDecoder.java 4ad8b9325ad1032437426c5f1636448b54b7883c RED +MessageDecoder.java d783d261f4c8af756cd4755064c57ae74033f391 RED diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/problem/comm/MessageDecoder.java b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/problem/comm/MessageDecoder.java index 78eda9938a9d176f0e69bcffd4bbec28049db93d..d783d261f4c8af756cd4755064c57ae74033f391 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/problem/comm/MessageDecoder.java +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/problem/comm/MessageDecoder.java @@ -40,7 +40,7 @@ import org.fortiss.af3.exploration.alg.dse.sysmodel.comm.MessageGenerator; import org.fortiss.af3.exploration.alg.dse.sysmodel.mapping.comm.IMessageRouter; import org.fortiss.af3.exploration.alg.dse.sysmodel.mapping.comm.IMessageRouter.RoutingStrategy; import org.fortiss.af3.exploration.alg.dse.sysmodel.mapping.comm.MessageRouter; -import org.jgrapht.DirectedGraph; +import org.jgrapht.graph.DefaultDirectedGraph; import org.jgrapht.graph.DefaultEdge; import com.google.inject.Inject; @@ -80,15 +80,15 @@ public class MessageDecoder<S extends TaskMappingEntry<ITaskAdapter<?>, Partitio FlatPhenotypeMap<Phenotype> decodedPhenotypes) throws DecodingException { PlatformCommunicationGraphEncoding pcgEncoding = decodedPhenotypes.getEncoding(PlatformCommunicationGraphEncoding.class); - assert (pcgEncoding != null) : "The required platform communication graph encoding could not" + - " be found in the map of already decoded phenotypes."; + assert (pcgEncoding != null) : "The required platform communication graph encoding could not" + + " be found in the map of already decoded phenotypes."; @SuppressWarnings("unchecked") AbstractTaskGraphEncoding<AbstractTaskMappingEncoding, ?> atgEnc = decodedPhenotypes.getEncoding(AbstractTaskGraphEncoding.class); - assert (pcgEncoding != null) : "The required atstract task graph encoding encoding could not" + - " be found in the map of already decoded phenotypes."; + assert (pcgEncoding != null) : "The required atstract task graph encoding encoding could not" + + " be found in the map of already decoded phenotypes."; Collection<Message> generatedMessages = messageGenerator.generateMessages(genotype, atgEnc); - Map<Message, DirectedGraph<IResourceAdapter<?>, DefaultEdge>> messageRouteMap = + Map<Message, DefaultDirectedGraph<IResourceAdapter<?>, DefaultEdge>> messageRouteMap = messageRouter.calculateMessageRoutes(generatedMessages, pcgEncoding, RoutingStrategy.SHORTEST_PATH); if(messageRouteMap == null) { diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/arch/.ratings b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/arch/.ratings index 6ae08730f7a30b82449996cb40fdbe51cc17c671..500b12c3177252e0ea73064819a4ade9abdf0cde 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/arch/.ratings +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/arch/.ratings @@ -1,17 +1,17 @@ -ICommunicationResourceAdapter.java 54dd128bfa04c5cfd16551eec8983e712636f86a RED -IComponentAdapter.java c8425150287be21b48d686469b88ea7fb77793e4 RED -IExecutionUnitAdapter.java a93c835d5dce6a6054eea7b0abb9663c04a335b8 RED -IGatewayUnitAdapter.java 5f806d2907ee461938eea14238572311572ecf81 RED -ILogicalArchitectureAdapter.java 7570a2adab987260e74bc255fcf21862a820226e RED -IMemoryUnitAdapter.java 588840b8237bd23a048a69961ffe985caf3b425b RED -IModelElementAdapter.java 3f6ae2fdc68ffed2728d2f895dc287864053e352 RED -IPlatformArchitectureAdapter.java 0a785dcff9147e1904751714ccd61ed758e0f1fe RED -IRequestAdapter.java bb7b3c05c4f52215cd79b27207bad8ce66a28506 RED -IResourceAdapter.java 634866895c9d1aa427f3c8d47e69acd807d0b582 RED -IResourceConnectionAdapter.java 7e20a8c3e60a9892597301556c891ba2dd43387f RED -ISafetyFunctionAdapter.java f20249e7c37f54774a9e8eaa0566a85492c80654 RED -ISignalAdapter.java 4f04154c5802a4f1a5469df90652852e16727421 RED -ITaskAdapter.java ea35d5d3c9482c3a3f4452eec7fa0e825552be59 RED -ITransmissionUnitAdapter.java 8965b73bfe9ef232a2a6d5427f7001761716d583 RED -InternalComponentParameters.java 2b19f4eeddee84e4c6e558ed9a1613cba33b7665 RED -SystemModelAdapter.java 3621d4aaaeb8b5913194dc4cc6182c20f305149b RED +ICommunicationResourceAdapter.java 54dd128bfa04c5cfd16551eec8983e712636f86a RED +IComponentAdapter.java c8425150287be21b48d686469b88ea7fb77793e4 RED +IExecutionUnitAdapter.java a93c835d5dce6a6054eea7b0abb9663c04a335b8 RED +IGatewayUnitAdapter.java 5f806d2907ee461938eea14238572311572ecf81 RED +ILogicalArchitectureAdapter.java 7570a2adab987260e74bc255fcf21862a820226e RED +IMemoryUnitAdapter.java 588840b8237bd23a048a69961ffe985caf3b425b RED +IModelElementAdapter.java 3f6ae2fdc68ffed2728d2f895dc287864053e352 RED +IPlatformArchitectureAdapter.java 0a785dcff9147e1904751714ccd61ed758e0f1fe RED +IRequestAdapter.java bb7b3c05c4f52215cd79b27207bad8ce66a28506 RED +IResourceAdapter.java 634866895c9d1aa427f3c8d47e69acd807d0b582 RED +IResourceConnectionAdapter.java 7e20a8c3e60a9892597301556c891ba2dd43387f RED +ISafetyFunctionAdapter.java f20249e7c37f54774a9e8eaa0566a85492c80654 RED +ISignalAdapter.java 4f04154c5802a4f1a5469df90652852e16727421 RED +ITaskAdapter.java ea35d5d3c9482c3a3f4452eec7fa0e825552be59 RED +ITransmissionUnitAdapter.java 8965b73bfe9ef232a2a6d5427f7001761716d583 RED +InternalComponentParameters.java 2b19f4eeddee84e4c6e558ed9a1613cba33b7665 RED +SystemModelAdapter.java 63c5cdcfcac5192b413526b0fdb894e507394260 RED diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/arch/SystemModelAdapter.java b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/arch/SystemModelAdapter.java index f92341ec7813ad4301b0f3abc084b3dbc6f8055f..63c5cdcfcac5192b413526b0fdb894e507394260 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/arch/SystemModelAdapter.java +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/arch/SystemModelAdapter.java @@ -15,6 +15,7 @@ +--------------------------------------------------------------------------*/ package org.fortiss.af3.exploration.alg.dse.sysmodel.arch; +import static java.util.Collections.emptyMap; import static org.fortiss.af3.exploration.util.ExplorationUtils.isDebugVerboseEnabled; import static org.fortiss.af3.schedule.utils.MathUtils.lcmDoubleCollection; @@ -56,7 +57,7 @@ import org.fortiss.tooling.base.model.element.IConnector; import org.fortiss.tooling.base.model.element.IHierarchicElement; import org.fortiss.tooling.base.model.element.IModelElement; import org.jgrapht.Graphs; -import org.jgrapht.alg.ConnectivityInspector; +import org.jgrapht.alg.connectivity.ConnectivityInspector; import org.opt4j.core.Genotype; import com.google.common.collect.HashMultimap; @@ -94,8 +95,7 @@ public class SystemModelAdapter<C, E, SO, SI, G, TR, M> { * Look up table to determine the input/output directions of {@link IConnector} types of the * target {@link PlatformArchitecture}. */ - protected Map<Class<? extends IConnector>, ConnectionType> connectionTypeLUT = - Collections.emptyMap(); + protected Map<Class<? extends IConnector>, ConnectionType> connectionTypeLUT = emptyMap(); /** * Deployable software components that may be replicated (per default: all @{code @@ -249,8 +249,9 @@ public class SystemModelAdapter<C, E, SO, SI, G, TR, M> { tasksInGraph = registerTaskGraphsForTasks(taskGraphs); // Construct an Directed Acyclic TaskGraph (e.g., utilized in scheduling). - acyclicTaskGraphs = taskGraphs.stream().map(tg -> new AcyclicTaskGraph(tg)) - .collect(Collectors.toList()); + acyclicTaskGraphs = + taskGraphs.stream().map(tg -> new AcyclicTaskGraph(tg)) + .collect(Collectors.toList()); componentInAcyclicGraph = registerTaskGraphsForTasks(acyclicTaskGraphs); // Print some debugging output: print the taskgraphs and display them in a dialog. @@ -279,7 +280,7 @@ public class SystemModelAdapter<C, E, SO, SI, G, TR, M> { // Compute vertex sets of maximum connected components of temporary task graph ConnectivityInspector<ITaskAdapter<?>, SignalAdapterWeightedEdge> ci = new ConnectivityInspector<ITaskAdapter<?>, SignalAdapterWeightedEdge>( - monolithicTaskGraph.getDelegateGraph()); + monolithicTaskGraph.getGraph()); List<Set<ITaskAdapter<?>>> connectedSets = ci.connectedSets(); // Reconstruct TaskGraphs from vertex sets of connected components for(Set<ITaskAdapter<?>> connectedSet : connectedSets) { @@ -308,8 +309,8 @@ public class SystemModelAdapter<C, E, SO, SI, G, TR, M> { InitialEncodingProvider initEncProvider = InitialEncodingProvider.getInstance(); initEncProvider.clearEncodings(); - initEncProvider.registerInputEncoding( - new AbstractTaskGraphEncoding<AbstractTaskMappingEncoding, C>( + initEncProvider + .registerInputEncoding(new AbstractTaskGraphEncoding<AbstractTaskMappingEncoding, C>( (Collection<? extends DefaultTaskGraph<?>>)getTaskGraphs(), hyperPeriod)); } @@ -349,8 +350,8 @@ public class SystemModelAdapter<C, E, SO, SI, G, TR, M> { // TODO: Here, we know that the IDeployableCOmponentAdapters are constructed using Components. // However, we should try to avoid the "SuppressWarnings". @SuppressWarnings("unchecked") - private <T extends TaskGraph> Map<ITaskAdapter<C>, T> - registerTaskGraphsForTasks(Collection<T> graphs) { + private <T extends TaskGraph> Map<ITaskAdapter<C>, T> registerTaskGraphsForTasks( + Collection<T> graphs) { Map<ITaskAdapter<C>, T> componentToGraphMap = new HashMap<ITaskAdapter<C>, T>(); for(T taskGraph : graphs) { @@ -387,8 +388,8 @@ public class SystemModelAdapter<C, E, SO, SI, G, TR, M> { */ private <T extends TaskGraph> void printAndDisplayTaskGraphs(Collection<T> taskGraphs) { for(T taskGraph : taskGraphs) { - System.out.println( - "Application " + taskGraph + ":" + " period = " + taskGraph.getPeriod()); + System.out.println("Application " + taskGraph + ":" + " period = " + + taskGraph.getPeriod()); System.out.println(taskGraph); System.out.println(""); @@ -607,12 +608,11 @@ public class SystemModelAdapter<C, E, SO, SI, G, TR, M> { } /** - * Returns the {@link ISignalAdapter}s "emitted" by the given - * {@link ITaskAdapter}. Returns an empty collection if the given - * {@link ITaskAdapter} does not emit anything. + * Returns the {@link ISignalAdapter}s "emitted" by the given {@link ITaskAdapter}. Returns an + * empty collection if the given {@link ITaskAdapter} does not emit anything. */ public Collection<ISignalAdapter<SO, ?>> getEmmittedMessages(ITaskAdapter<?> sender) { - // TODO: use another representation ro make an access via the reference obsolete + // TODO: use another representation to make an access via the reference obsolete if(sender.isInstantiation()) { sender = sender.getReplacedComponent(); } @@ -680,9 +680,9 @@ public class SystemModelAdapter<C, E, SO, SI, G, TR, M> { // This section handles the traversal between the elements of the same platform // architecture. - targetConnectors.addAll( - seekIntraPlatformTargetConnectors(sourceConnector, possibleTargetConnectors, - visitedTargetConnectors, nextTargetConnector, af3DeploymentTargets)); + targetConnectors.addAll(seekIntraPlatformTargetConnectors(sourceConnector, + possibleTargetConnectors, visitedTargetConnectors, nextTargetConnector, + af3DeploymentTargets)); visitedTargetConnectors.add(nextTargetConnector); } @@ -743,8 +743,9 @@ public class SystemModelAdapter<C, E, SO, SI, G, TR, M> { // Do not traverse back (to same connector) & not to the same IHierarchicElement. if(!visitedTargetConnectors.contains(connectorTgt) && tgtElement != sourceConnector.getOwner()) { - if(tgtElement instanceof IPlatformArchitectureElement && isValidConnectionTarget( - (IPlatformArchitectureElement)tgtElement, deploymentTargets)) { + if(tgtElement instanceof IPlatformArchitectureElement && + isValidConnectionTarget((IPlatformArchitectureElement)tgtElement, + deploymentTargets)) { targetConnectors.add(connectorTgt); } else if(tgtElement == connectorSrc.getOwner().getContainer() && !(nextTargetConnector instanceof IPlatformExport)) { diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/arch/taskgraph/.ratings b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/arch/taskgraph/.ratings index 1ddc3c736283bf1696139b85537a08201f2eddf4..0ec8361a5c5adc59195e8b64e0e7d20eec572d97 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/arch/taskgraph/.ratings +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/arch/taskgraph/.ratings @@ -1,5 +1,5 @@ -AcyclicTaskGraph.java c8fa01f3ad30f0cc5980838636355a2e041b5cbb RED -DefaultTaskGraph.java 8c384e8dfd6f9806a04b68b45855ba75dd558a50 RED -SignalAdapterWeightedEdge.java 6b7dbae1c2e7a658b33c3c7a584cee13b2269891 RED -TaskGraph.java 90289a46be5c6ad658a06f4ff17d6da648fc97e8 RED -TaskGraphInstantiator.java bfda013ddc6f4a9d2b063dfa7187827be1cdac73 RED +AcyclicTaskGraph.java a335951bac3178a581294bdd794b1638b4f624eb RED +DefaultTaskGraph.java 90c968588be0fc9c1906f0cdaf425d6c1d94d33e RED +SignalAdapterWeightedEdge.java 6b7dbae1c2e7a658b33c3c7a584cee13b2269891 RED +TaskGraph.java 18fe260320bc0c0979f53611b66946afeb41ec75 RED +TaskGraphInstantiator.java aa32292449069dab3733c8ff2b7e405994b9d35f RED diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/arch/taskgraph/AcyclicTaskGraph.java b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/arch/taskgraph/AcyclicTaskGraph.java index 51100f233b5f74b041e90567792cc6749323bb82..a335951bac3178a581294bdd794b1638b4f624eb 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/arch/taskgraph/AcyclicTaskGraph.java +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/arch/taskgraph/AcyclicTaskGraph.java @@ -26,22 +26,18 @@ import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.ISignalAdapter; import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.ITaskAdapter; import org.fortiss.af3.exploration.alg.dse.sysmodel.faultmodel.FaultDetector; import org.jgrapht.Graphs; -import org.jgrapht.alg.PrimMinimumSpanningTree; -import org.jgrapht.alg.interfaces.MinimumSpanningTree; -import org.jgrapht.graph.DefaultListenableGraph; -import org.jgrapht.graph.ListenableDirectedWeightedGraph; +import org.jgrapht.alg.interfaces.SpanningTreeAlgorithm; +import org.jgrapht.alg.spanning.PrimMinimumSpanningTree; +import org.jgrapht.graph.DirectedWeightedMultigraph; /** - * Creates a Directed acyclic task graph of all the {@link ITaskAdapter}s. - * <li>Each - * {@link ISignalAdapter} is examined:</li> - * <li>If there exists no path between a target of the - * {@link ISignalAdapter} and it source, add an edge to the {@link DefaultTaskGraph}.</li> - * <li> + * Creates a Directed acyclic task graph of all the {@link ITaskAdapter}s. <li>Each + * {@link ISignalAdapter} is examined:</li> <li>If there exists no path between a target of the + * {@link ISignalAdapter} and it source, add an edge to the {@link DefaultTaskGraph}.</li> <li> * Otherwise, a loop is detected. Then, the detected loop is cut either by not adding the edge (if * the source vertex is strongly causal) or by removing an edge between the vertices (i.e. - * {@link ITaskAdapter}s) that are closest to the current {@link ISignalAdapter} by - * traversing the found path backwards and adding the current edge.</li> + * {@link ITaskAdapter}s) that are closest to the current {@link ISignalAdapter} by traversing the + * found path backwards and adding the current edge.</li> * <p> * <b>NOTE:</b> This method expects <b>correct</b> {@link ILogicalArchitectureAdapter}s as input, * i.e. at least one {@link ITaskAdapter} of each loop must be 'strongly causal'. @@ -71,23 +67,22 @@ public class AcyclicTaskGraph extends DefaultTaskGraph<AcyclicTaskGraph> { * {@link SignalAdapterWeightedEdge}s. */ private void createMinSpanAcycTaskGraph(TaskGraph taskGraph) { - DefaultListenableGraph<ITaskAdapter<?>, SignalAdapterWeightedEdge> tg = + DirectedWeightedMultigraph<ITaskAdapter<?>, SignalAdapterWeightedEdge> tg = taskGraph.getGraph(); Graphs.addAllVertices(graph, tg.vertexSet()); if(taskGraph.getTasks().size() == 1) { return; } - MinimumSpanningTree<ITaskAdapter<?>, SignalAdapterWeightedEdge> minSpanTree = + SpanningTreeAlgorithm<SignalAdapterWeightedEdge> minSpanTree = new PrimMinimumSpanningTree<ITaskAdapter<?>, SignalAdapterWeightedEdge>( taskGraph.getGraph()); - minSpanTree.getMinimumSpanningTreeEdgeSet().stream() + minSpanTree.getSpanningTree().getEdges().stream() .forEach(e -> graph.addEdge(tg.getEdgeSource(e), tg.getEdgeTarget(e), e)); } /** {@inheritDoc} */ // TODO: Parameterize the task graph correctly. - @SuppressWarnings("unchecked") @Override public AcyclicTaskGraph copy() { AcyclicTaskGraph clonedTaskGraph; @@ -97,7 +92,7 @@ public class AcyclicTaskGraph extends DefaultTaskGraph<AcyclicTaskGraph> { throw new AssertionError(); } clonedTaskGraph.graph = - new ListenableDirectedWeightedGraph<ITaskAdapter<?>, SignalAdapterWeightedEdge>( + new DirectedWeightedMultigraph<ITaskAdapter<?>, SignalAdapterWeightedEdge>( SignalAdapterWeightedEdge.class); Graphs.addGraph(clonedTaskGraph.graph, graph); clonedTaskGraph.taskFaultDetectorsMap = @@ -110,8 +105,8 @@ public class AcyclicTaskGraph extends DefaultTaskGraph<AcyclicTaskGraph> { * Transforms all existing {@link TaskGraph}s of {@code this} {@link TaskGraphEncoding} into * {@link AcyclicTaskGraph}s. */ - public static <T extends TaskGraph> Collection<AcyclicTaskGraph> - transformToAcyclicGraphs(Collection<T> cyclicTGs) { + public static <T extends TaskGraph> Collection<AcyclicTaskGraph> transformToAcyclicGraphs( + Collection<T> cyclicTGs) { Collection<AcyclicTaskGraph> acyclicTGCollection = new ArrayList<>(); for(TaskGraph tg : cyclicTGs) { AcyclicTaskGraph acycTG = new AcyclicTaskGraph(tg); diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/arch/taskgraph/DefaultTaskGraph.java b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/arch/taskgraph/DefaultTaskGraph.java index d93154c7edf376e60e46f5f3b164bfa7d939b959..90c968588be0fc9c1906f0cdaf425d6c1d94d33e 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/arch/taskgraph/DefaultTaskGraph.java +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/arch/taskgraph/DefaultTaskGraph.java @@ -31,9 +31,7 @@ import org.fortiss.af3.exploration.alg.dse.sysmodel.random.RandomExploration; import org.fortiss.af3.exploration.alg.graph.display.JGraphTVisualizer; import org.fortiss.af3.schedule.utils.MathUtils; import org.jgrapht.Graphs; -import org.jgrapht.graph.DefaultListenableGraph; import org.jgrapht.graph.DirectedWeightedMultigraph; -import org.jgrapht.graph.ListenableDirectedWeightedGraph; import org.jgrapht.traverse.DepthFirstIterator; import com.google.common.collect.HashMultimap; @@ -58,10 +56,7 @@ import com.google.common.collect.Multimap; public class DefaultTaskGraph<T extends DefaultTaskGraph<?>> implements TaskGraph, Cloneable { /** Underlying graph implementation */ // TODO: Add a weight w.r.t. transmission time, when deployed - protected DefaultListenableGraph<ITaskAdapter<?>, SignalAdapterWeightedEdge> graph; - - /** The actual Graph holding the data. It does not provide any listener interface. */ - protected DirectedWeightedMultigraph<ITaskAdapter<?>, SignalAdapterWeightedEdge> delegateGraph; + protected DirectedWeightedMultigraph<ITaskAdapter<?>, SignalAdapterWeightedEdge> graph; // TODO: Currently, all tasks in a {@link TaskGraph} must have the same period /** The period time of this {@link DefaultTaskGraph}. */ @@ -85,9 +80,7 @@ public class DefaultTaskGraph<T extends DefaultTaskGraph<?>> implements TaskGrap /** Creates an empty {@link DefaultTaskGraph}. */ public DefaultTaskGraph() { - delegateGraph = new DirectedWeightedMultigraph<>(SignalAdapterWeightedEdge.class); - graph = new DefaultListenableGraph<ITaskAdapter<?>, SignalAdapterWeightedEdge>( - delegateGraph); + graph = new DirectedWeightedMultigraph<>(SignalAdapterWeightedEdge.class); taskFaultDetectorsMap = new HashMap<ITaskAdapter<?>, SortedSet<FaultDetector>>(); @@ -140,8 +133,8 @@ public class DefaultTaskGraph<T extends DefaultTaskGraph<?>> implements TaskGrap @Override public boolean addSignal(ISignalAdapter<?, ?> signalAdapter) { for(ITaskAdapter<?> recvTask : signalAdapter.getTargets()) { - if(!graph.addEdge(signalAdapter.getSource(), recvTask, - new SignalAdapterWeightedEdge(signalAdapter))) { + if(!graph.addEdge(signalAdapter.getSource(), recvTask, new SignalAdapterWeightedEdge( + signalAdapter))) { return false; } } @@ -168,18 +161,10 @@ public class DefaultTaskGraph<T extends DefaultTaskGraph<?>> implements TaskGrap // TODO: Get rid of this method! /** {@inheritDoc} */ @Override - public DefaultListenableGraph<ITaskAdapter<?>, SignalAdapterWeightedEdge> getGraph() { + public DirectedWeightedMultigraph<ITaskAdapter<?>, SignalAdapterWeightedEdge> getGraph() { return graph; } - // TODO: Get rid of this method! - /** {@inheritDoc} */ - @Override - public DirectedWeightedMultigraph<ITaskAdapter<?>, SignalAdapterWeightedEdge> - getDelegateGraph() { - return delegateGraph; - } - /** {@inheritDoc} */ @Override public Double getPeriod() { @@ -261,7 +246,7 @@ public class DefaultTaskGraph<T extends DefaultTaskGraph<?>> implements TaskGrap throw new AssertionError(); } clonedTaskGraph.graph = - new ListenableDirectedWeightedGraph<ITaskAdapter<?>, SignalAdapterWeightedEdge>( + new DirectedWeightedMultigraph<ITaskAdapter<?>, SignalAdapterWeightedEdge>( SignalAdapterWeightedEdge.class); Graphs.addGraph(clonedTaskGraph.graph, graph); clonedTaskGraph.taskFaultDetectorsMap = diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/arch/taskgraph/TaskGraph.java b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/arch/taskgraph/TaskGraph.java index 27fdf1acbbc10d47db9a4a7f20eaa7525a599aa9..18fe260320bc0c0979f53611b66946afeb41ec75 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/arch/taskgraph/TaskGraph.java +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/arch/taskgraph/TaskGraph.java @@ -18,11 +18,11 @@ package org.fortiss.af3.exploration.alg.dse.sysmodel.arch.taskgraph; import java.util.Collection; import java.util.Set; +import org.eclipse.draw2d.graph.DirectedGraph; import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.ISignalAdapter; import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.ITaskAdapter; import org.fortiss.af3.exploration.alg.dse.sysmodel.faultmodel.FaultDetector; import org.fortiss.af3.exploration.alg.exception.InvalidTimingModelException; -import org.jgrapht.DirectedGraph; import org.jgrapht.graph.DefaultListenableGraph; import org.jgrapht.graph.DirectedWeightedMultigraph; @@ -35,14 +35,7 @@ import org.jgrapht.graph.DirectedWeightedMultigraph; public interface TaskGraph { // TODO: Get rid of this method! /** Returns the underlying {@link DefaultListenableGraph}. */ - DefaultListenableGraph<ITaskAdapter<?>, SignalAdapterWeightedEdge> getGraph(); - - // TODO: Get rid of this method! - /** - * Returns the underlying {@link DirectedWeightedMultigraph} that holds the data of the - * corresponding {@link DefaultListenableGraph}. - */ - DirectedWeightedMultigraph<ITaskAdapter<?>, SignalAdapterWeightedEdge> getDelegateGraph(); + DirectedWeightedMultigraph<ITaskAdapter<?>, SignalAdapterWeightedEdge> getGraph(); /** * Updates the period of this {@link TaskGraph}: Determine the common period of the tasks @@ -61,14 +54,14 @@ public interface TaskGraph { Set<ITaskAdapter<?>> getTasks(); /** - * Checks whether {@code this} {@link TaskGraph} contains the given - * {@link ITaskAdapter} or an instance of it. + * Checks whether {@code this} {@link TaskGraph} contains the given {@link ITaskAdapter} or an + * instance of it. */ boolean containsTask(ITaskAdapter<?> task); /** - * Checks whether {@code this} {@link TaskGraph} contains any of the given - * {@link ITaskAdapter}s. + * Checks whether {@code this} {@link TaskGraph} contains any of the given {@link ITaskAdapter} + * s. */ boolean containsAnyTaskOf(Collection<ITaskAdapter<?>> taskSet); diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/arch/taskgraph/TaskGraphInstantiator.java b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/arch/taskgraph/TaskGraphInstantiator.java index 1f8a218f8c4ad885ca7d7d9560932f0f6a063a7b..aa32292449069dab3733c8ff2b7e405994b9d35f 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/arch/taskgraph/TaskGraphInstantiator.java +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/arch/taskgraph/TaskGraphInstantiator.java @@ -26,7 +26,7 @@ import java.util.Set; 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.sysmodel.arch.ITaskAdapter; -import org.jgrapht.graph.DefaultListenableGraph; +import org.jgrapht.graph.DirectedWeightedMultigraph; /** * Manages the construction of {@link TaskGraph}s whose vertices are exclusively instances of @@ -82,8 +82,8 @@ public class TaskGraphInstantiator<T extends TaskGraph> { } /** - * Creates a single {@link TaskGraph} containing only {@link ITaskAdapter} - * instances for the given {@link TaskGraph}. + * Creates a single {@link TaskGraph} containing only {@link ITaskAdapter} instances for the + * given {@link TaskGraph}. */ public T createInstanceTaskGraph(T abstractGraph) { T instanceTaskGraph = abstractGraph.copy(); @@ -93,8 +93,7 @@ public class TaskGraphInstantiator<T extends TaskGraph> { assert (nodeCorrespondenceMap != null); Set<ITaskAdapter<?>> removeableVertices = new HashSet<ITaskAdapter<?>>(); - for(Entry<ITaskAdapter<?>, ITaskAdapter<?>> instancePair : nodeCorrespondenceMap - .entrySet()) { + for(Entry<ITaskAdapter<?>, ITaskAdapter<?>> instancePair : nodeCorrespondenceMap.entrySet()) { ITaskAdapter<?> instComp = instancePair.getKey(); ITaskAdapter<?> abstrComp = instancePair.getValue(); if(abstractGraph.containsTask(abstrComp) && abstrComp.isInstantiationRequired()) { @@ -118,7 +117,7 @@ public class TaskGraphInstantiator<T extends TaskGraph> { */ public void insertInstanceComponent(T instanceTaskGraph, ITaskAdapter<?> abstractNode, ITaskAdapter<?> instanceNode) { - DefaultListenableGraph<ITaskAdapter<?>, SignalAdapterWeightedEdge> graph = + DirectedWeightedMultigraph<ITaskAdapter<?>, SignalAdapterWeightedEdge> graph = instanceTaskGraph.getGraph(); instanceTaskGraph.addTask(instanceNode, abstractNode); @@ -141,9 +140,8 @@ public class TaskGraphInstantiator<T extends TaskGraph> { * {@link IDeployableComponentAdapter}. */ /** - * Creates a map which relates "abstract" {@link ITaskAdapter} with the - * {@link ITaskAdapter} instantiating the "abstract" - * {@link ITaskAdapter}. + * Creates a map which relates "abstract" {@link ITaskAdapter} with the {@link ITaskAdapter} + * instantiating the "abstract" {@link ITaskAdapter}. */ private Map<ITaskAdapter<?>, ITaskAdapter<?>> createAbstractInstantiatedNodeAssociations( InstantiatedTaskMappingEncoding<? extends InstantiatedTaskMappingEntry> encoding) { diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/comm/.ratings b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/comm/.ratings index 39ee99a8f32821354d6fbac569103e9d91677db9..73048eab8a57651f5a36954a3672b37993d677aa 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/comm/.ratings +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/comm/.ratings @@ -1,2 +1,2 @@ -Message.java e6aeffa00605318214ba100758b988b500acfe8c RED -MessageGenerator.java 841882d4cce69b7bb6cfa4dea4331f7dcfdb0038 RED +Message.java 1b04ea9952cf7001d9ca295bba1a105e8d4170ce RED +MessageGenerator.java 841882d4cce69b7bb6cfa4dea4331f7dcfdb0038 RED diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/comm/Message.java b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/comm/Message.java index d4b5432ef03c3630ad1cbb8bd12b867a851f1559..1b04ea9952cf7001d9ca295bba1a105e8d4170ce 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/comm/Message.java +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/comm/Message.java @@ -27,7 +27,7 @@ import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.ISignalAdapter; import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.ITransmissionUnitAdapter; import org.fortiss.af3.exploration.alg.dse.sysmodel.mapping.IMappingEncoding; import org.fortiss.af3.exploration.alg.dse.sysmodel.mapping.IMappingEntry; -import org.jgrapht.DirectedGraph; +import org.jgrapht.graph.DefaultDirectedGraph; import org.jgrapht.graph.DefaultEdge; /** @@ -61,7 +61,7 @@ public class Message implements Comparable<Message> { * References the route (of platform resources) which this message must traverse to provide its * content. */ - private DirectedGraph<IResourceAdapter<?>, DefaultEdge> route; + private DefaultDirectedGraph<IResourceAdapter<?>, DefaultEdge> route; /** {@link ISignalAdapter} which is the logical counterpart of this {@link Message} */ private ISignalAdapter<?, ?> signalAdapter; @@ -194,15 +194,15 @@ public class Message implements Comparable<Message> { } /** Returns the route which this {@link Message} must traverse. */ - public DirectedGraph<IResourceAdapter<?>, DefaultEdge> getRoute() { + public DefaultDirectedGraph<IResourceAdapter<?>, DefaultEdge> getRoute() { return route; } /** - * Sets the route in the form of a {@link DirectedGraph} which this {@link Message} must + * Sets the route in the form of a {@link DefaultDirectedGraph} which this {@link Message} must * traverse. */ - public void setRoute(DirectedGraph<IResourceAdapter<?>, DefaultEdge> messageRoute) { + public void setRoute(DefaultDirectedGraph<IResourceAdapter<?>, DefaultEdge> messageRoute) { route = messageRoute; } diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/mapping/comm/.ratings b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/mapping/comm/.ratings index 5aa80abebadacbcb6cbe8052c51e70b926475dfc..0c4092e8331d9c04da940e2dabe4d39bf79aa1e0 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/mapping/comm/.ratings +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/mapping/comm/.ratings @@ -1,3 +1,3 @@ -IMessageRouter.java 502b0083ba82de6a70813c4c7ca9606ebb2ba65f RED -MessageRouter.java 8dd059bfa4dabdf1939fb8e46d0499cf2a13664d RED -ShortestPathRouter.java 1b82cb1fe083ec06411d399ef37d3fdddc7993aa RED +IMessageRouter.java e3cc7208918778e1e3785c77d8e0bdeb7d8933ef RED +MessageRouter.java 15465a4f25323b408aed8800eea85583361730e9 RED +ShortestPathRouter.java 9e8a9a7a892b0f31c6327347edb30ea5a2dddaca RED diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/mapping/comm/IMessageRouter.java b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/mapping/comm/IMessageRouter.java index 1117e989c2a92e41639f6304d5a729f1fa225305..e3cc7208918778e1e3785c77d8e0bdeb7d8933ef 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/mapping/comm/IMessageRouter.java +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/mapping/comm/IMessageRouter.java @@ -22,7 +22,8 @@ import org.fortiss.af3.exploration.alg.dse.backend.opt4j.encoding.platform.Platf import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.ICommunicationResourceAdapter; import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.IResourceAdapter; import org.fortiss.af3.exploration.alg.dse.sysmodel.comm.Message; -import org.jgrapht.DirectedGraph; +import org.jgrapht.graph.AbstractGraph; +import org.jgrapht.graph.DefaultDirectedGraph; import org.jgrapht.graph.DefaultEdge; /** @@ -46,7 +47,7 @@ public interface IMessageRouter { * * @return {@link Map} that relates the Message to its route. */ - Map<Message, DirectedGraph<IResourceAdapter<?>, DefaultEdge>> calculateMessageRoutes( + Map<Message, DefaultDirectedGraph<IResourceAdapter<?>, DefaultEdge>> calculateMessageRoutes( Collection<Message> messagesToRoute, PlatformCommunicationGraphEncoding pcgEncoding, RoutingStrategy strategy); @@ -55,19 +56,19 @@ public interface IMessageRouter { * where ... denotes the already processed {@link ICommunicationResourceAdapter}. */ // TODO: replace the IResourceAdapter with an ICommunicationResourceAdapter. - Map<IResourceAdapter<?>, DirectedGraph<IResourceAdapter<?>, DefaultEdge>> + Map<IResourceAdapter<?>, AbstractGraph<IResourceAdapter<?>, DefaultEdge>> - getRemainingMessageGraphs(Message message, IResourceAdapter<?> processedResource, - DirectedGraph<IResourceAdapter<?>, DefaultEdge> messageRoute); + getRemainingMessageGraphs(Message message, IResourceAdapter<?> processedResource, + AbstractGraph<IResourceAdapter<?>, DefaultEdge> messageRoute); /** * Calculates the route of a message from the source to given receivers. The route is given as a - * {@link DirectedGraph} whose leaves are the target {@link IResourceAdapter}s. + * {@link DefaultDirectedGraph} whose leaves are the target {@link IResourceAdapter}s. */ - DirectedGraph<IResourceAdapter<?>, DefaultEdge> calculateMessageRoute( + DefaultDirectedGraph<IResourceAdapter<?>, DefaultEdge> calculateMessageRoute( IResourceAdapter<?> source, Collection<IResourceAdapter<?>> receiverResources, PlatformCommunicationGraphEncoding pcgEncoding); /** Returns the route which the given {@link Message} must traverse to deliver its content. */ - DirectedGraph<IResourceAdapter<?>, DefaultEdge> getRouteOf(Message msg); + DefaultDirectedGraph<IResourceAdapter<?>, DefaultEdge> getRouteOf(Message msg); } diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/mapping/comm/MessageRouter.java b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/mapping/comm/MessageRouter.java index 3a0cbe363bf10ba384c7b1d2e42526f3178653a0..15465a4f25323b408aed8800eea85583361730e9 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/mapping/comm/MessageRouter.java +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/mapping/comm/MessageRouter.java @@ -23,7 +23,8 @@ import java.util.concurrent.ConcurrentHashMap; import org.fortiss.af3.exploration.alg.dse.backend.opt4j.encoding.platform.PlatformCommunicationGraphEncoding; import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.IResourceAdapter; import org.fortiss.af3.exploration.alg.dse.sysmodel.comm.Message; -import org.jgrapht.DirectedGraph; +import org.jgrapht.graph.AbstractGraph; +import org.jgrapht.graph.DefaultDirectedGraph; import org.jgrapht.graph.DefaultEdge; /** @@ -37,17 +38,17 @@ public class MessageRouter implements IMessageRouter { private IMessageRouter delegate; /** Contains the calculated routes of the generated {@link Message}s. */ - private Map<Message, DirectedGraph<IResourceAdapter<?>, DefaultEdge>> messagesRoutes; + private Map<Message, DefaultDirectedGraph<IResourceAdapter<?>, DefaultEdge>> messagesRoutes; /** Constructs a scheduler for a given input model. */ public MessageRouter() { messagesRoutes = - new ConcurrentHashMap<Message, DirectedGraph<IResourceAdapter<?>, DefaultEdge>>(); + new ConcurrentHashMap<Message, DefaultDirectedGraph<IResourceAdapter<?>, DefaultEdge>>(); } /** {@inheritDoc} */ @Override - public synchronized Map<Message, DirectedGraph<IResourceAdapter<?>, DefaultEdge>> + public synchronized Map<Message, DefaultDirectedGraph<IResourceAdapter<?>, DefaultEdge>> calculateMessageRoutes(Collection<Message> messagesToRoute, PlatformCommunicationGraphEncoding pcgEncoding, RoutingStrategy strategy) { // For now, we have only one routing strategy, so define the delegate if it is not already @@ -56,19 +57,20 @@ public class MessageRouter implements IMessageRouter { delegate = new ShortestPathRouter(); } - Map<Message, DirectedGraph<IResourceAdapter<?>, DefaultEdge>> messagesRoutes = - new HashMap<Message, DirectedGraph<IResourceAdapter<?>, DefaultEdge>>(); + Map<Message, DefaultDirectedGraph<IResourceAdapter<?>, DefaultEdge>> messagesRoutes = + new HashMap<Message, DefaultDirectedGraph<IResourceAdapter<?>, DefaultEdge>>(); // Calculate the route of each message and associate the route with the message. for(Message currentMessage : messagesToRoute) { - DirectedGraph<IResourceAdapter<?>, DefaultEdge> calculatedMessageRoute = + DefaultDirectedGraph<IResourceAdapter<?>, DefaultEdge> calculatedMessageRoute = calculateMessageRoute(currentMessage.getSender().getTarget(), currentMessage.getReceiverResources(), pcgEncoding); // Check if any *invalid* communication were required by the mapping. if(calculatedMessageRoute == null) { return null; } - messagesRoutes.put(currentMessage, + messagesRoutes.put( + currentMessage, calculateMessageRoute(currentMessage.getSender().getTarget(), currentMessage.getReceiverResources(), pcgEncoding)); } @@ -78,21 +80,21 @@ public class MessageRouter implements IMessageRouter { /** {@inheritDoc} */ @Override - public DirectedGraph<IResourceAdapter<?>, DefaultEdge> getRouteOf(Message msg) { + public DefaultDirectedGraph<IResourceAdapter<?>, DefaultEdge> getRouteOf(Message msg) { return messagesRoutes.get(msg); } /** {@inheritDoc} */ @Override - public Map<IResourceAdapter<?>, DirectedGraph<IResourceAdapter<?>, DefaultEdge>> + public Map<IResourceAdapter<?>, AbstractGraph<IResourceAdapter<?>, DefaultEdge>> getRemainingMessageGraphs(Message message, IResourceAdapter<?> processedResource, - DirectedGraph<IResourceAdapter<?>, DefaultEdge> messageRoute) { + AbstractGraph<IResourceAdapter<?>, DefaultEdge> messageRoute) { return delegate.getRemainingMessageGraphs(message, processedResource, messageRoute); } /** {@inheritDoc} */ @Override - public DirectedGraph<IResourceAdapter<?>, DefaultEdge> calculateMessageRoute( + public DefaultDirectedGraph<IResourceAdapter<?>, DefaultEdge> calculateMessageRoute( IResourceAdapter<?> source, Collection<IResourceAdapter<?>> receiverResources, PlatformCommunicationGraphEncoding pcgEncoding) { return delegate.calculateMessageRoute(source, receiverResources, pcgEncoding); diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/mapping/comm/ShortestPathRouter.java b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/mapping/comm/ShortestPathRouter.java index 5625b3183184d3afb7041d1c333adac5ea6aea0d..9e8a9a7a892b0f31c6327347edb30ea5a2dddaca 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/mapping/comm/ShortestPathRouter.java +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/mapping/comm/ShortestPathRouter.java @@ -22,17 +22,19 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Predicate; import org.fortiss.af3.exploration.alg.dse.backend.opt4j.encoding.platform.PlatformCommunicationGraphEncoding; import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.IResourceAdapter; import org.fortiss.af3.exploration.alg.dse.sysmodel.comm.Message; -import org.jgrapht.DirectedGraph; +import org.jgrapht.GraphPath; import org.jgrapht.Graphs; -import org.jgrapht.alg.BellmanFordShortestPath; -import org.jgrapht.alg.ConnectivityInspector; +import org.jgrapht.alg.connectivity.ConnectivityInspector; +import org.jgrapht.alg.shortestpath.BellmanFordShortestPath; +import org.jgrapht.graph.AbstractGraph; import org.jgrapht.graph.DefaultDirectedGraph; import org.jgrapht.graph.DefaultEdge; -import org.jgrapht.graph.DirectedSubgraph; +import org.jgrapht.graph.MaskSubgraph; /** * Calculates the shortest path from the sending entity to its receivers on a physical/virtual @@ -47,7 +49,7 @@ public class ShortestPathRouter extends MessageRouter { /** Constructs a simple shortest path router for a given exploration run */ public ShortestPathRouter() { - // TODO: Replace with more efficient Dijkstra, which needs an modification to contain the + // TODO: Replace with more efficient Dijkstra, which needs a modification to contain the // shortest paths to all other vertices in the graph. shortestPathForSender = new ConcurrentHashMap<IResourceAdapter<?>, BellmanFordShortestPath<IResourceAdapter<?>, DefaultEdge>>(); @@ -55,9 +57,10 @@ public class ShortestPathRouter extends MessageRouter { /** {@inheritDoc} */ @Override - public synchronized DirectedGraph<IResourceAdapter<?>, DefaultEdge> calculateMessageRoute( - IResourceAdapter<?> source, Collection<IResourceAdapter<?>> receiverResources, - PlatformCommunicationGraphEncoding pcgEncoding) { + public synchronized DefaultDirectedGraph<IResourceAdapter<?>, DefaultEdge> + calculateMessageRoute(IResourceAdapter<?> source, + Collection<IResourceAdapter<?>> receiverResources, + PlatformCommunicationGraphEncoding pcgEncoding) { // Generates a graph that contains the message's path to each receiver in the following // manner: // - Find the shortest path from the sender to each receiver (using BellmanFord) @@ -80,15 +83,15 @@ public class ShortestPathRouter extends MessageRouter { // if(shortestPathForCurrentMessage == null) { shortestPathForCurrentMessage = new BellmanFordShortestPath<IResourceAdapter<?>, DefaultEdge>( - pcgEncoding.getActualGraph(), source); + pcgEncoding.getActualGraph()); // shortestPathForSender.put(source, shortestPathForCurrentMessage); // } for(IResourceAdapter<?> currentReceiver : receiverResources) { - List<DefaultEdge> shortestMessagePath = null; + GraphPath<IResourceAdapter<?>, DefaultEdge> shortestMessagePath = null; try { shortestMessagePath = - shortestPathForCurrentMessage.getPathEdgeList(currentReceiver); + shortestPathForCurrentMessage.getPath(source, currentReceiver); } catch(IllegalArgumentException e) { pcgEncoding.display(); throw e; @@ -99,7 +102,8 @@ public class ShortestPathRouter extends MessageRouter { return null; } // Add all vertices and edges. - Graphs.addAllEdges(messageGraph, pcgEncoding.getActualGraph(), shortestMessagePath); + Graphs.addAllEdges(messageGraph, pcgEncoding.getActualGraph(), + shortestMessagePath.getEdgeList()); } return messageGraph; @@ -107,9 +111,9 @@ public class ShortestPathRouter extends MessageRouter { /** {@inheritDoc} */ @Override - public Map<IResourceAdapter<?>, DirectedGraph<IResourceAdapter<?>, DefaultEdge>> + public Map<IResourceAdapter<?>, AbstractGraph<IResourceAdapter<?>, DefaultEdge>> getRemainingMessageGraphs(Message message, IResourceAdapter<?> communicationResource, - DirectedGraph<IResourceAdapter<?>, DefaultEdge> messageRoute) { + AbstractGraph<IResourceAdapter<?>, DefaultEdge> messageRoute) { // Get the direct successors of the current message sender, which form the senders of the // generated messages. List<IResourceAdapter<?>> directSuccessorVertices = @@ -122,27 +126,36 @@ public class ShortestPathRouter extends MessageRouter { // Generate a working graph, that will be used to identify the correct allocation of // receivers to newly created messages. Therefore, the connection to the current sender is // cut. - DirectedGraph<IResourceAdapter<?>, DefaultEdge> workingGraph = + DefaultDirectedGraph<IResourceAdapter<?>, DefaultEdge> workingGraph = new DefaultDirectedGraph<IResourceAdapter<?>, DefaultEdge>(DefaultEdge.class); Graphs.addGraph(workingGraph, messageRoute); for(DefaultEdge edgeFromProcessedResource : workingGraph.edgesOf(communicationResource)) { workingGraph.removeEdge(edgeFromProcessedResource); } - // Generate the routes of the successor messages using the connctivity inspector and the + // Generate the routes of the successor messages using the connectivity inspector and the // workingGraph. For each successor message, a subgraph is determined that contains all // reachable receivers. ConnectivityInspector<IResourceAdapter<?>, DefaultEdge> messageConnectivity = new ConnectivityInspector<IResourceAdapter<?>, DefaultEdge>(workingGraph); - Map<IResourceAdapter<?>, DirectedGraph<IResourceAdapter<?>, DefaultEdge>> remainingSubGraphs = - new HashMap<IResourceAdapter<?>, DirectedGraph<IResourceAdapter<?>, DefaultEdge>>(); + Map<IResourceAdapter<?>, AbstractGraph<IResourceAdapter<?>, DefaultEdge>> remainingSubGraphs = + new HashMap<IResourceAdapter<?>, AbstractGraph<IResourceAdapter<?>, DefaultEdge>>(); for(IResourceAdapter<?> successor : directSuccessorVertices) { Set<IResourceAdapter<?>> successorRouteVertices = messageConnectivity.connectedSetOf(successor); - successorRouteVertices.add(communicationResource); - remainingSubGraphs.put(successor, - new DirectedSubgraph<IResourceAdapter<?>, DefaultEdge>(messageRoute, - successorRouteVertices, null)); + if(successorRouteVertices.size() > 1) { + // Add communication resource only if the route is between different partitions. + // TODO: Check if this condition is correct if both partitions reside on the same + // execution unit (and hence no communication resource is needed). + successorRouteVertices.add(communicationResource); + } + + Predicate<IResourceAdapter<?>> vertexMask = v -> successorRouteVertices.contains(v); + Predicate<DefaultEdge> edgeMask = + e -> successorRouteVertices.contains(workingGraph.getEdgeSource(e)) && + successorRouteVertices.contains(workingGraph.getEdgeTarget(e)); + remainingSubGraphs.put(successor, new MaskSubgraph<IResourceAdapter<?>, DefaultEdge>( + messageRoute, vertexMask, edgeMask)); } return remainingSubGraphs; diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/sched/comm/.ratings b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/sched/comm/.ratings index ebcee15574996a9c72a071508b0bc7c506b357cf..b7a9764a5f028455a334ddb4d65f71b5129d3fa5 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/sched/comm/.ratings +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/sched/comm/.ratings @@ -1 +1 @@ -TDMABusScheduler.java b711592d931474543263e86dccd3b5ac39b17f22 RED +TDMABusScheduler.java fed2f26c8c89413ea1b81cf568478f13606333c1 RED diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/sched/comm/TDMABusScheduler.java b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/sched/comm/TDMABusScheduler.java index 20b532bc5028b4ab0e117f12001d9138b4ee00d8..fed2f26c8c89413ea1b81cf568478f13606333c1 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/sched/comm/TDMABusScheduler.java +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/sched/comm/TDMABusScheduler.java @@ -49,8 +49,8 @@ import org.fortiss.af3.exploration.alg.dse.sysmodel.mapping.comm.IMessageRouter; import org.fortiss.af3.exploration.alg.dse.sysmodel.mapping.comm.ShortestPathRouter; import org.fortiss.af3.exploration.alg.dse.sysmodel.sched.SchedulerBase; import org.fortiss.af3.exploration.model.ExplorationSpecification; -import org.jgrapht.DirectedGraph; import org.jgrapht.Graphs; +import org.jgrapht.graph.AbstractGraph; import org.jgrapht.graph.DefaultEdge; import com.google.common.collect.HashMultimap; @@ -86,8 +86,8 @@ public class TDMABusScheduler<S extends InstantiatedTaskMappingEntry, T extends // Add the information about the allocated TimeSlots for the senders and the receivers of // the messages to the generated messages. This information stems from the schedule of the // the execution units - Map<Message, DirectedGraph<IResourceAdapter<?>, DefaultEdge>> messageRoutes = - new HashMap<Message, DirectedGraph<IResourceAdapter<?>, DefaultEdge>>(); + Map<Message, AbstractGraph<IResourceAdapter<?>, DefaultEdge>> messageRoutes = + new HashMap<Message, AbstractGraph<IResourceAdapter<?>, DefaultEdge>>(); for(Message message : generatedMessages) { TimeSlot senderSlot = schedule.getTimeSlotOf(message.getSender()); if(senderSlot == null) { @@ -152,15 +152,14 @@ public class TDMABusScheduler<S extends InstantiatedTaskMappingEntry, T extends // First, we need to retrieve the next communication resource along which the current // message being routed. This is the second element in the list of participating // communication resources, since the first one is the sender. - DirectedGraph<IResourceAdapter<?>, DefaultEdge> messageGraph = + AbstractGraph<IResourceAdapter<?>, DefaultEdge> messageGraph = messageRoutes.get(currentMessage); Set<DefaultEdge> senderResourceEdges = messageGraph.edgesOf(currentMessage.getSenderTimeSlot().getResource()); // Here, we assume that a message may have only one source element. This assumption fits // to multi-cast messaging and the principle how new messages are generated. - assert senderResourceEdges - .size() == 1 : "Each message must have exactly one source slot!"; + assert senderResourceEdges.size() == 1 : "Each message must have exactly one source slot!"; ICommunicationResourceAdapter<?> communicationResource = (ICommunicationResourceAdapter<?>)messageGraph .getEdgeTarget(senderResourceEdges.iterator().next()); @@ -183,13 +182,15 @@ public class TDMABusScheduler<S extends InstantiatedTaskMappingEntry, T extends // Determine and generate successor messages from the current one. // TODO: remove dependency on the TimeSlot Collection<TimeSlot> reachedReceiverSlots = new HashSet<TimeSlot>(); - Collection<Message> succMessages = generateSuccessorMessages(schedule, currentMessage, - messageGraph, communicationResource, communicationSlot, messageRoutes, - reqRecvMsgsPerSlot, reachedReceiverSlots); + Collection<Message> succMessages = + generateSuccessorMessages(schedule, currentMessage, messageGraph, + communicationResource, communicationSlot, messageRoutes, + reqRecvMsgsPerSlot, reachedReceiverSlots); messageReadyQueue.addAll(succMessages); // The ready and release queues are updated for the next iteration. - List<TimeSlot> readySenderSlots = findNextSenderSlots(reachedReceiverSlots, - reqRecvMsgsPerSlot, emitableMessagesPerSlot); + List<TimeSlot> readySenderSlots = + findNextSenderSlots(reachedReceiverSlots, reqRecvMsgsPerSlot, + emitableMessagesPerSlot); updateMessageQueues(readySenderSlots, emitableMessagesPerSlot, messageReleaseQueue, messageReadyQueue); } @@ -271,9 +272,9 @@ public class TDMABusScheduler<S extends InstantiatedTaskMappingEntry, T extends */ private Collection<Message> generateSuccessorMessages(StrictTTSchedule<S, T> schedule, Message currentMessage, - DirectedGraph<IResourceAdapter<?>, DefaultEdge> currentMessageGraph, + AbstractGraph<IResourceAdapter<?>, DefaultEdge> currentMessageGraph, IResourceAdapter<?> communicationResource, TimeSlot communicationSlot, - Map<Message, DirectedGraph<IResourceAdapter<?>, DefaultEdge>> messageRoutes, + Map<Message, AbstractGraph<IResourceAdapter<?>, DefaultEdge>> messageRoutes, Map<TimeSlot, Integer> reqRecvMsgsPerSlot, Collection<TimeSlot> reachedReceiverSlots) { Collection<Message> generatedMessages = new HashSet<Message>(); @@ -288,18 +289,18 @@ public class TDMABusScheduler<S extends InstantiatedTaskMappingEntry, T extends } // Retrieve the routes of the successor messages - Map<IResourceAdapter<?>, DirectedGraph<IResourceAdapter<?>, DefaultEdge>> remainingRoutes = + Map<IResourceAdapter<?>, AbstractGraph<IResourceAdapter<?>, DefaultEdge>> remainingRoutes = messageRouter.getRemainingMessageGraphs(currentMessage, communicationResource, currentMessageGraph); // Generate a new message for each direct successor in the communication graph. - for(IResourceAdapter<?> nextCommunicationResource : Graphs - .successorListOf(currentMessageGraph, communicationResource)) { + for(IResourceAdapter<?> nextCommunicationResource : Graphs.successorListOf( + currentMessageGraph, communicationResource)) { // Check, if a new message is required, i.e. the current direct successor is no receiver // of the message. if(!currentMessageReceiverResources.contains(nextCommunicationResource)) { // Identify the route route corresponding to the current successor and generate a // list of receiver resources. - DirectedGraph<IResourceAdapter<?>, DefaultEdge> successorRoute = + AbstractGraph<IResourceAdapter<?>, DefaultEdge> successorRoute = remainingRoutes.get(nextCommunicationResource); HashSet<TimeSlot> successorReceiverSlots = new HashSet<TimeSlot>(); for(TimeSlot receiverSlot : currentMessageRecieverSlots) { @@ -310,8 +311,9 @@ public class TDMABusScheduler<S extends InstantiatedTaskMappingEntry, T extends // Finally, generate the message. if(!successorReceiverSlots.isEmpty()) { - Message successorMessage = new Message(currentMessage.getSignalAdapter(), - communicationSlot, successorReceiverSlots); + Message successorMessage = + new Message(currentMessage.getSignalAdapter(), communicationSlot, + successorReceiverSlots); generatedMessages.add(successorMessage); messageRoutes.put(successorMessage, successorRoute); } @@ -428,16 +430,18 @@ public class TDMABusScheduler<S extends InstantiatedTaskMappingEntry, T extends // time is added to avoid time slots with a duration of zero. double resourceWCTT = 0.0; if(communicationResource instanceof ITransmissionUnitAdapter) { - resourceWCTT = ((ITransmissionUnitAdapter<?>)communicationResource) - .getTransmissionDuration(message.getMessageSize() / bitsPerMByte); + resourceWCTT = + ((ITransmissionUnitAdapter<?>)communicationResource) + .getTransmissionDuration(message.getMessageSize() / bitsPerMByte); } else if(communicationResource instanceof IGatewayUnitAdapter) { resourceWCTT = ((IGatewayUnitAdapter<?>)communicationResource).getWCFT(); } // resourceWCTT = Math.max(resourceWCTT, minTransmissionDuration); // Create a new slot for the message. - TimeSlot communicationSlot = new TimeSlot(message, communicationResource, messageStartTime, - messageStartTime + resourceWCTT); + TimeSlot communicationSlot = + new TimeSlot(message, communicationResource, messageStartTime, messageStartTime + + resourceWCTT); // Insert the created slot into the schedule of the communication resource. if(schedule.getResourceSchedule(communicationResource) != null) { @@ -545,8 +549,9 @@ public class TDMABusScheduler<S extends InstantiatedTaskMappingEntry, T extends // to shifting other TimeSlots on the same resource. if(shiftTime > 0) { // Shift slots of causality violating slot. - HashSet<TimeSlot> shiftedSlots = shiftResourceSlots(successorSlot, shiftTime, - schedule.getResourceSchedule(successorSlot.getResource())); + HashSet<TimeSlot> shiftedSlots = + shiftResourceSlots(successorSlot, shiftTime, + schedule.getResourceSchedule(successorSlot.getResource())); assert (schedule.getResourceSchedule(successorSlot.getResource()) .validateResourceSchedule()); diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/sched/proc/.ratings b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/sched/proc/.ratings index ecbc1135c2257741a27f25383a1c48d989a4a25d..4a809f80ce855634f8188d46ba974fe985c485bf 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/sched/proc/.ratings +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/sched/proc/.ratings @@ -1,3 +1,3 @@ -EDFSchedulerBase.java 8bbcd90eeb796de2072d74cd7b669083c2b1bb73 RED -FailSilentEDFScheduler.java 14c2fbb0ece5087d7c004fb372ad83fa6e85e5cc RED -FaultDetectionVotingEDFScheduler.java 0d34f4702e29c2610b26656ca07288cfb8b5012e RED +EDFSchedulerBase.java 6946be7732f14d4952e61554e1c747b698f3fcbb RED +FailSilentEDFScheduler.java 14c2fbb0ece5087d7c004fb372ad83fa6e85e5cc RED +FaultDetectionVotingEDFScheduler.java 0d34f4702e29c2610b26656ca07288cfb8b5012e RED diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/sched/proc/EDFSchedulerBase.java b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/sched/proc/EDFSchedulerBase.java index a8da54ef6ed72e0b7c13f21910e4d148f918d2a1..6946be7732f14d4952e61554e1c747b698f3fcbb 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/sched/proc/EDFSchedulerBase.java +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/dse/sysmodel/sched/proc/EDFSchedulerBase.java @@ -242,9 +242,9 @@ public abstract class EDFSchedulerBase<S extends InstantiatedTaskMappingEntry, T // TODO: This used to be based on TaskGraph.index. Check if the implementation based // on the {@link TaskGraph}s {@link #hashCode} is also correct. - return Integer.compare( - acycItgEnc.getTaskGraphOf(obj1.deployableComponent).hashCode(), - acycItgEnc.getTaskGraphOf(obj2.deployableComponent).hashCode()); + return Integer + .compare(acycItgEnc.getTaskGraphOf(obj1.deployableComponent).hashCode(), + acycItgEnc.getTaskGraphOf(obj2.deployableComponent).hashCode()); } } } @@ -258,8 +258,8 @@ public abstract class EDFSchedulerBase<S extends InstantiatedTaskMappingEntry, T * Creates and returns a release queue for the given {@link TaskMappingEncoding}. A release * queue contains those {@link SchedulingObject}s which remain to be scheduled. */ - private synchronized SortedSet<SchedulingObject> - createReleaseQueue(InstantiatedAcyclicTaskGraphEncoding<S, ?> acycItgEnc) { + private synchronized SortedSet<SchedulingObject> createReleaseQueue( + InstantiatedAcyclicTaskGraphEncoding<S, ?> acycItgEnc) { SchedulingObjectComparator EDFTopologicalComparator = new SchedulingObjectComparator(acycItgEnc); TreeSet<SchedulingObject> releaseQueue = @@ -271,7 +271,7 @@ public abstract class EDFSchedulerBase<S extends InstantiatedTaskMappingEntry, T int index = 0; TopologicalOrderIterator<ITaskAdapter<?>, SignalAdapterWeightedEdge> iter = new TopologicalOrderIterator<ITaskAdapter<?>, SignalAdapterWeightedEdge>( - taskGraph.getDelegateGraph()); + taskGraph.getGraph()); while(iter.hasNext()) { ITaskAdapter<?> deployableComponent = iter.next(); // create the instance of each hyper-period @@ -279,13 +279,14 @@ public abstract class EDFSchedulerBase<S extends InstantiatedTaskMappingEntry, T double releasetime = i * taskGraph.getPeriod(); double effectiveDeadline = releasetime + taskGraph.getPeriod(); - SchedulingObject sobject = new SchedulingObject(EDFTopologicalComparator, - deployableComponent, releasetime, effectiveDeadline); + SchedulingObject sobject = + new SchedulingObject(EDFTopologicalComparator, deployableComponent, + releasetime, effectiveDeadline); // set the topological index sobject.index = index++; // add the predecessor list - for(SignalAdapterWeightedEdge edge : taskGraph.getGraph() - .incomingEdgesOf(deployableComponent)) { + for(SignalAdapterWeightedEdge edge : taskGraph.getGraph().incomingEdgesOf( + deployableComponent)) { ITaskAdapter<?> sourceComponent = taskGraph.getGraph().getEdgeSource(edge); // look into the previous allocated scheduling objects for(SchedulingObject pred : localReleaseQueue) { @@ -369,8 +370,9 @@ public abstract class EDFSchedulerBase<S extends InstantiatedTaskMappingEntry, T while(!readyQueue.isEmpty()) { // Add and resort ready queue acc. to deadlines (they can appear dynamically after the // execution of another component) - Collection<ITaskAdapter<?>> componentsWithDeadlines = Sets.intersection( - schedulingComponentMap.keySet(), componentDeadlineSourceMap.keySet()); + Collection<ITaskAdapter<?>> componentsWithDeadlines = + Sets.intersection(schedulingComponentMap.keySet(), + componentDeadlineSourceMap.keySet()); if(!componentsWithDeadlines.isEmpty()) { for(ITaskAdapter<?> currentDeadlineComponent : componentsWithDeadlines) { // Retrieve the IDeployableComponentAdapter that is the target of the current @@ -383,7 +385,7 @@ public abstract class EDFSchedulerBase<S extends InstantiatedTaskMappingEntry, T TaskGraph tgOfDeadlineTarget = acycItgEnc.getTaskGraphOf(targetDeployableComponent); Collection<ITaskAdapter<?>> deadlineTargetPredescessors = - Graphs.predecessorListOf(tgOfDeadlineTarget.getDelegateGraph(), + Graphs.predecessorListOf(tgOfDeadlineTarget.getGraph(), targetDeployableComponent); // TODO: Separate method to adjust readyQueue. @@ -404,15 +406,17 @@ public abstract class EDFSchedulerBase<S extends InstantiatedTaskMappingEntry, T // Pick first task in the ready queue... SchedulingObject schedulingObject = readyQueue.first(); // ...and schedule it - Apfloat finishTime = scheduleObject(schedulingObject, acycItgEnc, partEnc, taskMapping, - schedule, currenttimes, mappingEntryToTimeSlot, generatedTimeSlots); + Apfloat finishTime = + scheduleObject(schedulingObject, acycItgEnc, partEnc, taskMapping, schedule, + currenttimes, mappingEntryToTimeSlot, generatedTimeSlots); // Check if any successor becomes ready List<SchedulingObject> toBeRemoved = new ArrayList<SchedulingObject>(); for(SchedulingObject object : releaseQueueLocal) { if(object.predecessors.contains(schedulingObject)) { - object.ready = (object.ready > finishTime.doubleValue() ? object.ready - : finishTime.doubleValue()); + object.ready = + (object.ready > finishTime.doubleValue() ? object.ready : finishTime + .doubleValue()); object.unscheduledPredecessors.remove(schedulingObject); if(object.unscheduledPredecessors.isEmpty()) { toBeRemoved.add(object); @@ -429,8 +433,8 @@ public abstract class EDFSchedulerBase<S extends InstantiatedTaskMappingEntry, T for(SchedulingObject schObj : releaseQueueLocal) { Double compPeriod = schObj.deployableComponent.getPeriod(); if(compPeriod != null) { - throw new RuntimeException( - "The Components " + releaseQueueLocal + " were not scheduled..."); + throw new RuntimeException("The Components " + releaseQueueLocal + + " were not scheduled..."); } } } @@ -441,8 +445,8 @@ public abstract class EDFSchedulerBase<S extends InstantiatedTaskMappingEntry, T /** Inserts a single {@link SchedulingObject} into the {@link StrictTTSchedule} */ private Apfloat scheduleObject(SchedulingObject schedulingObject, - InstantiatedAcyclicTaskGraphEncoding<S, ?> acycItgEnc, PartitionMappingEncoding partEnc, - T encoding, StrictTTSchedule<S, T> schedule, + InstantiatedAcyclicTaskGraphEncoding<S, ?> acycItgEnc, + PartitionMappingEncoding partEnc, T encoding, StrictTTSchedule<S, T> schedule, Map<IExecutionUnitAdapter<?>, Apfloat> currentTimeMap, Map<S, TimeSlot> mappingEntryToTimeSlot, Multimap<SchedulingObject, TimeSlot> generatedTimeSlots) { @@ -478,8 +482,9 @@ public abstract class EDFSchedulerBase<S extends InstantiatedTaskMappingEntry, T } // Add execution time - Apfloat deployableComponentExecutionTime = getExecutionTime(encoding, acycItgEnc, - schedulingObject.deployableComponent, entry); + Apfloat deployableComponentExecutionTime = + getExecutionTime(encoding, acycItgEnc, schedulingObject.deployableComponent, + entry); if(deployableComponentExecutionTime.compareTo(Apcomplex.ZERO) == -1) { throw new ScheduleRuntimeException(schedule, "Could not determine the runtime execution time for the Component " + @@ -500,9 +505,10 @@ public abstract class EDFSchedulerBase<S extends InstantiatedTaskMappingEntry, T // Build time slot long iteration = java.lang.Math.round(schedulingObject.release / taskGraph.getPeriod()); iteration = iteration >= 0 ? iteration : 0; - TimeSlot deployableComponentSlot = schedule.createTimeSlot(entry, partition, - predecessorSlots, startTime.floatValue(), - deployableComponentEndTime.floatValue(), iteration); + TimeSlot deployableComponentSlot = + schedule.createTimeSlot(entry, partition, predecessorSlots, + startTime.floatValue(), deployableComponentEndTime.floatValue(), + iteration); // Register the generated TimeSlot at its predecessors. for(SchedulingObject predecessor : schedulingObject.getPredecessors()) { @@ -521,9 +527,10 @@ public abstract class EDFSchedulerBase<S extends InstantiatedTaskMappingEntry, T // the current deployableComponentSlot. // Add the information about the sender and the receiver TimeSlots which contain the // start and end times of the Message. - Apfloat delay = registerIncomingMessagesWithSchedule(encoding, acycItgEnc, schedule, - mappingEntryToTimeSlot, schedulingObject.deployableComponent, startTime, - entry.getTarget(), iteration, deployableComponentSlot); + Apfloat delay = + registerIncomingMessagesWithSchedule(encoding, acycItgEnc, schedule, + mappingEntryToTimeSlot, schedulingObject.deployableComponent, + startTime, entry.getTarget(), iteration, deployableComponentSlot); deployableComponentSlot.shift(delay.floatValue()); deployableComponentEndTime = diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/graph/.ratings b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/graph/.ratings index 6eefaced98791368c8786ed35011caddb0a617b8..04b250271e1cea8af2efd02ae565a858ec3a9692 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/graph/.ratings +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/graph/.ratings @@ -1,3 +1,3 @@ -DependencyEdge.java 2de1bcec554c6167f132b3808040704867c65b7f RED -DependencyGraph.java c00ed51a15597aad876b80d2a323c9053c1b5995 RED -IDependencyModule.java 51c66e0f96ef56e9c5f34ead3b4efeddf2193b55 RED +DependencyEdge.java 2de1bcec554c6167f132b3808040704867c65b7f RED +DependencyGraph.java 2ccadc367dbe552fbfc74689b64139ba7ef38b38 RED +IDependencyModule.java 51c66e0f96ef56e9c5f34ead3b4efeddf2193b55 RED diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/graph/DependencyGraph.java b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/graph/DependencyGraph.java index 745cb18dfa5992412c063d6280c44ede081e54b2..2ccadc367dbe552fbfc74689b64139ba7ef38b38 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/graph/DependencyGraph.java +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/graph/DependencyGraph.java @@ -41,8 +41,7 @@ import org.fortiss.af3.exploration.alg.graph.display.ObjectJGraphTVisualizer; import org.fortiss.af3.exploration.alg.service.IExplorationEncoding; import org.fortiss.af3.exploration.alg.util.GraphUtils; import org.jgrapht.Graphs; -import org.jgrapht.experimental.dag.DirectedAcyclicGraph; -import org.jgrapht.experimental.dag.DirectedAcyclicGraph.CycleFoundException; +import org.jgrapht.graph.DirectedAcyclicGraph; import org.opt4j.core.optimizer.IncompatibilityException; import org.opt4j.core.problem.Creator; import org.opt4j.core.problem.Decoder; @@ -90,8 +89,7 @@ public abstract class DependencyGraph<V, T extends IDependencyModule<V, ? extend protected Set<Class<? extends V>> inputEncodings = new HashSet<>(); /** Constructor. */ - public DependencyGraph(Set<Class<? extends V>> reqTypeCollection, - Class<? extends V> vertexType) { + public DependencyGraph(Set<Class<? extends V>> reqTypeCollection, Class<? extends V> vertexType) { requestedTypes = reqTypeCollection; this.vertexType = vertexType; } @@ -109,11 +107,11 @@ public abstract class DependencyGraph<V, T extends IDependencyModule<V, ? extend * operator to this {@link DependencyGraph}. They are connected by edges * which represent the given operator. * - * @throws CycleFoundException + * @throws IllegalArgumentException * If adding the given operator to {@code this} graph would result * in circular dependencies in executing the operators. */ - public void addOperator(T edgeOperator) throws CycleFoundException { + public void addOperator(T edgeOperator) throws IllegalArgumentException { Collection<Class<? extends V>> requiredTypes = getReqInputTypesFrom(edgeOperator); // TODO: add a proper exception. if(vertexType.isAssignableFrom(edgeOperator.getOutputType())) { @@ -133,7 +131,7 @@ public abstract class DependencyGraph<V, T extends IDependencyModule<V, ? extend } else { E edge = dependencyDagGraph.getEdge(outType, inputPheno); if(edge == null) { - edge = dependencyDagGraph.addDagEdge(outType, inputPheno); + edge = dependencyDagGraph.addEdge(outType, inputPheno); } edge.addDecoder(edgeOperator); } @@ -151,9 +149,9 @@ public abstract class DependencyGraph<V, T extends IDependencyModule<V, ? extend Collection<Class<? extends V>> castedInputTypes = new HashSet<>(); for(Class<?> curInputType : module.getRequiredTypes()) { if(curInputType.isAssignableFrom(vertexType)) { - throw new IncompatibilityException( - "The required input type " + curInputType.getSimpleName() + " is not an " + - vertexType.getSimpleName() + "."); + throw new IncompatibilityException("The required input type " + + curInputType.getSimpleName() + " is not an " + vertexType.getSimpleName() + + "."); } castedInputTypes.add((Class<? extends V>)curInputType); } @@ -204,12 +202,13 @@ public abstract class DependencyGraph<V, T extends IDependencyModule<V, ? extend } // required Operators --> additional Identity decoders. - Collection<Class<? extends V>> inTypes = requiredOperators.stream() - .map(d -> dependencyDagGraph.getEdgeSource(d)).collect(Collectors.toList()); - getIdentityOperatorsOf(inTypes).entrySet() - .forEach(e -> identityOperators.put(e.getKey(), e.getValue())); - getIdentityOperatorsOf(requestedTypes).entrySet() - .forEach(e -> identityOperators.put(e.getKey(), e.getValue())); + Collection<Class<? extends V>> inTypes = + requiredOperators.stream().map(d -> dependencyDagGraph.getEdgeSource(d)) + .collect(Collectors.toList()); + getIdentityOperatorsOf(inTypes).entrySet().forEach( + e -> identityOperators.put(e.getKey(), e.getValue())); + getIdentityOperatorsOf(requestedTypes).entrySet().forEach( + e -> identityOperators.put(e.getKey(), e.getValue())); for(E edge : requiredOperators) { Graphs.addEdgeWithVertices(execOrderGraph, dependencyDagGraph, edge); @@ -250,8 +249,7 @@ public abstract class DependencyGraph<V, T extends IDependencyModule<V, ? extend * Calculates the effective execution order of the operators and adds them to the internal list * of {@code this} {@link DependencyGraph}. */ - private void - calculateExecOrderList(DirectedAcyclicGraph<Class<? extends V>, E> execOrderGraph) { + private void calculateExecOrderList(DirectedAcyclicGraph<Class<? extends V>, E> execOrderGraph) { Iterator<Class<? extends V>> encodingIter = execOrderGraph.iterator(); while(encodingIter.hasNext()) { Class<? extends V> encoding = encodingIter.next(); @@ -345,15 +343,14 @@ public abstract class DependencyGraph<V, T extends IDependencyModule<V, ? extend * Returns a collection of identity operators which operate on the given input types. The set of * operators to be checked equals the set of operators in the graph. */ - private Map<Class<? extends V>, T> - getIdentityOperatorsOf(Collection<Class<? extends V>> encodingTypes) { + private Map<Class<? extends V>, T> getIdentityOperatorsOf( + Collection<Class<? extends V>> encodingTypes) { Map<Class<? extends V>, T> filteredIdentityOperators = new HashMap<>(); for(E edge : dependencyDagGraph.edgeSet()) { Class<? extends V> srcType = dependencyDagGraph.getEdgeSource(edge); if((srcType == dependencyDagGraph.getEdgeTarget(edge)) && encodingTypes.contains(srcType)) { - assert (edge.getElements() - .size() > 1) : "Only one identity decoder for each element type is supported."; + assert (edge.getElements().size() > 1) : "Only one identity decoder for each element type is supported."; filteredIdentityOperators.put(srcType, edge.getElements().stream().findAny().get()); } } diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/graph/display/.ratings b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/graph/display/.ratings index 4e939f8bfee780eb6ae8f4c7eb9b0cf4bc40bf79..20502603e14b63d1d3d4f9c541edaba10539e480 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/graph/display/.ratings +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/graph/display/.ratings @@ -1,6 +1,6 @@ -AF3JGraphTVisualizer.java 3608982f88f8605806a93887c7637f05cfaad39f RED -JGraphTVisualizer.java 178b8a5caeba118ce61d867a4f090bdfaaa33021 RED -NamedAF3Vertex.java a149c2cc614086aeac840e5624af97b906802a4e RED -NamedVertex.java d7f25cd2df6da0569a4b7bcad23683a1cd9d244e RED -ObjectJGraphTVisualizer.java 284fd7554765867b5b08701e502063c54d55ea05 RED -ObjectVertex.java e9249d0502db6fe91b70f333c5dbe30ceadbc0e8 RED +AF3JGraphTVisualizer.java 7701857ceac31ebcd4a151c5ee60770693c1b65b RED +JGraphTVisualizer.java 86016e5edfe59e73243cfa085ea288682baee6f8 RED +NamedAF3Vertex.java a149c2cc614086aeac840e5624af97b906802a4e RED +NamedVertex.java d7f25cd2df6da0569a4b7bcad23683a1cd9d244e RED +ObjectJGraphTVisualizer.java ddfea79b2155c15982020803dcda809050bcfce3 RED +ObjectVertex.java e9249d0502db6fe91b70f333c5dbe30ceadbc0e8 RED diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/graph/display/AF3JGraphTVisualizer.java b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/graph/display/AF3JGraphTVisualizer.java index b24de8c69d8b01a5e99984285b43148a22d08df7..7701857ceac31ebcd4a151c5ee60770693c1b65b 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/graph/display/AF3JGraphTVisualizer.java +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/graph/display/AF3JGraphTVisualizer.java @@ -22,7 +22,6 @@ import java.util.Set; import javax.swing.JFrame; import org.fortiss.tooling.base.model.element.IModelElement; -import org.jgrapht.DirectedGraph; import org.jgrapht.Graph; import org.jgrapht.ext.JGraphXAdapter; import org.jgrapht.graph.DefaultDirectedGraph; @@ -50,7 +49,7 @@ public class AF3JGraphTVisualizer<V extends IModelElement, E extends DefaultEdge * Contains the graph which was given to the Constructor, except that the vertices have been * converted to Named vertices to support comprehensive visualization. */ - private DirectedGraph<NamedAF3Vertex<V>, DefaultEdge> namedGraph; + private DefaultDirectedGraph<NamedAF3Vertex<V>, DefaultEdge> namedGraph; /** Constructor. */ public AF3JGraphTVisualizer(Graph<V, E> g) { @@ -87,9 +86,9 @@ public class AF3JGraphTVisualizer<V extends IModelElement, E extends DefaultEdge * Converts the given graph to graph that has {@link NamedVertex}-Nodes instead of the original * vertices. Displaying those is more convenient. */ - private DirectedGraph<NamedAF3Vertex<V>, DefaultEdge> - constructNamedGraph(Graph<V, E> originalGraph) { - DirectedGraph<NamedAF3Vertex<V>, DefaultEdge> namedGraph = + private DefaultDirectedGraph<NamedAF3Vertex<V>, DefaultEdge> constructNamedGraph( + Graph<V, E> originalGraph) { + DefaultDirectedGraph<NamedAF3Vertex<V>, DefaultEdge> namedGraph = new DefaultDirectedGraph<NamedAF3Vertex<V>, DefaultEdge>(DefaultEdge.class); Set<E> originalEdgeSet = originalGraph.edgeSet(); Map<V, NamedAF3Vertex<V>> relateVertexToNamedElement = new HashMap<V, NamedAF3Vertex<V>>(); diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/graph/display/JGraphTVisualizer.java b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/graph/display/JGraphTVisualizer.java index 183316386cbee6351d349a3177d15552e86d66f9..86016e5edfe59e73243cfa085ea288682baee6f8 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/graph/display/JGraphTVisualizer.java +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/graph/display/JGraphTVisualizer.java @@ -22,7 +22,6 @@ import java.util.Set; import javax.swing.JFrame; import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.IModelElementAdapter; -import org.jgrapht.DirectedGraph; import org.jgrapht.Graph; import org.jgrapht.ext.JGraphXAdapter; import org.jgrapht.graph.DefaultDirectedGraph; @@ -44,13 +43,13 @@ import com.mxgraph.util.mxConstants; * * @author diewald */ -public class JGraphTVisualizer<V extends IModelElementAdapter<?>, E extends DefaultEdge> { +public class JGraphTVisualizer<V extends IModelElementAdapter<?>, E> { /** * Contains the graph which was given to the Constructor, except that the vertices have been * converted to Named vertices to support comprehensive visualization. */ - private DirectedGraph<NamedVertex<V>, DefaultEdge> namedGraph; + private DefaultDirectedGraph<NamedVertex<V>, DefaultEdge> namedGraph; /** Constructor. */ public JGraphTVisualizer(Graph<V, E> g) { @@ -87,9 +86,9 @@ public class JGraphTVisualizer<V extends IModelElementAdapter<?>, E extends Defa * Converts the given graph to graph that has {@link NamedVertex}-Nodes instead of the original * vertices. Displaying those is more convenient. */ - private DirectedGraph<NamedVertex<V>, DefaultEdge> - constructNamedGraph(Graph<V, E> originalGraph) { - DirectedGraph<NamedVertex<V>, DefaultEdge> namedGraph = + private DefaultDirectedGraph<NamedVertex<V>, DefaultEdge> constructNamedGraph( + Graph<V, E> originalGraph) { + DefaultDirectedGraph<NamedVertex<V>, DefaultEdge> namedGraph = new DefaultDirectedGraph<NamedVertex<V>, DefaultEdge>(DefaultEdge.class); Set<E> originalEdgeSet = originalGraph.edgeSet(); Map<V, NamedVertex<V>> relateVertexToNamedElement = new HashMap<V, NamedVertex<V>>(); diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/graph/display/ObjectJGraphTVisualizer.java b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/graph/display/ObjectJGraphTVisualizer.java index e248dd681bcc22d636172028c2180893164cc496..ddfea79b2155c15982020803dcda809050bcfce3 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/graph/display/ObjectJGraphTVisualizer.java +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/graph/display/ObjectJGraphTVisualizer.java @@ -21,7 +21,6 @@ import java.util.Set; import javax.swing.JFrame; -import org.jgrapht.DirectedGraph; import org.jgrapht.Graph; import org.jgrapht.ext.JGraphXAdapter; import org.jgrapht.graph.DefaultDirectedGraph; @@ -50,7 +49,7 @@ public class ObjectJGraphTVisualizer<V, E extends DefaultEdge> { * Contains the graph which was given to the Constructor, except that the vertices have been * converted to Named vertices to support comprehensive visualization. */ - private DirectedGraph<ObjectVertex<V>, DefaultEdge> namedGraph; + private DefaultDirectedGraph<ObjectVertex<V>, DefaultEdge> namedGraph; /** Constructor. */ public ObjectJGraphTVisualizer(Graph<V, E> g) { @@ -86,9 +85,9 @@ public class ObjectJGraphTVisualizer<V, E extends DefaultEdge> { * Converts the given graph to graph that has {@link NamedVertex}-Nodes instead of the original * vertices. Displaying those is more convenient. */ - private DirectedGraph<ObjectVertex<V>, DefaultEdge> - constructNamedGraph(Graph<V, E> originalGraph) { - DirectedGraph<ObjectVertex<V>, DefaultEdge> namedGraph = + private DefaultDirectedGraph<ObjectVertex<V>, DefaultEdge> constructNamedGraph( + Graph<V, E> originalGraph) { + DefaultDirectedGraph<ObjectVertex<V>, DefaultEdge> namedGraph = new DefaultDirectedGraph<>(DefaultEdge.class); Set<E> originalEdgeSet = originalGraph.edgeSet(); Map<V, ObjectVertex<V>> relateVertexToNamedElement = new HashMap<>(); diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/util/.ratings b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/util/.ratings index d9ef439a231b0c2e5fd97ec47323af9365c450a7..6e73a5161ce4a15556ba59e741e5583f68b9c394 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/util/.ratings +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/util/.ratings @@ -1,7 +1,7 @@ -AF3Utils.java c48bfa348731c379205d72fbf0380f505e15176d RED -DesignSpaceExplorationModelElementFactory.java 73368ff5bd5ab3dab10aca6a331e14cbde440f59 RED -ExplorationAlgDebugUtils.java 06116a61e99717a59b7b01e4e2865bf044a8a0e2 RED -ExplorationAlgUtils.java 3571ce1be1bcc997d800c59e0108544293194e70 RED -ExplorationEcoreUtils.java 48ed07aec3cd93e66d37abc10d50636d591f1c71 RED -GraphUtils.java 8b25592f30645f7709af527c72551f038a163833 RED -TransformationUtils.java 9b424a20d117a601f9c6a4a4a4ee9e4879c29195 YELLOW +AF3Utils.java 4d9ed715b8796d295a2a2da04e51eed0bc82dedf RED +DesignSpaceExplorationModelElementFactory.java 73368ff5bd5ab3dab10aca6a331e14cbde440f59 RED +ExplorationAlgDebugUtils.java 06116a61e99717a59b7b01e4e2865bf044a8a0e2 RED +ExplorationAlgUtils.java 3571ce1be1bcc997d800c59e0108544293194e70 RED +ExplorationEcoreUtils.java 48ed07aec3cd93e66d37abc10d50636d591f1c71 RED +GraphUtils.java 95c44f526bcbcff23b3e785b3d715d070fbe8734 RED +TransformationUtils.java 9b424a20d117a601f9c6a4a4a4ee9e4879c29195 YELLOW diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/util/AF3Utils.java b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/util/AF3Utils.java index f372a35e0c0197ba8c18fdef66fe7e5ab468acc0..4d9ed715b8796d295a2a2da04e51eed0bc82dedf 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/util/AF3Utils.java +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/util/AF3Utils.java @@ -76,7 +76,7 @@ import org.fortiss.tooling.base.model.element.IHierarchicElement; import org.fortiss.tooling.base.model.element.IModelElement; import org.fortiss.tooling.base.utils.AnnotationUtils; import org.fortiss.tooling.kernel.model.IIdLabeled; -import org.jgrapht.DirectedGraph; +import org.jgrapht.graph.DefaultDirectedGraph; import org.jgrapht.graph.DefaultEdge; /** @@ -374,7 +374,7 @@ public class AF3Utils { /** * Predicate whether the subject {@link PlatformConnectorUnit}'s containing element is contained * in the given {@link IModelElementAdapter} and also contained in the given - * {@link DirectedGraph}. + * {@link DefaultDirectedGraph}. */ public static boolean isContainedInResource(PlatformConnectorUnit pConn, IModelElementAdapter<?> element) { @@ -386,10 +386,9 @@ public class AF3Utils { * {@link PlatformConnectorUnit} for the device-internal communication of the given * {@link IModelElementAdapter}. */ - public static boolean - isDeviceInternalPredecessor(PlatformConnectorUnit connCandidate, - IModelElementAdapter<?> element, - DirectedGraph<PlatformConnectorUnit, DefaultEdge> route) { + public static boolean isDeviceInternalPredecessor(PlatformConnectorUnit connCandidate, + IModelElementAdapter<?> element, + DefaultDirectedGraph<PlatformConnectorUnit, DefaultEdge> route) { // The following rules apply for device internal communication: // - Sender Port is on the same device OR // - its reference port is one layer "below", e.g. Gateway -> Router AND diff --git a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/util/GraphUtils.java b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/util/GraphUtils.java index 12f6e2910b408b4a0f5df5c778667c0952853ff5..95c44f526bcbcff23b3e785b3d715d070fbe8734 100644 --- a/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/util/GraphUtils.java +++ b/org.fortiss.af3.exploration.alg/src/org/fortiss/af3/exploration/alg/util/GraphUtils.java @@ -23,9 +23,10 @@ import java.util.Collection; import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.ITaskAdapter; import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.taskgraph.TaskGraph; -import org.jgrapht.DirectedGraph; import org.jgrapht.Graph; import org.jgrapht.Graphs; +import org.jgrapht.graph.DefaultDirectedGraph; +import org.jgrapht.graph.DirectedAcyclicGraph; import org.jgrapht.traverse.BreadthFirstIterator; /** @@ -115,7 +116,8 @@ public class GraphUtils { * The vertex whose predecessors shall be determined. * @return Collection of predecessor vertices. */ - public static <V, E> Collection<V> getAllPredescesorsOf(DirectedGraph<V, E> graph, V vertex) { + public static <V, E> Collection<V> getAllPredescesorsOf(DirectedAcyclicGraph<V, E> graph, + V vertex) { Collection<V> predescessorList = new ArrayList<V>(); ArrayList<V> workingQueue = new ArrayList<V>(); workingQueue.addAll(Graphs.predecessorListOf(graph, vertex)); @@ -142,7 +144,8 @@ public class GraphUtils { * The vertex whose successors shall be determined. * @return Collection of successor vertices. */ - public static <V, E> Collection<V> getAllSuccessorsOf(DirectedGraph<V, E> graph, V vertex) { + public static <V, E> Collection<V> + getAllSuccessorsOf(DefaultDirectedGraph<V, E> graph, V vertex) { Collection<V> successorList = new ArrayList<V>(); ArrayList<V> workingQueue = new ArrayList<V>(); workingQueue.addAll(Graphs.successorListOf(graph, vertex)); @@ -161,10 +164,10 @@ public class GraphUtils { /** * Determines whether a path exists between the given vertices in the given - * {@link DirectedGraph}. + * {@link DefaultDirectedGraph}. * * @param graph - * {@link DirectedGraph} containing the vertices + * {@link DefaultDirectedGraph} containing the vertices * @param sourceVertex * Vertex from which the search starts. * @param endVertex @@ -172,8 +175,8 @@ public class GraphUtils { * @return boolean indication whether or not the given graph contains a (directed) path between * source- and the end vertex. */ - public static <V, E> boolean directedPathExisits(DirectedGraph<V, E> graph, V sourceVertex, - V endVertex) { + public static <V, E> boolean directedPathExisits(DefaultDirectedGraph<V, E> graph, + V sourceVertex, V endVertex) { boolean pathExists = false; BreadthFirstIterator<V, E> bfsIter = new BreadthFirstIterator<V, E>(graph, sourceVertex); while(bfsIter.hasNext() && !pathExists) {