Ipopt Documentation  
IpIpoptApplication.hpp
Go to the documentation of this file.
1 // Copyright (C) 2004, 2010 International Business Machines and others.
2 // All Rights Reserved.
3 // This code is published under the Eclipse Public License.
4 //
5 // Authors: Carl Laird, Andreas Waechter IBM 2004-08-13
6 
7 #ifndef __IPIPOPTAPPLICATION_HPP__
8 #define __IPIPOPTAPPLICATION_HPP__
9 
10 #include <iostream>
11 
12 #include "IpJournalist.hpp"
13 #include "IpTNLP.hpp"
14 #include "IpNLP.hpp"
15 #include "IpReturnCodes.hpp"
16 
17 namespace Ipopt
18 {
19 DECLARE_STD_EXCEPTION(IPOPT_APPLICATION_ERROR);
20 
21 /* forward declarations */
22 class IpoptAlgorithm;
23 class IpoptNLP;
24 class IpoptData;
25 class IpoptCalculatedQuantities;
26 class AlgorithmBuilder;
27 class RegisteredOptions;
28 class OptionsList;
29 class SolveStatistics;
30 
33 {
34 public:
36  bool create_console_out = true,
37  bool create_empty = false
38  );
39 
44  SmartPtr<RegisteredOptions> reg_options,
45  SmartPtr<OptionsList> options,
47  );
48 
49  virtual ~IpoptApplication();
50 
54  virtual SmartPtr<IpoptApplication> clone();
55 
69  virtual ApplicationReturnStatus Initialize(
70  std::istream& is,
71  bool allow_clobber = false
72  );
73 
91  virtual ApplicationReturnStatus Initialize(
92  std::string params_file,
93  bool allow_clobber = false
94  );
95 
114  const char* params_file,
115  bool allow_clobber = false
116  )
117  {
118  return Initialize(std::string(params_file), allow_clobber);
119  }
120 
135  virtual ApplicationReturnStatus Initialize(
136  bool allow_clobber = false
137  );
138 
140 
142  virtual ApplicationReturnStatus OptimizeTNLP(
143  const SmartPtr<TNLP>& tnlp
144  );
145 
147  virtual ApplicationReturnStatus OptimizeNLP(
148  const SmartPtr<NLP>& nlp
149  );
150 
152  virtual ApplicationReturnStatus OptimizeNLP(
153  const SmartPtr<NLP>& nlp,
154  SmartPtr<AlgorithmBuilder>& alg_builder
155  );
156 
163  virtual ApplicationReturnStatus ReOptimizeTNLP(
164  const SmartPtr<TNLP>& tnlp
165  );
166 
173  virtual ApplicationReturnStatus ReOptimizeNLP(
174  const SmartPtr<NLP>& nlp
175  );
177 
182  virtual bool OpenOutputFile(
183  std::string file_name,
184  EJournalLevel print_level
185  );
186 
188 
191  {
192  return jnlst_;
193  }
194 
197  {
198  return reg_options_;
199  }
200 
203  {
204  return options_;
205  }
206 
209  {
210  return ConstPtr(options_);
211  }
212 
220  virtual SmartPtr<SolveStatistics> Statistics();
221 
223  virtual SmartPtr<IpoptNLP> IpoptNLPObject();
224 
226  SmartPtr<IpoptData> IpoptDataObject();
227 
229  virtual SmartPtr<IpoptCalculatedQuantities> IpoptCQObject();
230 
232  SmartPtr<IpoptAlgorithm> AlgorithmObject();
234 
241  void PrintCopyrightMessage();
242 
254  bool dorethrow
255  )
256  {
257  bool oldval = rethrow_nonipoptexception_;
258  rethrow_nonipoptexception_ = dorethrow;
259  return oldval;
260  }
261 
262  static void RegisterOptions(
264  );
265 
267  static void
268  RegisterAllIpoptOptions(
269  const SmartPtr<RegisteredOptions>& roptions
270  );
271 
272 private:
280 
283  const IpoptApplication&
284  );
285 
287  void operator=(
288  const IpoptApplication&
289  );
291 
296  ApplicationReturnStatus call_optimize();
297 
299 
302 
306 
309 
312 
315 
320 
324 
330 
336 
342 
348 
350 
353 
361 };
362 
363 } // namespace Ipopt
364 
366 
367 #endif
SmartPtr< IpoptNLP > ip_nlp_
IpoptNLP Object for the NLP.
virtual SmartPtr< RegisteredOptions > RegOptions()
Get a pointer to RegisteredOptions object to add new options.
#define IPOPTLIB_EXPORT
Definition: config.h:94
bool rethrow_nonipoptexception_
Decide whether non-ipopt non-bad_alloc non-overflow_error exceptions should be rethrown.
DECLARE_STD_EXCEPTION(FATAL_ERROR_IN_LINEAR_SOLVER)
virtual SmartPtr< Journalist > Jnlst()
Get the Journalist for printing output.
EJournalLevel
Print Level Enum.
SmartPtr< OptionsList > options_
OptionsList used for the application.
This file contains a base class for all exceptions and a set of macros to help with exceptions...
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:164
Storing the reference count of all the smart pointers that currently reference it.
#define IPOPT_CALLCONV
Definition: IpTypes.h:41
SmartPtr< RegisteredOptions > reg_options_
RegisteredOptions.
SmartPtr< Journalist > jnlst_
Journalist for reporting output.
bool RethrowNonIpoptException(bool dorethrow)
Method to set whether non-ipopt non-bad_alloc non-overflow_error exceptions are rethrown by Ipopt...
bool inexact_algorithm_
Flag indicating if we are to use the inexact linear solver option.
virtual SmartPtr< OptionsList > Options()
Get the options list for setting options.
bool read_params_dat_
Decide whether or not the ipopt.opt file should be read.
SmartPtr< SolveStatistics > statistics_
Object for storing statistics about the most recent optimization run.
SmartPtr< IpoptCalculatedQuantities > ip_cq_
IpoptCalculatedQuantities Object for the NLP.
SmartPtr< const U > ConstPtr(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:663
SmartPtr< IpoptAlgorithm > alg_
Object with the algorithm skeleton.
virtual SmartPtr< const OptionsList > Options() const
Get the options list for setting options (const version)
virtual ApplicationReturnStatus Initialize(const char *params_file, bool allow_clobber=false)
Initialization method.
ApplicationReturnStatus
Return codes for the Optimize call for an application.
IPOPTLIB_EXPORT class Ipopt::IpoptApplication *IPOPT_CALLCONV IpoptApplicationFactory()
This is the main application class for making calls to Ipopt.
SmartPtr< IpoptData > ip_data_
IpoptData Object for the NLP.
SmartPtr< NLP > nlp_adapter_
Pointer to the TNLPAdapter used to convert the TNLP to an NLP.
bool replace_bounds_
Flag indicating if all bounds should be replaced by inequality constraints.