EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.dsexplore.opt4j.optimizer.heuristic.operators]

COVERAGE SUMMARY FOR SOURCE FILE [AbstractTactic.java]

nameclass, %method, %block, %line, %
AbstractTactic.java0%   (0/1)0%   (0/7)0%   (0/105)0%   (0/23)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AbstractTactic0%   (0/1)0%   (0/7)0%   (0/105)0%   (0/23)
AbstractTactic (Copy, DSEIndividualBuilder, DSEWorkflowConfiguration, String ... 0%   (0/1)0%   (0/18)0%   (0/7)
doesNotImprove (Dimension, EvaluationAspect): boolean 0%   (0/1)0%   (0/9)0%   (0/1)
getHeuristicWeight (): double 0%   (0/1)0%   (0/3)0%   (0/1)
getNumberOfGeneratedCandidates (): int 0%   (0/1)0%   (0/3)0%   (0/1)
improves (Dimension, EvaluationAspect): boolean 0%   (0/1)0%   (0/61)0%   (0/9)
increaseCounterOfGeneratedCandidates (): void 0%   (0/1)0%   (0/7)0%   (0/2)
setHeuristicWeight (double): void 0%   (0/1)0%   (0/4)0%   (0/2)

1package de.uka.ipd.sdq.dsexplore.opt4j.optimizer.heuristic.operators;
2 
3import java.util.ArrayList;
4import java.util.List;
5 
6import org.opt4j.core.problem.Genotype;
7import org.opt4j.operator.copy.Copy;
8 
9import de.uka.ipd.sdq.dsexplore.launch.DSEWorkflowConfiguration;
10import de.uka.ipd.sdq.dsexplore.opt4j.representation.DSEIndividualBuilder;
11import de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.EvaluationAspect;
12import de.uka.ipd.sdq.dsexplore.qml.contracttype.QMLContractType.Dimension;
13import de.uka.ipd.sdq.dsexplore.qml.reader.QMLDimensionReader;
14 
15public abstract class AbstractTactic implements ITactic {
16        /**
17         * Weight of this heuristics. Used for randomly select a candidate
18         * out of a set of candidates
19         */
20        private double heuristicWeight;
21        private int numberOfGeneratedCandidates = 0;
22        /**
23         * Creates copy of genotypes
24         */
25        protected final Copy<Genotype> copy;
26        
27        /**
28         * Builds individual
29         */
30        protected final DSEIndividualBuilder individualBuilder;
31        
32        /**
33         * The paths of the QML dimension definition. These dimension are improved by applying this tactic
34         * May be empty.
35         */
36        private String[] improvesDimensionPath;
37 
38        /**
39         * cache id
40         */
41        private List<String> dimensionIdList = null;
42        
43        /**
44         * @param copy Creates copy of genotypes
45         * @param individualBuilder Builds individual
46         */
47        public AbstractTactic(Copy<Genotype> copy,
48                        DSEIndividualBuilder individualBuilder, DSEWorkflowConfiguration configuration,
49                        String[] strings) {
50                this.copy = copy;
51                this.individualBuilder = individualBuilder;
52                this.improvesDimensionPath = strings;
53        }
54 
55        final protected void increaseCounterOfGeneratedCandidates() {
56                numberOfGeneratedCandidates++;
57        }
58        
59        /**
60         * @return Weight used for selecting candidate out of a set of candidates
61         */
62        final public double getHeuristicWeight() {
63                return heuristicWeight;
64        }
65        
66        final protected void setHeuristicWeight(double weight) {
67                heuristicWeight = weight;
68        }
69        
70        /**
71         * @return Number of candidates generated by this heuristic
72         */
73        final public int getNumberOfGeneratedCandidates() {
74                return numberOfGeneratedCandidates;
75        }
76        
77        @Override
78        public final boolean improves(Dimension dimension, EvaluationAspect aspect) {
79                
80                // initialise dimension id list if necessary
81                if(dimensionIdList == null) {
82                        dimensionIdList = new ArrayList<String>(this.improvesDimensionPath.length);
83                        for (String dimensionPath : this.improvesDimensionPath) {
84                                String dimensionId = new QMLDimensionReader().getDimension(dimensionPath).getId();
85                                dimensionIdList.add(dimensionId);
86                        }
87                         
88                }
89                
90                for (String dimensionId : this.dimensionIdList) {
91                        // return true if any of this tactics improved dimensions matches 
92                        if (dimension.getId().equals(dimensionId))
93                                return true;
94                }
95                
96                //if no dimension matches, return false
97                return false;
98        }
99        
100        @Override
101        public boolean doesNotImprove(Dimension dimension, EvaluationAspect aspect) {
102                return !improves(dimension, aspect);
103        }
104 
105}

[all classes][de.uka.ipd.sdq.dsexplore.opt4j.optimizer.heuristic.operators]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov