#pragma once #include #include #include #include #include #include "dubins_types.h" #include "ksolution.h" #include "som_dubins.h" using namespace som; namespace opendubins { namespace solver { class KMemetic : public imr::CAlgorithm { typedef imr::CAlgorithm Base; public: typedef imr::loader::CTextFormatLoader Loader; static imr::CConfig &getConfig(imr::CConfig &config); static std::string getName(void) { return "kmemetic"; } //dsom - dubins som KMemetic(imr::CConfig &config, const std::string& filename); ~KMemetic(); std::string getRevision(void); std::string getMethod(void) { return getName(); } std::string getVersion(void); void solve(void); void setTimers(const imr::CTimerN &load, const imr::CTimerN &init); KSolution getSolution(som::CSOMDubins::SRing** rings, const std::vector& bestSolution); protected: //# methods from CAlgorithm void load(void); void initialize(void); void after_init(void); void iterate(int iter); void save(void); void release(void); void defineResultLog(void); private: void drawPath(void); void drawPathSOM(void); void savePic(int step, const std::string &dir_suffix); void fillResultRecord(int iter, int individual, int generation, double length); void load_goals_coords(const std::string& filename); /// ---------------------------------------------------------------------------- /// Variables /// ---------------------------------------------------------------------------- protected: const bool SAVE_INFO; const bool SAVE_SETTINGS; const bool NO_DEPOT_NEIGHBORHOOD; public: const int VEHICLES; protected: imr::CTimerN loadTimer; imr::CTimerN initTimer; bool save_pic; double maxTime; double mutatePst; int popSize; int tournamentSize; public: std::vector pts; std::vector> targets; double radius; double target_radius; std::vector depots; opendubins::solver::KSolution solution; som::CSOMDubins neuroner; }; } }