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