00001 #ifndef EtII_EVALUATOR_HPP_
00002 #define EtII_EVALUATOR_HPP_
00003
00004
00005 #include <stdlib.h>
00006 #include <math.h>
00007
00008 #include "../../../OptFrame/Evaluation.hpp"
00009 #include "../../../OptFrame/Evaluator.hpp"
00010
00011 #include "Representation.h"
00012 #include "Memory.h"
00013 #include "Solution.h"
00014 #include "Evaluation.h"
00015
00016 #include "ProblemInstance.hpp"
00017
00018 #define EPSILON_EtII 0.0001
00019
00020 int numEvs = 0;
00021
00022 class EtIIEvaluator: public Evaluator<RepEtII, MemEtII>
00023 {
00024 private:
00025 EtIIProblemInstance& pEtII;
00026
00027 public:
00028
00029 using Evaluator<RepEtII, MemEtII>::evaluate;
00030
00031 EtIIEvaluator(EtIIProblemInstance& _pEtII) :
00032 pEtII(_pEtII)
00033 {
00034
00035 }
00036
00037 EvaluationEtII& evaluate(const RepEtII& rep)
00038 {
00039
00040 numEvs++;
00041
00042
00043 int fo = 0;
00044
00045
00046 for (int i = 0; i < rep.getRows(); i++)
00047 for (int j = 0; j < rep.getCols() - 1; j++)
00048 if (rep(i, j).right == rep(i, j + 1).left)
00049 fo++;
00050
00051
00052 for (int j = 0; j < rep.getCols(); j++)
00053 for (int i = 0; i < rep.getRows() - 1; i++)
00054 if (rep(i, j).down == rep(i + 1, j).up)
00055 fo++;
00056
00057 int& mem = *new int;
00058 mem = 0;
00059
00060 return *new EvaluationEtII(fo, mem);
00061 }
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071 virtual bool betterThan(double a, double b)
00072 {
00073
00074 return (a > (b + EPSILON_EtII));
00075 }
00076
00077 };
00078
00079 #endif
00080