EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.tcfmoop.terminationcriteria]

COVERAGE SUMMARY FOR SOURCE FILE [MaxGenerationNumber.java]

nameclass, %method, %block, %line, %
MaxGenerationNumber.java0%   (0/1)0%   (0/4)0%   (0/93)0%   (0/18)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class MaxGenerationNumber0%   (0/1)0%   (0/4)0%   (0/93)0%   (0/18)
MaxGenerationNumber (IConfiguration, Population, Archive): void 0%   (0/1)0%   (0/25)0%   (0/6)
evaluateImpl (int, long): void 0%   (0/1)0%   (0/16)0%   (0/5)
initializeOutputTree (): void 0%   (0/1)0%   (0/35)0%   (0/5)
updateOutputInformation (): void 0%   (0/1)0%   (0/17)0%   (0/2)

1package de.uka.ipd.sdq.tcfmoop.terminationcriteria;
2 
3import org.opt4j.core.Archive;
4import org.opt4j.core.Population;
5 
6import de.uka.ipd.sdq.tcfmoop.config.IConfiguration;
7import de.uka.ipd.sdq.tcfmoop.config.MaxGenerationNumberConfig;
8import de.uka.ipd.sdq.tcfmoop.outputtree.Node;
9import de.uka.ipd.sdq.tcfmoop.outputtree.Node.NodeType;
10 
11public class MaxGenerationNumber extends AbstractTerminationCriterion {
12 
13        //The maximum number of iterations that the optimization algorithm should execute.
14        private int maximumNumberOfGenerations;
15        //Executed iterations so far.
16        private int generationsSoFar;
17        
18        //OutputNodes
19        //dynamic
20        private Node currentMaxGenNode;
21        
22        public MaxGenerationNumber(IConfiguration conf, Population population, Archive archive) {
23                super(conf, population, archive);
24                if((conf instanceof MaxGenerationNumberConfig) && conf.validateConfiguration()){
25                        this.maximumNumberOfGenerations = ((MaxGenerationNumberConfig)(conf)).getMaximumNumberOfIterations();
26                }else{
27                        throw new RuntimeException("MaxGenerationNumber.initialize: " +
28                        "wrong or invalid configuration object");
29                }
30                initializeOutputTree();
31        }
32        
33        private void initializeOutputTree(){
34                this.outputInformation.updateValue("Maximum Number of Generations");
35                this.outputInformation.getChildren().clear();
36                this.currentMaxGenNode = this.outputInformation.addChild("Current/Maximum: " + this.generationsSoFar + "/" + this.maximumNumberOfGenerations, NodeType.PARAMETER);
37                this.outputInformation.getChildren().add(this.suggestedStop);
38        }
39        
40        /**
41         * {@inheritDoc}
42         * Implements the Maximum Number of Generation Criterion. If the number of the evaluated iterations
43         * reaches the supplied limit, the criterion suggest that the optimization should be stopped.
44         */
45        @Override
46        public void evaluateImpl(int iteration, long currentTime) {
47                generationsSoFar = iteration;
48                if(generationsSoFar >= maximumNumberOfGenerations){
49                        this.evaluationResult = true;
50                }else{
51                        this.evaluationResult = false;
52                }
53        }
54        
55        /**
56         * {@inheritDoc}
57         */
58        @Override
59        public void updateOutputInformation(){
60                this.currentMaxGenNode.updateValue("Current/Maximum Generation Number: " + this.generationsSoFar + "/" + this.maximumNumberOfGenerations);
61        }
62}

[all classes][de.uka.ipd.sdq.tcfmoop.terminationcriteria]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov