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 | */
|
---|
13 | package ec.app.gui;
|
---|
14 |
|
---|
15 | import ec.display.chart.*;
|
---|
16 | import ec.EvolutionState;
|
---|
17 | import ec.Fitness;
|
---|
18 | import ec.util.Parameter;
|
---|
19 | import ec.vector.*;
|
---|
20 |
|
---|
21 | /**
|
---|
22 | * @author spaus
|
---|
23 | */
|
---|
24 | public 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.