00001 //---------------------------------------------------------------------------- 00002 /** @file SgSearch.cpp 00003 See SgSearch.h. 00004 */ 00005 //---------------------------------------------------------------------------- 00006 00007 #include "SgSystem.h" 00008 #include "SgSearchControl.h" 00009 00010 //---------------------------------------------------------------------------- 00011 00012 SgSearchControl::~SgSearchControl() 00013 { 00014 } 00015 00016 bool SgSearchControl::StartNextIteration(int depth, double elapsedTime, 00017 int numNodes) 00018 { 00019 SG_UNUSED(depth); 00020 SG_UNUSED(elapsedTime); 00021 SG_UNUSED(numNodes); 00022 return true; 00023 } 00024 00025 //---------------------------------------------------------------------------- 00026 00027 SgTimeSearchControl::SgTimeSearchControl(double maxTime) 00028 : m_maxTime(maxTime) 00029 { 00030 } 00031 00032 SgTimeSearchControl::~SgTimeSearchControl() 00033 { 00034 } 00035 00036 bool SgTimeSearchControl::Abort(double elapsedTime, int ignoreNumNodes) 00037 { 00038 SG_UNUSED(ignoreNumNodes); 00039 return elapsedTime >= m_maxTime; 00040 } 00041 00042 //---------------------------------------------------------------------------- 00043 00044 SgNodeSearchControl::SgNodeSearchControl(int maxNumNodes) 00045 : m_maxNumNodes(maxNumNodes) 00046 { } 00047 00048 SgNodeSearchControl::~SgNodeSearchControl() 00049 { 00050 } 00051 00052 bool SgNodeSearchControl::Abort(double ignoreElapsedTime, int numNodes) 00053 { 00054 SG_UNUSED(ignoreElapsedTime); 00055 return numNodes >= m_maxNumNodes; 00056 } 00057 00058 //---------------------------------------------------------------------------- 00059 00060 SgCombinedSearchControl::~SgCombinedSearchControl() 00061 { 00062 } 00063 00064 bool SgCombinedSearchControl::Abort(double elapsedTime, int numNodes) 00065 { 00066 return (numNodes >= m_maxNumNodes || elapsedTime >= m_maxTime); 00067 } 00068 00069 //---------------------------------------------------------------------------- 00070 00071 SgRelaxedSearchControl::~SgRelaxedSearchControl() 00072 { 00073 } 00074 00075 bool SgRelaxedSearchControl::Abort(double elapsedTime, int numNodes) 00076 { 00077 return (elapsedTime >= m_maxTime 00078 && numNodes >= MIN_NODES_PER_SECOND * m_maxTime); 00079 } 00080 00081 //---------------------------------------------------------------------------- 00082