ECF 1.5
fitnes.hpp
1#ifndef SchedulingEvalOp_h
2#define SchedulingEvalOp_h
3
4#include <string>
5#include <vector>
6#include "readpar.h"
7#include "matrice.h"
8#include "rpn.h"
9#include "IntGenotype.h"
10
11
13{
14public:
16 FitnessP evaluate(IndividualP individual);
17 void registerParameters(StateP);
18 bool initialize(StateP);
20
21 StateP state_;
22
23 unsigned int edited,total,nItems;
25 void write(std::string &output);
26 void ReadTerminals(TreeP);
27 void ReadTerminals(StateP);
28 void DefineNodeNames(void);
29 void ReadConstraints(Matrica &Constraints, int set, int jobs, Matrica &Precedence);
30 void MakeSetup(Matrica &Duration, int set, int jobs, double faktor, Matrica &Setup);
31 double NodeLevel(int set, int node);
32 //void StartTerminalStatistic(Beagle::GP::Context& ioContext, double dSubsetSize=0);
33 //void GetTerminalStatistic(double *pValues);
34 //void UpdateTerminalStatistic(double &dFitness);
35 void ReadIndividual(IndividualP individual);
36 void CalcTimedTerminals(uint &nNiz, uint &nPoslova, uint &nJob, double &dClock, uint nMachine=0, uint nMachines=1);
37 void EvaluateSingle(double &dRawFitness);
38 void EvaluateUniform(double &dRawFitness);
39 void EvaluateUnrelated(double &dRawFitness);
40 void EvaluateUnrelatedPermutation(IndividualP individual, double &dRawFitness);
41 void EvaluateUnrelatedFP(FloatingPointP fp, double &dRawFitness);
42 void EvaluateJobShop(double &dRawFitness);
43 int Before(const void *arg1, const void *arg2);
44 std::string in_file;
45
46protected:
47
48enum environment
49{ SINGLE,
50 UNIFORM,
51 UNRELATED,
52 JOBSHOP
53};
54
55 unsigned int sets,max_jobs,total_jobs,max_machines,max_length;
56 unsigned int m_fitness; // koja fitnes funkcija? definicije u nodes.h
57 std::string m_genotip; // koji genotip ("FP", "GP")
58 unsigned int m_primjer; // koji ispitni primjer (iz fitness.txt)
59 unsigned int m_BestSubset; // koliko najboljih jedinki gledamo za statistiku terminala
60 unsigned int m_SubsetSize; // vlastita proracunata velicina (default vrijednost)
61 unsigned int m_InSubset; // koliko ih trenutno ima u matrici
62 unsigned int m_WorstInSubset; // koji je najlosiji
63 double m_WorstSubsetFitness; // fitnes najlosije jedinke u podskupu najboljih
64 double m_BestSubsetFitness; // treba li komentar?
65 environment m_Environment; // okruzenje: single, uniform, unrelated, job shop
66 unsigned int m_SortSet; // oznaka skupa za potrebe qsort-a
67 unsigned int m_PopSize; // ukupna velicina populacije
68
69 bool m_Normalized; // je li fitnes normiran brojem i trajanjem poslova
70 bool m_Evaluation; // pisanje rezultata za svaki skup u datoteku
71 bool m_TermUsage; // prikupljanje statistike koristenja terminala
72 bool m_editing; // editiranje?
73 bool m_LEF; // limited error fitness (1 ili 0)
74 double m_LEFVal; // vrijednost za LEF
75 bool m_setup; // postoje li trajanja postavljanja izmedyu poslova
76 double m_setup_faktor; // prosjecni odnos izmedju trajanja postavljanja i trajanja posla
77 bool m_dynamic; // dinamicka okolina?
78 bool m_constrained; // ogranicenja u rasporedu?
79 bool m_stsampling; // stochastic sampling?
80 double m_sampling; // koliki postotak test skupova se uzima
81 bool *pSamples; // koji tocno skupovi idu
82 bool m_Idleness; // uzimamo li u obzir i cekanje operacija (job shop)
83 bool *pRasporedjen;
84 double *pVrijednosti, *pArray, *pSlack, *pSlackSpeed, *pArrival, *pLevel, *pSetupAvg;
85 double *pOperationReady, *pJobReady, *pTotalWorkRemaining, *pTotalWorkDone, *pTotalMachineWork;
86 double *pMachineWorkRemaining, *pMachineValues;
87 unsigned int *pIndex, *pUsed, *pLastJob, *pPTimeMinMachine, *pMachineScheduled, *pOperationsScheduled;
88 unsigned int *pOperationsWaiting;
89 Matrica N,Duration,Deadline,WeightT,WeightF,WeightE,WeightN, WeightC,Ready,Constraints,Machines,Speed;
90 Matrica SP,SD,Fitness,Schedule,Precedence,Level,Setup,Terminals,MachineReady,PTimeAvg,PTimeMinMachine;
91 Matrica SortedReady, Values, Durations, MachineIndex;
92};
93typedef boost::shared_ptr<SchedulingEvalOp> SchedulingEvalOpP;
94
95#endif // SchedulingEvalOp_h
Evaluation base class.
Definition: EvaluateOp.h:17
Fitness base class.
Definition: Fitness.h:16
Definition: rpn.h:12
bool initialize(StateP)
Initialize the evaluator. Called before first evaluation occurs.
Definition: fitnes.cpp:165
FitnessP evaluate(IndividualP individual)
Evaluate a single individual. Method must create and return a Fitness object.
Definition: fitnes.cpp:571
void registerParameters(StateP)
Register evaluator parameters. Called before EvaluateOp::initialize method.
Definition: fitnes.cpp:154
Definition: nodes.h:92