ECF 1.5
FitnessMax.cpp
1#include "ECF_base.h"
2#include "FitnessMax.h"
3#include<sstream>
4
5
6bool FitnessMax::isBetterThan(FitnessP other)
7{
8 return value_ > other->getValue();
9}
10
11
13{
14 FitnessMax *newObject = new FitnessMax(*this);
15 return newObject;
16}
17
18
19void FitnessMax::write(XMLNode &xFitness)
20{
21 xFitness = XMLNode::createXMLTopNode("FitnessMax");
22 std::stringstream sValue;
23 sValue << value_;
24 xFitness.addAttribute("value", sValue.str().c_str());
25}
double value_
actual fitness value
Definition: Fitness.h:19
Fitness for maximization problems.
Definition: FitnessMax.h:13
bool isBetterThan(FitnessP other)
Mandatory comparison operator.
Definition: FitnessMax.cpp:6
FitnessMax * copy()
object copy (for duplication of an individual)
Definition: FitnessMax.cpp:12
void write(XMLNode &)
Write fitness object to XMLNode.
Definition: FitnessMax.cpp:19