|
MoochoPack : Framework for Large-Scale Optimization Algorithms Version of the Day
|
00001 // @HEADER 00002 // *********************************************************************** 00003 // 00004 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization 00005 // Copyright (2003) Sandia Corporation 00006 // 00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00008 // license for use of this work by or on behalf of the U.S. Government. 00009 // 00010 // This library is free software; you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as 00012 // published by the Free Software Foundation; either version 2.1 of the 00013 // License, or (at your option) any later version. 00014 // 00015 // This library is distributed in the hope that it will be useful, but 00016 // WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 // Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public 00021 // License along with this library; if not, write to the Free Software 00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00023 // USA 00024 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 00025 // 00026 // *********************************************************************** 00027 // @HEADER 00028 00029 #ifndef RSQP_SOLVER_CLIENT_INTERFACE_H 00030 #define RSQP_SOLVER_CLIENT_INTERFACE_H 00031 00032 #include <stdexcept> 00033 00034 #include "MoochoPack_Types.hpp" 00035 #include "NLPInterfacePack_NLP.hpp" 00036 #include "IterationPack_AlgorithmTracker.hpp" 00037 #include "Teuchos_StandardCompositionMacros.hpp" 00038 #include "Teuchos_StandardMemberCompositionMacros.hpp" 00039 00040 namespace MoochoPack { 00041 00046 class NLPSolverClientInterface { 00047 public: 00048 00051 00053 enum EFindMinReturn { 00054 SOLUTION_FOUND 00055 ,MAX_ITER_EXCEEDED 00056 ,MAX_RUN_TIME_EXCEEDED 00057 ,ALGORITHMIC_ERROR 00058 }; 00059 00061 class InvalidSetup : public std::logic_error 00062 {public: InvalidSetup(const std::string& what_arg) : std::logic_error(what_arg) {}}; 00063 00065 00068 00070 STANDARD_MEMBER_COMPOSITION_MEMBERS( int, max_iter ); 00071 00074 STANDARD_MEMBER_COMPOSITION_MEMBERS( double, max_run_time ); 00075 00079 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, opt_tol ); 00080 00084 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, feas_tol ); 00085 00090 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, comp_tol ); 00091 00096 STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, step_tol ); 00097 00100 STANDARD_MEMBER_COMPOSITION_MEMBERS( EJournalOutputLevel, journal_output_level ); 00101 00107 STANDARD_MEMBER_COMPOSITION_MEMBERS( EJournalOutputLevel, null_space_journal_output_level ); 00108 00111 STANDARD_MEMBER_COMPOSITION_MEMBERS( int, journal_print_digits ); 00112 00115 STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, check_results ); 00116 00120 STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, calc_conditioning ); 00121 00124 STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, calc_matrix_norms ); 00125 00129 STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, calc_matrix_info_null_space_only ); 00130 00132 00135 00137 STANDARD_COMPOSITION_MEMBERS( NLP, nlp ); 00138 00140 STANDARD_COMPOSITION_MEMBERS( AlgorithmTracker, track ); 00141 00144 NLPSolverClientInterface( 00145 int max_iter = 10000 00146 ,double max_run_time = 1e+10 // run forever 00147 ,value_type opt_tol = 1e-6 00148 ,value_type feas_tol = 1e-6 00149 ,value_type comp_tol = 1e-6 00150 ,value_type step_tol = 1e-2 00151 ,EJournalOutputLevel journal_output_level = PRINT_ALGORITHM_STEPS 00152 ,EJournalOutputLevel null_space_journal_output_level = PRINT_ALGORITHM_STEPS 00153 ,int journal_print_digits = 6 00154 ,bool check_results = false 00155 ,bool calc_conditioning = false 00156 ,bool calc_matrix_norms = false 00157 ,bool calc_matrix_info_null_space_only = false 00158 ); 00159 00161 virtual ~NLPSolverClientInterface() {} 00162 00164 00167 00204 virtual EFindMinReturn find_min() = 0; 00205 00207 00210 00213 virtual void print_algorithm(std::ostream& out) const = 0; 00214 00216 00219 00225 virtual void set_algo_timing( bool algo_timing ) = 0; 00226 00228 virtual bool algo_timing() const = 0; 00229 00235 virtual void print_algorithm_times( std::ostream& out ) const = 0; 00236 00238 00239 private: 00240 00241 #ifdef DOXYGEN_COMPILE // Strictly for doxygen diagrams 00242 00243 NLPInterfacePack::NLP *nlp; 00245 IterationPack::AlgorithmTracker *track; 00246 #endif 00247 00248 }; // end class NLPSolverClientInterface 00249 00250 } // end namespace MoochoPack 00251 00252 #endif // RSQP_SOLVER_CLIENT_INTERFACE_H
1.7.4