ECF 1.5
NQueensEvalOp.h
1#ifndef NQueensEvalOp_h
2#define NQueensEvalOp_h
3
4#include "../API/Problem.h"
5#include "nqueens.h"
6
7
8class NQueensMove : public Move
9{
10public:
11 struct move* v;
12 NQueensMove() {}
13 NQueensMove(struct move* _v)
14 { v = _v; }
15};
16
17
18class NQueensPath : public Path
19{
20public:
21 struct pathState* ps;
22 NQueensPath() {}
23 NQueensPath(struct pathState* _ps)
24 { ps = _ps; }
25};
26
27
28class NQueensEvalOp : public Problem
29{
30public:
31 StateP state_;
32
33 // ECF methods
34 bool initialize(StateP);
35 FitnessP evaluate(IndividualP individual);
36
37 // API methods
38 MoveP randomMove(IndividualP);
39 bool applyMove(IndividualP&, MoveP);
40 PathP initPathTo(IndividualP, IndividualP);
41 int getPathLength(PathP);
42 MoveP nextRandomMove(PathP);
43
44 // reusable objects from the original code
45 struct problem* problemInstance;
46 struct solution *solutionInstance, *solutionInstance2;
47 struct move* moveInstance;
48 struct pathState* psInstance;
49 void populateSolutionInstance(IndividualP, struct solution*);
50 void readSolutionInstance(IndividualP, struct solution*);
51
52};
53typedef boost::shared_ptr<NQueensEvalOp> NQueensEvalOpP;
54
55#endif NQueensEvalOp_h
Definition: Problem.h:9
FitnessP evaluate(IndividualP individual)
Evaluate a single individual. Method must create and return a Fitness object.
bool initialize(StateP)
Initialize the evaluator. Called before first evaluation occurs.
Definition: Problem.h:17
Definition: flowshop.h:78