ECF 1.5
KnapsackEvalop.h
1#ifndef KnapsackEvalOp_h
2#define KnapsackEvalOp_h
3
4#include "../API/Problem.h"
5
6
7class KnapsackMove : public Move
8{
9public:
10 int data;
11};
12
13
14class KnapsackPath : public Path
15{
16public:
17 std::vector<int> pos; /* indices of the bits in which the solutions differ */
18 int n;
19 int distance;
20};
21
22
23class KnapsackEvalOp : public Problem
24{
25public:
26 StateP state_;
27
28 // ECF methods
29 void registerParameters(StateP);
30 bool initialize(StateP);
31 FitnessP evaluate(IndividualP individual);
32
33 // API methods
34 MoveP randomMove(IndividualP);
35 bool applyMove(IndividualP&, MoveP);
36 PathP initPathTo(IndividualP, IndividualP);
37 int getPathLength(PathP);
38 MoveP nextRandomMove(PathP);
39
40 struct problem* problemInstance;
41 struct solution* solutionInstance;
42
43};
44typedef boost::shared_ptr<KnapsackEvalOp> KnapsackEvalOpP;
45
46#endif KnapsackEvalOp_h
void registerParameters(StateP)
Register evaluator parameters. Called before EvaluateOp::initialize method.
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:9
Definition: Problem.h:17