Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef SG_SEARCHCONTROL_H
00011 #define SG_SEARCHCONTROL_H
00012
00013
00014
00015
00016 class SgSearchControl
00017 {
00018 public:
00019 SgSearchControl();
00020
00021 virtual ~SgSearchControl();
00022
00023
00024
00025 virtual bool Abort(double elapsedTime, int numNodes) = 0;
00026
00027
00028
00029
00030
00031
00032
00033 virtual bool StartNextIteration(int depth, double elapsedTime,
00034 int numNodes);
00035
00036 private:
00037
00038 SgSearchControl(const SgSearchControl&);
00039
00040
00041 SgSearchControl& operator=(const SgSearchControl&);
00042 };
00043
00044 inline SgSearchControl::SgSearchControl()
00045 {
00046 }
00047
00048
00049
00050
00051 class SgTimeSearchControl
00052 : public SgSearchControl
00053 {
00054 public:
00055 SgTimeSearchControl(double maxTime);
00056
00057 virtual ~SgTimeSearchControl();
00058
00059 virtual bool Abort(double elapsedTime, int ignoreNumNodes);
00060
00061 double GetMaxTime() const;
00062
00063 void SetMaxTime(double maxTime);
00064
00065 private:
00066 double m_maxTime;
00067
00068
00069 SgTimeSearchControl(const SgTimeSearchControl&);
00070
00071
00072 SgTimeSearchControl& operator=(const SgTimeSearchControl&);
00073 };
00074
00075 inline double SgTimeSearchControl::GetMaxTime() const
00076 {
00077 return m_maxTime;
00078 }
00079
00080 inline void SgTimeSearchControl::SetMaxTime(double maxTime)
00081 {
00082 m_maxTime = maxTime;
00083 }
00084
00085
00086
00087
00088
00089 class SgNodeSearchControl
00090 : public SgSearchControl
00091 {
00092 public:
00093 SgNodeSearchControl(int maxNumNodes);
00094
00095 virtual ~SgNodeSearchControl();
00096
00097 virtual bool Abort(double ignoreElapsedTime, int numNodes);
00098
00099 void SetMaxNumNodes(int maxNumNodes);
00100
00101 private:
00102 int m_maxNumNodes;
00103
00104
00105 SgNodeSearchControl(const SgNodeSearchControl&);
00106
00107
00108 SgNodeSearchControl& operator=(const SgNodeSearchControl&);
00109 };
00110
00111 inline void SgNodeSearchControl::SetMaxNumNodes(int maxNumNodes)
00112 {
00113 m_maxNumNodes = maxNumNodes;
00114 }
00115
00116
00117
00118
00119 class SgCombinedSearchControl
00120 : public SgSearchControl
00121 {
00122 public:
00123 SgCombinedSearchControl(double maxTime, int maxNumNodes);
00124
00125 virtual ~SgCombinedSearchControl();
00126
00127 virtual bool Abort(double elapsedTime, int numNodes);
00128
00129 private:
00130 double m_maxTime;
00131
00132 int m_maxNumNodes;
00133
00134
00135 SgCombinedSearchControl(const SgCombinedSearchControl&);
00136
00137
00138 SgCombinedSearchControl& operator=(const SgCombinedSearchControl&);
00139 };
00140
00141 inline SgCombinedSearchControl::SgCombinedSearchControl(double maxTime,
00142 int maxNumNodes)
00143 : m_maxTime(maxTime),
00144 m_maxNumNodes(maxNumNodes)
00145 {
00146 }
00147
00148
00149
00150
00151 class SgRelaxedSearchControl
00152 : public SgSearchControl
00153 {
00154 public:
00155 static const int MIN_NODES_PER_SECOND = 1000;
00156
00157 SgRelaxedSearchControl(double maxTime);
00158
00159 virtual ~SgRelaxedSearchControl();
00160
00161 virtual bool Abort(double elapsedTime, int numNodes);
00162
00163 private:
00164 double m_maxTime;
00165
00166
00167 SgRelaxedSearchControl(const SgRelaxedSearchControl&);
00168
00169
00170 SgRelaxedSearchControl& operator=(const SgRelaxedSearchControl&);
00171 };
00172
00173 inline SgRelaxedSearchControl::SgRelaxedSearchControl(double maxTime)
00174 : m_maxTime(maxTime)
00175 {
00176 }
00177
00178
00179
00180 #endif // SG_SEARCHCONTROL_H