00001 #ifndef OPENTISSUE_CORE_MATH_OPTIMIZATION_CONSTANTS_H 00002 #define OPENTISSUE_CORE_MATH_OPTIMIZATION_CONSTANTS_H 00003 // 00004 // OpenTissue Template Library 00005 // - A generic toolbox for physics-based modeling and simulation. 00006 // Copyright (C) 2008 Department of Computer Science, University of Copenhagen. 00007 // 00008 // OTTL is licensed under zlib: http://opensource.org/licenses/zlib-license.php 00009 // 00010 #include <OpenTissue/configuration.h> 00011 00012 #include <string> 00013 00014 namespace OpenTissue 00015 { 00016 namespace math 00017 { 00018 namespace optimization 00019 { 00020 00035 size_t const OK = 0; 00036 00042 size_t const NON_DESCENT_DIRECTION = 1; 00043 00050 size_t const BACKTRACKING_FAILED = 2; 00051 00060 size_t const STAGNATION = 3; 00061 00072 size_t const RELATIVE_CONVERGENCE = 4; 00073 00088 size_t const ABSOLUTE_CONVERGENCE = 5; 00089 00100 size_t const ITERATING = 6; 00101 00102 00103 00115 size_t const DESCEND_DIRECTION_IN_NORMAL_CONE = 7; 00116 00117 00118 00130 inline std::string get_error_message(size_t const & error_code) 00131 { 00132 std::string msg; 00133 switch(error_code) 00134 { 00135 case OK: msg = "no error"; break; 00136 case NON_DESCENT_DIRECTION: msg = "Non descent direction was encountered"; break; 00137 case BACKTRACKING_FAILED: msg = "Back-tracking failure during line-search"; break; 00138 case STAGNATION: msg = "Stagnation test passed"; break; 00139 case RELATIVE_CONVERGENCE: msg = "Relative convergence test passed"; break; 00140 case ABSOLUTE_CONVERGENCE: msg = "Absolute convergence test passed"; break; 00141 case ITERATING: msg = "Halted while iterating or did not converge with maximum number of iterations"; break; 00142 case DESCEND_DIRECTION_IN_NORMAL_CONE: msg = "Descend Direction is in Normal Cone"; break; 00143 default: msg = "unrecognised error"; break; 00144 }; 00145 return msg; 00146 } 00147 00148 00149 00150 00151 00152 00153 00166 size_t const IN_LOWER = 1; 00167 00180 size_t const IN_UPPER = 2; 00181 00194 size_t const IN_ACTIVE = 4; 00195 00196 00197 } // namespace optimization 00198 } // namespace math 00199 } // namespace OpenTissue 00200 00201 // OPENTISSUE_CORE_MATH_OPTIMIZATION_CONSTANTS_H 00202 #endif