Ipopt  3.12.13
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 // $Id$
6 //
7 // Authors: Carl Laird, Andreas Waechter IBM 2004-08-13
8 
9 #ifndef __IPIPOPTAPPLICATION_HPP__
10 #define __IPIPOPTAPPLICATION_HPP__
11 
12 #ifndef IPOPT_EXPORT
13 #ifdef _MSC_VER
14 #ifdef IPOPT_DLL
15 #define IPOPT_EXPORT(type) __declspec(dllexport) type __cdecl
16 #else
17 #define IPOPT_EXPORT(type) type __cdecl
18 #endif
19 #else
20 #define IPOPT_EXPORT(type) type
21 #endif
22 #endif
23 
24 #include <iostream>
25 
26 #include "IpJournalist.hpp"
27 #include "IpTNLP.hpp"
28 #include "IpNLP.hpp"
29 /* Return codes for the Optimize call for an application */
30 #include "IpReturnCodes.hpp"
31 
32 namespace Ipopt
33 {
34  DECLARE_STD_EXCEPTION(IPOPT_APPLICATION_ERROR);
35 
36  /* forward declarations */
37  class IpoptAlgorithm;
38  class IpoptNLP;
39  class IpoptData;
40  class IpoptCalculatedQuantities;
41  class AlgorithmBuilder;
42  class RegisteredOptions;
43  class OptionsList;
44  class SolveStatistics;
45 
48  {
49  public:
50  IpoptApplication(bool create_console_out = true,
51  bool create_empty = false);
52 
56  SmartPtr<OptionsList> options,
57  SmartPtr<Journalist> jnlst);
58 
59  virtual ~IpoptApplication();
60 
65 
75  virtual ApplicationReturnStatus Initialize(std::istream& is, bool allow_clobber = false);
87  virtual ApplicationReturnStatus Initialize(std::string params_file, bool allow_clobber = false);
99  virtual ApplicationReturnStatus Initialize(const char* params_file, bool allow_clobber = false)
100  {
101  return Initialize(std::string(params_file), allow_clobber);
102  }
112  virtual ApplicationReturnStatus Initialize(bool allow_clobber = false);
113 
118 
121 
124 
131 
139 
142  virtual bool OpenOutputFile(std::string file_name, EJournalLevel print_level);
143 
148  {
149  return jnlst_;
150  }
151 
155  {
156  return reg_options_;
157  }
158 
161  {
162  return options_;
163  }
164 
167  {
168  return ConstPtr(options_);
169  }
170 
174 
177 
180 
183 
187 
192  void PrintCopyrightMessage();
193 
203  bool RethrowNonIpoptException(bool dorethrow)
204  {
205  bool oldval = rethrow_nonipoptexception_;
206  rethrow_nonipoptexception_ = dorethrow;
207  return oldval;
208  }
209 
212  static void RegisterOptions(SmartPtr<RegisteredOptions> roptions);
214 
216  static void
218 
219  private:
229  // IpoptApplication();
230 
233 
235  void operator=(const IpoptApplication&);
237 
241 
246 
250 
253 
256 
259 
263 
267 
271 
276 
281 
285 
294  };
295 
296 } // namespace Ipopt
297 
298 extern "C" IPOPT_EXPORT(class Ipopt::IpoptApplication *) IpoptApplicationFactory();
299 
300 #endif
Ipopt::IpoptApplication::operator=
void operator=(const IpoptApplication &)
Overloaded Equals Operator.
Ipopt::IpoptApplication::RegisterOptions
static void RegisterOptions(SmartPtr< RegisteredOptions > roptions)
Ipopt::IpoptApplication::options_
SmartPtr< OptionsList > options_
OptionsList used for the application.
Definition: IpIpoptApplication.hpp:258
Ipopt::IpoptApplication::OptimizeNLP
virtual ApplicationReturnStatus OptimizeNLP(const SmartPtr< NLP > &nlp)
Solve a problem that inherits from NLP.
Ipopt::IpoptApplication::AlgorithmObject
SmartPtr< IpoptAlgorithm > AlgorithmObject()
Get the Algorithm Object.
Ipopt::IpoptApplication::Jnlst
virtual SmartPtr< Journalist > Jnlst()
Get the Journalist for printing output.
Definition: IpIpoptApplication.hpp:147
Ipopt::IpoptApplication::nlp_adapter_
SmartPtr< NLP > nlp_adapter_
Pointer to the TNLPAdapter used to convert the TNLP to an NLP.
Definition: IpIpoptApplication.hpp:284
file_name
char * file_name
Definition: IpStdCInterface.h:202
Ipopt
Definition: matlabjournal.hpp:14
Ipopt::IpoptApplication::ReOptimizeTNLP
virtual ApplicationReturnStatus ReOptimizeTNLP(const SmartPtr< TNLP > &tnlp)
Solve a problem (that inherits from TNLP) for a repeated time.
IpJournalist.hpp
IpReturnCodes.hpp
IpNLP.hpp
Ipopt::IpoptApplication::ip_nlp_
SmartPtr< IpoptNLP > ip_nlp_
IpoptNLP Object for the NLP.
Definition: IpIpoptApplication.hpp:270
Ipopt::EJournalLevel
EJournalLevel
Print Level Enum.
Definition: IpJournalist.hpp:51
Ipopt::IpoptApplication::Options
virtual SmartPtr< OptionsList > Options()
Get the options list for setting options.
Definition: IpIpoptApplication.hpp:160
Ipopt::IpoptApplication::RegisterAllIpoptOptions
static void RegisterAllIpoptOptions(const SmartPtr< RegisteredOptions > &roptions)
Method to registering all Ipopt options.
Ipopt::IpoptApplication::call_optimize
ApplicationReturnStatus call_optimize()
Method for the actual optimize call of the Ipopt algorithm.
Ipopt::IpoptApplication::reg_options_
SmartPtr< RegisteredOptions > reg_options_
RegisteredOptions.
Definition: IpIpoptApplication.hpp:255
ApplicationReturnStatus
ApplicationReturnStatus
Return codes for the Optimize call for an application.
Definition: IpReturnCodes_inc.h:15
Ipopt::IpoptApplication::OpenOutputFile
virtual bool OpenOutputFile(std::string file_name, EJournalLevel print_level)
Method for opening an output file with given print_level.
Ipopt::IpoptApplication::jnlst_
SmartPtr< Journalist > jnlst_
Journalist for reporting output.
Definition: IpIpoptApplication.hpp:252
Ipopt::IpoptApplication::Statistics
virtual SmartPtr< SolveStatistics > Statistics()
Get the object with the statistics about the most recent optimization run.
Ipopt::IpoptApplication::rethrow_nonipoptexception_
bool rethrow_nonipoptexception_
Decide whether non-ipopt non-bad_alloc exceptions should be rethrown.
Definition: IpIpoptApplication.hpp:248
Ipopt::IpoptApplication::IpoptNLPObject
virtual SmartPtr< IpoptNLP > IpoptNLPObject()
Get the IpoptNLP Object.
Ipopt::IpoptApplication::IpoptDataObject
SmartPtr< IpoptData > IpoptDataObject()
Get the IpoptData Object.
IPOPT_EXPORT
#define IPOPT_EXPORT(type)
Definition: IpIpoptApplication.hpp:20
IpTNLP.hpp
Ipopt::SmartPtr
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:172
Ipopt::IpoptApplication::ReOptimizeNLP
virtual ApplicationReturnStatus ReOptimizeNLP(const SmartPtr< NLP > &nlp)
Solve a problem (that inherits from NLP) for a repeated time.
Ipopt::IpoptApplication::ip_data_
SmartPtr< IpoptData > ip_data_
IpoptData Object for the NLP.
Definition: IpIpoptApplication.hpp:275
Ipopt::IpoptApplication
This is the main application class for making calls to Ipopt.
Definition: IpIpoptApplication.hpp:47
Ipopt::IpoptApplication::~IpoptApplication
virtual ~IpoptApplication()
Ipopt::IpoptApplication::statistics_
SmartPtr< SolveStatistics > statistics_
Object for storing statistics about the most recent optimization run.
Definition: IpIpoptApplication.hpp:262
Ipopt::IpoptApplication::ip_cq_
SmartPtr< IpoptCalculatedQuantities > ip_cq_
IpoptCalculatedQuantities Object for the NLP.
Definition: IpIpoptApplication.hpp:280
Ipopt::IpoptApplication::alg_
SmartPtr< IpoptAlgorithm > alg_
Object with the algorithm sceleton.
Definition: IpIpoptApplication.hpp:266
Ipopt::IpoptApplication::RethrowNonIpoptException
bool RethrowNonIpoptException(bool dorethrow)
Method to set whether non-ipopt non-bad_alloc exceptions are rethrown by Ipopt.
Definition: IpIpoptApplication.hpp:203
Ipopt::ConstPtr
SmartPtr< const U > ConstPtr(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:572
Ipopt::IpoptApplication::Initialize
virtual ApplicationReturnStatus Initialize(const char *params_file, bool allow_clobber=false)
Initialization method.
Definition: IpIpoptApplication.hpp:99
Ipopt::IpoptApplication::inexact_algorithm_
bool inexact_algorithm_
Flag indicating if we are to use the inexact linear solver option.
Definition: IpIpoptApplication.hpp:289
Ipopt::IpoptApplication::IpoptCQObject
virtual SmartPtr< IpoptCalculatedQuantities > IpoptCQObject()
Get the IpoptCQ Object.
print_level
char Int print_level
Definition: IpStdCInterface.h:202
Ipopt::IpoptApplication::IpoptApplication
IpoptApplication(bool create_console_out=true, bool create_empty=false)
Ipopt::IpoptApplication::RegOptions
virtual SmartPtr< RegisteredOptions > RegOptions()
Get a pointer to RegisteredOptions object to add new options.
Definition: IpIpoptApplication.hpp:154
Ipopt::IpoptApplication::Initialize
virtual ApplicationReturnStatus Initialize(std::istream &is, bool allow_clobber=false)
Initialization method.
Ipopt::IpoptApplication::read_params_dat_
bool read_params_dat_
Decide whether or not the ipopt.opt file should be read.
Definition: IpIpoptApplication.hpp:245
Ipopt::IpoptApplication::replace_bounds_
bool replace_bounds_
Flag indicating if all bounds should be replaced by inequality constraints.
Definition: IpIpoptApplication.hpp:292
Ipopt::IpoptApplication::PrintCopyrightMessage
void PrintCopyrightMessage()
Method for printing Ipopt copyright message now instead of just before the optimization.
Ipopt::IpoptApplication::clone
virtual SmartPtr< IpoptApplication > clone()
Method for creating a new IpoptApplication that uses the same journalist and registered options,...
Ipopt::IpoptApplication::Options
virtual SmartPtr< const OptionsList > Options() const
Get the options list for setting options (const version)
Definition: IpIpoptApplication.hpp:166
Ipopt::IpoptApplication::OptimizeTNLP
virtual ApplicationReturnStatus OptimizeTNLP(const SmartPtr< TNLP > &tnlp)
Solve a problem that inherits from TNLP.
Ipopt::ReferencedObject
ReferencedObject class.
Definition: IpReferenced.hpp:174
Ipopt::DECLARE_STD_EXCEPTION
DECLARE_STD_EXCEPTION(SUFFIX_EMPTY)