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

DI: Sketch improved provisioning mechanism.

parent 2dd15a98
No related branches found
No related tags found
1 merge request!2Dependency injection
......@@ -2,5 +2,5 @@ ComposableDecoder.java 0ef247e0e8424968cd8dab8317df0e504c5018d4 RED
ComposableDecoderBase.java 7c47b41e609b6911128efa469c2dd65122276bcc RED
CompositeDecoder.java 68864146cbd7b0d1444d4157cf88023deb4a21ea RED
CompositeDecoderBase.java cc878483ec3dcf3afd60509579c7c17a3433893c RED
GuiceDecoder.java 3fda47c70fa49cbe4398dc43e0819f2c6179202f RED
GuiceDecoder.java 40f2c0bff70134909551fbd602c15f7439555ff7 RED
PhenotypeDecoder.java 82766d64d8d6d0aa02078921517848c3585240a6 RED
......@@ -15,7 +15,7 @@
+--------------------------------------------------------------------------*/
package org.fortiss.af3.exploration.alg.dse.backend.opt4j.extensions.compositegene.decode;
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.encoding.taskmapping.TaskMappingEncoding;
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.encoding.taskmapping.instantiatedmapping.FailSilentTaskMappingEncoding;
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.extensions.compositegene.phenotype.Phenotype;
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.problem.taskmapping.instantiate.FailSilentAbstractTaskMappingDecoder;
import org.opt4j.core.Genotype;
......@@ -36,12 +36,11 @@ import com.google.inject.Provides;
public class GuiceDecoder extends AbstractModule implements Decoder<Genotype, Phenotype> {
/** Resulting phenotype from the decoding phase that is composed of sub-{@link Phenotype}s. */
@Inject
protected Phenotype composedPhenotype;
/** Defines the desired exploration result type. */
// TODO: Remove this hard coded line and get the desired result from the backend interface.
protected Class<? extends Phenotype> resultType = TaskMappingEncoding.class;
protected Class<? extends Phenotype> resultType = FailSilentTaskMappingEncoding.class;
/** Injector created by the {@link Opt4JTask}. */
@Inject
......@@ -62,6 +61,7 @@ public class GuiceDecoder extends AbstractModule implements Decoder<Genotype, Ph
/** {@inheritDoc} */
@Override
@Provides
public Phenotype decode(Genotype genotype) {
// The decode operations are responsible to add the results of the decode operation to the
// parent phenotype.
......@@ -83,7 +83,7 @@ public class GuiceDecoder extends AbstractModule implements Decoder<Genotype, Ph
@Override
protected void configure() {
// TODO(AD): we need to implement a service mechanism in this configure method. (Plugin
// Style)
bind(TaskMappingEncoding.class).toProvider(FailSilentAbstractTaskMappingDecoder.class);
// Style).
install(new FailSilentAbstractTaskMappingDecoder());
}
}
......@@ -4,5 +4,5 @@ ArchitectureExplorationProblemModule.java a1c6b8ced3b1bf54ce9d9b957b0f4c80a821bd
DseProblemModuleBase.java 0eba41852529e92e7255c7a7d8fce18354facbca RED
EvaluatorWrapper.java 3747e5b78b1dcef8e1595c1ae9354e8ef2738e79 RED
ExplorationGoalPriorityMultiEvaluator.java 1f6d2aa6ece8acdf4f57face0439f3429ab87329 RED
ProblemModuleBase.java e776938a9d2cc2a40e559c266b5c7bf405cb3eec RED
ProblemModuleBase.java 460f7a8a07435eb13634caa9072e425bdf20e399 RED
StrictTTDecoder.java d44d02b5f866717ebaa40a8a1a32225852e56af8 RED
......@@ -159,6 +159,10 @@ public abstract class ProblemModuleBase<G extends Genotype, R extends Creator<G>
binder().bind(new TypeLiteral<Creator<Genotype>>() { // empty
}).toInstance((Creator<Genotype>)creator);
// FIXME: Duplicates below!!!!!
binder().bind(new TypeLiteral<Decoder<Genotype, Phenotype>>() { // empty
}).toInstance((Decoder<Genotype, Phenotype>)decoder);
binder().bind(new TypeLiteral<Decoder<Genotype, Object>>() { // empty
}).toInstance((Decoder<Genotype, Object>)decoder);
......
AbstractTaskMappingDecoder.java 85d46ecd859052c487f31e47065375ae423e50ff RED
FailSilentAbstractTaskMappingDecoder.java 011dfebeaedb183ab0edc9a84eb71410a943a4db RED
FailSilentAbstractTaskMappingDecoder.java 7e6b8121a5de04b0426b2ff97b1df8c059235cb3 RED
FaultDetectionVotingAbstractTaskMappingDecoder.java 8fb87c6c0b1aa7fdff5340c34bbc3a98dcab12e1 RED
TaskInstanceResourceAlignmentDecoder.java fe8b789f3a0185585a90cf1882fd3983453b4a0d RED
......@@ -20,9 +20,6 @@ import static org.fortiss.tooling.common.util.LambdaUtils.filterSet;
import java.util.ArrayList;
import java.util.Collection;
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.encoding.partitionmapping.PartitionMappingEncoding;
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.encoding.taskgraph.AbstractTaskGraphEncoding;
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.encoding.taskmapping.TaskMappingEncoding;
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.encoding.taskmapping.abstractmapping.AbstractTaskMappingEncoding;
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.encoding.taskmapping.abstractmapping.AbstractTaskMappingEntry;
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.encoding.taskmapping.instantiatedmapping.FailSilentTaskMappingEncoding;
......@@ -33,8 +30,6 @@ import org.fortiss.af3.exploration.alg.dse.backend.opt4j.extensions.compositegen
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.extensions.compositegene.phenotype.Phenotype;
import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.ITaskAdapter;
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.Provides;
/**
......@@ -46,30 +41,41 @@ import com.google.inject.Provides;
// FIXME: The type hierarchy and naming of the classes is extremely confusing. FIX ASAP!
public class FailSilentAbstractTaskMappingDecoder extends
AbstractTaskMappingDecoder<FailSilentTaskMappingEntry, FailSilentTaskMappingEncoding>
implements Provider<TaskMappingEncoding> {
/* implements Provider<TaskMappingEncoding> */{
public FailSilentAbstractTaskMappingDecoder() {
}
/** {@inheritDoc} */
@Override
public void configure() {
// install(this);
}
/** Input task mapping that may contain components which need to be instantiated. */
@Inject
AbstractTaskMappingEncoding atmEnc;
// @Inject
// AbstractTaskMappingEncoding atmEnc;
/** Input task graph to perform the mapping. */
@Inject
AbstractTaskGraphEncoding<?, ?> atgEnc;
// @Inject
// AbstractTaskGraphEncoding<?, ?> atgEnc;
/**
* Input mapping of partitions to executions units. This step maps to partitions encoded here.
* Additionally, information about the phys. executor may be required for smart mapping
* decisions.
*/
@Inject
PartitionMappingEncoding partEnc;
// @Inject
// PartitionMappingEncoding partEnc;
/** {@inheritDoc} */
@Override
@Provides
public FailSilentTaskMappingEncoding decodeComposable(AbstractTaskMappingEncoding genotype,
public FailSilentTaskMappingEncoding decodeComposable(AbstractTaskMappingEncoding atmEnc,
FlatPhenotypeMap<Phenotype> phenotypeTypeMap) {
return new FailSilentTaskMappingEncoding(partEnc, atgEnc, atmEnc);
return null;
// return new FailSilentTaskMappingEncoding(partEnc, atgEnc, atmEnc);
}
// TODO: Abstract to the AbstractTaskMappingDecoder.
......@@ -144,9 +150,9 @@ public class FailSilentAbstractTaskMappingDecoder extends
// TODO: The list of parameters injected into the decodeComposable call should be 0, use fields
// for now.
/** {@inheritDoc} */
@Override
public TaskMappingEncoding get() {
return decodeComposable(null, null);
}
// /** {@inheritDoc} */
// @Override
// public TaskMappingEncoding get() {
// return decodeComposable(null, null);
// }
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment