00001 00020 #ifndef _ILOCALSEARCH_H 00021 00022 #define _ILOCALSEARCH_H 1 00023 00024 #include "problem.h" 00025 #include "running.h" 00026 #include "populationreal.h" 00027 #include "random.h" 00028 00029 namespace realea { 00030 00039 class ILSParameters { 00040 public: 00041 virtual ~ILSParameters(void){} 00042 }; 00043 00052 class ILocalSearch { 00053 public: 00060 virtual ILSParameters *getInitOptions(tChromosomeReal &sol)=0; 00061 00074 virtual unsigned apply(ILSParameters *params, tChromosomeReal &sol, tFitness &fitness, unsigned nstep)=0; 00075 00081 void setPopulation(PopulationReal *pop) { 00082 m_pop = pop; 00083 } 00084 00090 void setRunning(RunningPtr run) { 00091 m_running = run; 00092 } 00093 00099 void setProblem(Problem *problem) { 00100 m_problem = problem; 00101 } 00102 00108 void setRandom(Random *random) { 00109 m_random = random; 00110 } 00111 00112 void setEval(IEval *eval) { 00113 m_eval = eval; 00114 } 00115 00116 virtual ~ILocalSearch(void) {} 00117 00118 00119 protected: 00120 Random *m_random; 00121 IEval *m_eval; 00122 Problem *m_problem; 00123 PopulationReal *m_pop; 00124 RunningPtr m_running; 00125 }; 00126 00130 class IParallelLocalSearch : public ILocalSearch { 00131 public: 00138 virtual ILSParameters *recoverOptions(tGen *params, unsigned size)=0; 00139 00149 virtual void storeOptions(ILSParameters *params, tGen **paparams, unsigned *psize)=0; 00150 }; 00151 00152 00153 } 00154 00155 #endif