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