Free cookie consent management tool by TermsFeed Policy Generator

source: branches/OKBJavaConnector/ECJClient/src/ec/app/gui/SimpleBarChartStatistics.java @ 12147

Last change on this file since 12147 was 6152, checked in by bfarka, 14 years ago

added ecj and custom statistics to communicate with the okb services #1441

File size: 1.7 KB
Line 
1/*
2  Copyright 2006 by Sean Luke
3  Licensed under the Academic Free License version 3.0
4  See the file "LICENSE" for more information
5*/
6
7
8/*
9 * Created on Apr 16, 2005 12:36:14 PM
10 *
11 * By: spaus, Hovden
12 */
13package ec.app.gui;
14
15import ec.display.chart.*;
16import ec.EvolutionState;
17import ec.Fitness;
18import ec.util.Parameter;
19import ec.vector.*;
20
21/**
22 * @author spaus
23 */
24public class SimpleBarChartStatistics extends BarChartStatistics
25    { //Hovden
26
27    private int[] seriesID;
28   
29    public void setup(EvolutionState state, Parameter base) {
30        super.setup(state, base);
31        int numSubPops = state.parameters.getInt(new Parameter("pop.subpops"),null);
32       
33        seriesID = new int[numSubPops];
34       
35        for (int i = 0; i < numSubPops; ++i) {
36            seriesID[i] = i; //series id identifies each sub pop
37            }
38        }
39   
40    public void postEvaluationStatistics(EvolutionState state) {
41        super.postEvaluationStatistics(state);
42       
43        for (int subPop = 0; subPop < state.population.subpops.length; ++subPop) {
44            Fitness bestFit = state.population.subpops[subPop].individuals[0].fitness;
45            for (int i = 1; i < state.population.subpops[subPop].individuals.length; ++i) {
46                Fitness fit = state.population.subpops[subPop].individuals[i].fitness;
47                if (fit.betterThan(bestFit))
48                    bestFit = fit;
49               
50                //Best individual is found, make a bar graph
51                makeBar(seriesID[subPop], ((DoubleVectorIndividual)state.population.subpops[subPop].individuals[i]).genome);
52                }
53            }
54        }
55    }
Note: See TracBrowser for help on using the repository browser.