Last change
on this file since 9449 was
6152,
checked in by bfarka, 14 years ago
|
added ecj and custom statistics to communicate with the okb services #1441
|
File size:
1.5 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
|
---|
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 |
|
---|
20 | /**
|
---|
21 | * @author spaus
|
---|
22 | */
|
---|
23 | public class SimpleXYSeriesChartStatistics
|
---|
24 | extends XYSeriesChartStatistics {
|
---|
25 |
|
---|
26 | private int[] seriesID;
|
---|
27 |
|
---|
28 | public void setup(EvolutionState state, Parameter base) {
|
---|
29 | super.setup(state, base);
|
---|
30 | int numSubPops = state.parameters.getInt(new Parameter("pop.subpops"),null);
|
---|
31 | seriesID = new int[numSubPops];
|
---|
32 |
|
---|
33 | for (int i = 0; i < numSubPops; ++i) {
|
---|
34 | seriesID[i] = addSeries("SubPop "+i);
|
---|
35 | }
|
---|
36 | }
|
---|
37 |
|
---|
38 | public void postEvaluationStatistics(EvolutionState state) {
|
---|
39 | super.postEvaluationStatistics(state);
|
---|
40 |
|
---|
41 | for (int subPop = 0; subPop < state.population.subpops.length; ++subPop) {
|
---|
42 | Fitness bestFit = state.population.subpops[subPop].individuals[0].fitness;
|
---|
43 | for (int i = 1; i < state.population.subpops[subPop].individuals.length; ++i) {
|
---|
44 | Fitness fit = state.population.subpops[subPop].individuals[i].fitness;
|
---|
45 | if (fit.betterThan(bestFit))
|
---|
46 | bestFit = fit;
|
---|
47 | }
|
---|
48 |
|
---|
49 | addDataPoint(seriesID[subPop], state.generation, bestFit.fitness());
|
---|
50 | }
|
---|
51 | }
|
---|
52 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.