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  bool file_append = false
186  );
187 
189 
192  {
193  return jnlst_;
194  }
195 
198  {
199  return reg_options_;
200  }
201 
204  {
205  return options_;
206  }
207 
210  {
211  return ConstPtr(options_);
212  }
213 
221  virtual SmartPtr<SolveStatistics> Statistics();
222 
224  virtual SmartPtr<IpoptNLP> IpoptNLPObject();
225 
227  SmartPtr<IpoptData> IpoptDataObject();
228 
230  virtual SmartPtr<IpoptCalculatedQuantities> IpoptCQObject();
231 
233  SmartPtr<IpoptAlgorithm> AlgorithmObject();
235 
242  void PrintCopyrightMessage();
243 
255  bool dorethrow
256  )
257  {
258  bool oldval = rethrow_nonipoptexception_;
259  rethrow_nonipoptexception_ = dorethrow;
260  return oldval;
261  }
262 
263  static void RegisterOptions(
265  );
266 
268  static void RegisterAllIpoptOptions(
269  const SmartPtr<RegisteredOptions>& roptions
270  );
271 
279  static void Version(
280  int& major,
281  int& minor,
282  int& release
283  );
284 
285 private:
293 
296  const IpoptApplication&
297  );
298 
300  void operator=(
301  const IpoptApplication&
302  );
304 
309  ApplicationReturnStatus call_optimize();
310 
312 
315 
319 
322 
325 
328 
333 
337 
343 
349 
355 
361 
363 
366 
374 };
375 
376 } // namespace Ipopt
377 
379 
380 #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:88
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:664
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.