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.2 KB
|
Line | |
---|
1 | package ec.app.coevolve2; |
---|
2 | |
---|
3 | import ec.*; |
---|
4 | import ec.coevolve.*; |
---|
5 | import ec.vector.DoubleVectorIndividual; |
---|
6 | import ec.simple.SimpleFitness; |
---|
7 | |
---|
8 | /** This class exists solely to print out the DoubleVectorIndividual and its collaborators in |
---|
9 | a nice way for statistics purposes. */ |
---|
10 | |
---|
11 | public class CoevolutionaryDoubleVectorIndividual extends DoubleVectorIndividual |
---|
12 | { |
---|
13 | public CoevolutionaryDoubleVectorIndividual[] context; |
---|
14 | boolean dontPrintContext = false; |
---|
15 | |
---|
16 | public void printIndividualForHumans(EvolutionState state, int log) |
---|
17 | { |
---|
18 | super.printIndividualForHumans(state, log); |
---|
19 | if (!dontPrintContext && context != null) |
---|
20 | { |
---|
21 | for(int i = 0; i < context.length; i++) |
---|
22 | if (context[i] != null) |
---|
23 | { |
---|
24 | state.output.println("--Collaborator " + i + ":", log); |
---|
25 | // this is a hack but it should be fine because printing |
---|
26 | // individuals for humans is essentially always single-threaded |
---|
27 | context[i].dontPrintContext = true; |
---|
28 | context[i].printIndividualForHumans(state, log); |
---|
29 | context[i].dontPrintContext = false; |
---|
30 | } |
---|
31 | } |
---|
32 | } |
---|
33 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.