Last change
on this file since 975 was
193,
checked in by Maciej Komosinski, 10 years ago
|
Set svn:eol-style native for all textual files
|
-
Property svn:eol-style set to
native
|
File size:
1.2 KB
|
Line | |
---|
1 | package framsticks; |
---|
2 | |
---|
3 | import ec.EvolutionState; |
---|
4 | import ec.Individual; |
---|
5 | import ec.Problem; |
---|
6 | import ec.simple.SimpleProblemForm; |
---|
7 | import ec.simple.SimpleFitness; |
---|
8 | |
---|
9 | public class FramsticksEvolutionProblem extends Problem implements SimpleProblemForm { |
---|
10 | |
---|
11 | public void evaluate(EvolutionState state, Individual ind, int subpopulation, int threadnum) { |
---|
12 | if (ind.evaluated) { |
---|
13 | return; |
---|
14 | } |
---|
15 | |
---|
16 | if (!(ind instanceof FramsticksIndividual)) { |
---|
17 | state.output.fatal("The individuals for this problem should be FramsticksIndividuals."); |
---|
18 | } |
---|
19 | |
---|
20 | FramsticksIndividual framstickIndividual = (FramsticksIndividual) ind; |
---|
21 | if (!(framstickIndividual.fitness instanceof SimpleFitness)) { |
---|
22 | state.output.fatal("The fitness for this problem should be SimpleFitness"); |
---|
23 | } |
---|
24 | |
---|
25 | String fileName = "ind_subpop" + subpopulation + "_thread" + threadnum + ".gen"; |
---|
26 | FramsticksUtils utils = FramsticksUtils.getInstance(state); |
---|
27 | float fitness = utils.evaluateGenotype(framstickIndividual.genotype, fileName); |
---|
28 | |
---|
29 | ((SimpleFitness) framstickIndividual.fitness).setFitness(state, fitness, false); |
---|
30 | framstickIndividual.evaluated = true; |
---|
31 | } |
---|
32 | |
---|
33 | public void describe(Individual ind, EvolutionState state, int subpopulation, int threadnum, |
---|
34 | int log, int verbosity) { |
---|
35 | // TODO Auto-generated method stub |
---|
36 | |
---|
37 | } |
---|
38 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.