1 | package de.uka.ipd.sdq.dsexplore.analysis; |
2 | |
3 | import de.uka.ipd.sdq.context.aggregatedUsageContext.ComputedAggregatedUsage; |
4 | import de.uka.ipd.sdq.context.computed_usage.ComputedUsageContext; |
5 | import de.uka.ipd.sdq.dsexplore.opt4j.start.Opt4JStarter; |
6 | import de.uka.ipd.sdq.pcmsolver.models.PCMInstance; |
7 | import de.uka.ipd.sdq.pcmsolver.visitors.AggregatedContextUsageModelVisitor; |
8 | import de.uka.ipd.sdq.pcmsolver.visitors.UsageModelVisitor; |
9 | |
10 | public abstract class AbstractPerformanceAnalysisResult implements |
11 | IPerformanceAnalysisResult { |
12 | |
13 | private ComputedAggregatedUsage computedAggregatedUsage = null; |
14 | |
15 | public AbstractPerformanceAnalysisResult(PCMInstance model) { |
16 | |
17 | if (Opt4JStarter.getDSEWorkflowConfig().isUseHeuristics()) { |
18 | |
19 | solveDependencies(model); |
20 | |
21 | this.computedAggregatedUsage = model.getComputedAggregatedUsage(); |
22 | } |
23 | |
24 | } |
25 | |
26 | /** |
27 | * Careful: Must only be called per {@link PCMInstance} once, because otherwise it will |
28 | * reuse {@link ComputedUsageContext} from old candidates. |
29 | * @param model |
30 | */ |
31 | public static void solveDependencies(PCMInstance model) { |
32 | // XXX: Dependency solver replaces IntPMFs and DoublePMFs by |
33 | // DoublePDFs. |
34 | |
35 | model.resetComputedContexts(); |
36 | |
37 | UsageModelVisitor visitor = new AggregatedContextUsageModelVisitor( |
38 | model); |
39 | visitor.doSwitch(model.getUsageModel()); |
40 | |
41 | } |
42 | |
43 | /** |
44 | * @return the computedAggregatedUsage |
45 | */ |
46 | public ComputedAggregatedUsage getComputedAggregatedUsage() { |
47 | return computedAggregatedUsage; |
48 | } |
49 | |
50 | |
51 | |
52 | |
53 | } |