OptimizationRunner.hpp
Go to the documentation of this file.
1 
18 #pragma once
19 
20 #include <boost/filesystem/path.hpp>
21 #include <boost/date_time/posix_time/posix_time.hpp>
22 
23 #include "Tree.hpp"
24 #include "Evaluator.hpp"
25 #include "TreeValidator.hpp"
26 #include "ObjectRelation.hpp"
28 #include "TopologyGenerator.hpp"
29 #include "Topology.hpp"
30 #include "TopologyManager.hpp"
31 
32 #include "../combinatorial_optimization/OptimizationAlgorithm.hpp"
33 #include "../combinatorial_optimization/CostFunction.hpp"
34 
35 #include "utility/LogHelper.hpp"
37 
38 #include <ctime>
39 #include <random>
40 
41 namespace ISM {
42 
43 using boost::posix_time::ptime;
44 using boost::posix_time::time_duration;
45 
47 {
48  public:
49 
51  DocumentationHelperPtr documentationHelper,
52  OptimizationAlgorithmParameters optimizationAlgorithmParameters,
53  CostFunctionParameters costFunctionParameters,
54  bool storeFullyMeshedISM, bool storeStartTopologyISM)
55  : mTopologyManager(topologyManager)
56  , mDocumentationHelper(documentationHelper)
57  , mOptimizationAlgorithmParameters(optimizationAlgorithmParameters)
58  , mCostFunctionParameters(costFunctionParameters)
59  , mStoreFullyMeshedISM(storeFullyMeshedISM)
60  , mStoreStartTopologyISM(storeStartTopologyISM)
61  {}
62 
63  std::pair<double, TreePtr> runOptimization(const std::string& pattern, TopologyPtr startTopology = NULL);
64 
65  private:
66 
71 
74 
75  std::default_random_engine mGenerator;
76  std::uniform_real_distribution<double> mDistribution = std::uniform_real_distribution<double>(0.0, 1.0);
77 
78  std::string mCurrentPatternName;
79  ptime mStartTime;
80 
83 
84  std::vector<TopologyPtr> mStarTopologies;
86 
87  unsigned int mMinFalsePositives;
88  unsigned int mMaxFalsePositives;
89 
92 
93  void prepareOptimizationRun(std::vector<TopologyPtr>& startTopologies);
95  TopologyPtr selectStartTopology(std::vector<TopologyPtr>& startTopologies);
96 
97  void documentOptimzationRun(TopologyPtr bestTopology);
98  void initCostFunction();
100 
101  void logOptimizationStart(const std::string& patternName);
102  void logOptimizationFinish(TopologyPtr bestTopology);
103 
106 
107  void logWeightedSum();
108  void logStartTopologies(const std::vector<TopologyPtr> & startTopologies);
109  void logSelectedStartTopology(TopologyPtr bestStartTopology);
110  void logRandomRestart();
112 
114 
115 }; typedef boost::shared_ptr<OptimizationRunner> OptimizationRunnerPtr;
116 
117 }
118 
119 
120 
void logSelectedStartTopology(TopologyPtr bestStartTopology)
OptimizationAlgorithmPtr< TopologyPtr > mOptimizationAlgorithm
void logStartTopologies(const std::vector< TopologyPtr > &startTopologies)
boost::shared_ptr< CostFunction< InstanceType >> CostFunctionPtr
std::pair< double, TreePtr > runOptimization(const std::string &pattern, TopologyPtr startTopology=NULL)
CostFunctionParameters mCostFunctionParameters
void logOptimizationFinish(TopologyPtr bestTopology)
std::string patternName
void prepareOptimizationRun(std::vector< TopologyPtr > &startTopologies)
boost::shared_ptr< Topology > TopologyPtr
Definition: Topology.hpp:51
TopologyPtr selectStartTopology(std::vector< TopologyPtr > &startTopologies)
OptimizationRunner(TopologyManagerPtr topologyManager, DocumentationHelperPtr documentationHelper, OptimizationAlgorithmParameters optimizationAlgorithmParameters, CostFunctionParameters costFunctionParameters, bool storeFullyMeshedISM, bool storeStartTopologyISM)
static const char * LOG_COLOR_DEFAULT
Definition: LogHelper.hpp:43
boost::shared_ptr< OptimizationAlgorithm< InstanceType >> OptimizationAlgorithmPtr
TopologyManagerPtr mTopologyManager
boost::shared_ptr< DocumentationHelper > DocumentationHelperPtr
boost::shared_ptr< OptimizationRunner > OptimizationRunnerPtr
CostFunctionPtr< TopologyPtr > mCostFunction
DocumentationHelperPtr mDocumentationHelper
void logOptimizationStart(const std::string &patternName)
OptimizationAlgorithmParameters mOptimizationAlgorithmParameters
std::vector< TopologyPtr > mStarTopologies
std::uniform_real_distribution< double > mDistribution
this namespace contains all generally usable classes.
void documentOptimzationRun(TopologyPtr bestTopology)
boost::shared_ptr< TopologyManager > TopologyManagerPtr
std::default_random_engine mGenerator
const char * LOG_COLOR_OPTIMIZATION_STRATEGY


asr_lib_ism
Author(s): Hanselmann Fabian, Heller Florian, Heizmann Heinrich, Kübler Marcel, Mehlhaus Jonas, Meißner Pascal, Qattan Mohamad, Reckling Reno, Stroh Daniel
autogenerated on Wed Jan 8 2020 04:02:40