MoochoPack : Framework for Large-Scale Optimization Algorithms  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
MoochoPack_NLPSolverClientInterface.hpp
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
5 // Copyright (2003) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov)
38 //
39 // ***********************************************************************
40 // @HEADER
41 
42 #ifndef RSQP_SOLVER_CLIENT_INTERFACE_H
43 #define RSQP_SOLVER_CLIENT_INTERFACE_H
44 
45 #include <stdexcept>
46 
47 #include "MoochoPack_Types.hpp"
48 #include "NLPInterfacePack_NLP.hpp"
49 #include "IterationPack_AlgorithmTracker.hpp"
52 
53 namespace MoochoPack {
54 
60 public:
61 
64 
67  SOLUTION_FOUND
68  ,MAX_ITER_EXCEEDED
69  ,MAX_RUN_TIME_EXCEEDED
70  ,ALGORITHMIC_ERROR
71  };
72 
74  class InvalidSetup : public std::logic_error
75  {public: InvalidSetup(const std::string& what_arg) : std::logic_error(what_arg) {}};
76 
78 
81 
83  STANDARD_MEMBER_COMPOSITION_MEMBERS( int, max_iter );
84 
87  STANDARD_MEMBER_COMPOSITION_MEMBERS( double, max_run_time );
88 
92  STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, opt_tol );
93 
97  STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, feas_tol );
98 
103  STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, comp_tol );
104 
109  STANDARD_MEMBER_COMPOSITION_MEMBERS( value_type, step_tol );
110 
113  STANDARD_MEMBER_COMPOSITION_MEMBERS( EJournalOutputLevel, journal_output_level );
114 
120  STANDARD_MEMBER_COMPOSITION_MEMBERS( EJournalOutputLevel, null_space_journal_output_level );
121 
124  STANDARD_MEMBER_COMPOSITION_MEMBERS( int, journal_print_digits );
125 
128  STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, check_results );
129 
133  STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, calc_conditioning );
134 
137  STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, calc_matrix_norms );
138 
142  STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, calc_matrix_info_null_space_only );
143 
145 
148 
150  STANDARD_COMPOSITION_MEMBERS( NLP, nlp );
151 
153  STANDARD_COMPOSITION_MEMBERS( AlgorithmTracker, track );
154 
158  int max_iter = 10000
159  ,double max_run_time = 1e+10 // run forever
160  ,value_type opt_tol = 1e-6
161  ,value_type feas_tol = 1e-6
162  ,value_type comp_tol = 1e-6
163  ,value_type step_tol = 1e-2
164  ,EJournalOutputLevel journal_output_level = PRINT_ALGORITHM_STEPS
165  ,EJournalOutputLevel null_space_journal_output_level = PRINT_ALGORITHM_STEPS
166  ,int journal_print_digits = 6
167  ,bool check_results = false
168  ,bool calc_conditioning = false
169  ,bool calc_matrix_norms = false
170  ,bool calc_matrix_info_null_space_only = false
171  );
172 
175 
177 
180 
217  virtual EFindMinReturn find_min() = 0;
218 
220 
223 
226  virtual void print_algorithm(std::ostream& out) const = 0;
227 
229 
232 
238  virtual void set_algo_timing( bool algo_timing ) = 0;
239 
241  virtual bool algo_timing() const = 0;
242 
248  virtual void print_algorithm_times( std::ostream& out ) const = 0;
249 
251 
252 private:
253 
254 #ifdef DOXYGEN_COMPILE // Strictly for doxygen diagrams
255 
259 #endif
260 
261 }; // end class NLPSolverClientInterface
262 
263 } // end namespace MoochoPack
264 
265 #endif // RSQP_SOLVER_CLIENT_INTERFACE_H
virtual EFindMinReturn find_min()=0
Find the minimun of the set NLP.
STANDARD_MEMBER_COMPOSITION_MEMBERS(int, max_iter)
Set the maximum number of iterations the rSQP algorithm can perform.
virtual void print_algorithm_times(std::ostream &out) const =0
Outputs table of times for each step and the cummulative times.
virtual void print_algorithm(std::ostream &out) const =0
Prints a description of the algorithm.
This is the most basic interface that clients use to solve an NLP.
NLPSolverClientInterface(int max_iter=10000, double max_run_time=1e+10, value_type opt_tol=1e-6, value_type feas_tol=1e-6, value_type comp_tol=1e-6, value_type step_tol=1e-2, EJournalOutputLevel journal_output_level=PRINT_ALGORITHM_STEPS, EJournalOutputLevel null_space_journal_output_level=PRINT_ALGORITHM_STEPS, int journal_print_digits=6, bool check_results=false, bool calc_conditioning=false, bool calc_matrix_norms=false, bool calc_matrix_info_null_space_only=false)
Construct with no references set to nlp or track objects.
STANDARD_COMPOSITION_MEMBERS(NLP, nlp)
<<std comp>="">> members for the nlp
virtual bool algo_timing() const =0
virtual void set_algo_timing(bool algo_timing)=0
Causes algorithm to be timed.