Ipopt 3.12.10

- Main Page
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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: IpIpoptApplication.hpp 2690 2017-06-12 10:28:36Z stefan $
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
47 class IpoptApplication : public ReferencedObject
48 {
49 public:
50 IpoptApplication(bool create_console_out = true,
51 bool create_empty = false);
52
55 IpoptApplication(SmartPtr<RegisteredOptions> reg_options,
56 SmartPtr<OptionsList> options,
57 SmartPtr<Journalist> jnlst);
58
59 virtual ~IpoptApplication();
60
64 virtual SmartPtr<IpoptApplication> clone();
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
117 virtual ApplicationReturnStatus OptimizeTNLP(const SmartPtr<TNLP>& tnlp);
118
120 virtual ApplicationReturnStatus OptimizeNLP(const SmartPtr<NLP>& nlp);
121
123 virtual ApplicationReturnStatus OptimizeNLP(const SmartPtr<NLP>& nlp, SmartPtr<AlgorithmBuilder>& alg_builder);
124
130 virtual ApplicationReturnStatus ReOptimizeTNLP(const SmartPtr<TNLP>& tnlp);
131
137 virtual ApplicationReturnStatus ReOptimizeNLP(const SmartPtr<NLP>& nlp);
139
142 virtual bool OpenOutputFile(std::string file_name, EJournalLevel print_level);
143
147 virtual SmartPtr<Journalist> Jnlst()
148 {
149 return jnlst_;
150 }
151
154 virtual SmartPtr<RegisteredOptions> RegOptions()
155 {
156 return reg_options_;
157 }
158
160 virtual SmartPtr<OptionsList> Options()
161 {
162 return options_;
163 }
164
166 virtual SmartPtr<const OptionsList> Options() const
167 {
168 return ConstPtr(options_);
169 }
170
173 virtual SmartPtr<SolveStatistics> Statistics();
174
176 virtual SmartPtr<IpoptNLP> IpoptNLPObject();
177
179 SmartPtr<IpoptData> IpoptDataObject();
180
182 virtual SmartPtr<IpoptCalculatedQuantities> IpoptCQObject();
183
185 SmartPtr<IpoptAlgorithm> AlgorithmObject();
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
217 RegisterAllIpoptOptions(const SmartPtr<RegisteredOptions>& roptions);
218
219 private:
229 // IpoptApplication();
230
232 IpoptApplication(const IpoptApplication&);
233
235 void operator=(const IpoptApplication&);
237
240 ApplicationReturnStatus call_optimize();
241
245 bool read_params_dat_;
246
248 bool rethrow_nonipoptexception_;
250
252 SmartPtr<Journalist> jnlst_;
253
255 SmartPtr<RegisteredOptions> reg_options_;
256
258 SmartPtr<OptionsList> options_;
259
262 SmartPtr<SolveStatistics> statistics_;
263
266 SmartPtr<IpoptAlgorithm> alg_;
267
270 SmartPtr<IpoptNLP> ip_nlp_;
271
275 SmartPtr<IpoptData> ip_data_;
276
280 SmartPtr<IpoptCalculatedQuantities> ip_cq_;
281
284 SmartPtr<NLP> nlp_adapter_;
285
289 bool inexact_algorithm_;
292 bool replace_bounds_;
294 };
295
296 } // namespace Ipopt
297
298 extern "C" IPOPT_EXPORT(class Ipopt::IpoptApplication *) IpoptApplicationFactory();
299
300 #endif
Ipopt::IpoptApplication::ip_nlp_
SmartPtr< IpoptNLP > ip_nlp_
IpoptNLP Object for the NLP.
Definition: IpIpoptApplication.hpp:270
Ipopt::IpoptApplication::RegOptions
virtual SmartPtr< RegisteredOptions > RegOptions()
Get a pointer to RegisteredOptions object to add new options.
Definition: IpIpoptApplication.hpp:154
print_level
char Int print_level
Definition: IpStdCInterface.h:202
Ipopt::IpoptApplication::RegisterOptions
static void RegisterOptions(SmartPtr< RegisteredOptions > roptions)
Ipopt::IpoptApplication::rethrow_nonipoptexception_
bool rethrow_nonipoptexception_
Decide whether non-ipopt non-bad_alloc exceptions should be rethrown.
Definition: IpIpoptApplication.hpp:248
IpNLP.hpp
Ipopt::IpoptApplication::AlgorithmObject
SmartPtr< IpoptAlgorithm > AlgorithmObject()
Get the Algorithm Object.
IpReturnCodes.hpp
Ipopt::IpoptApplication::Jnlst
virtual SmartPtr< Journalist > Jnlst()
Get the Journalist for printing output.
Definition: IpIpoptApplication.hpp:147
Ipopt::IpoptApplication::RegisterAllIpoptOptions
static void RegisterAllIpoptOptions(const SmartPtr< RegisteredOptions > &roptions)
Method to registering all Ipopt options.
Ipopt::IpoptApplication::OpenOutputFile
virtual bool OpenOutputFile(std::string file_name, EJournalLevel print_level)
Method for opening an output file with given print_level.
Ipopt::EJournalLevel
EJournalLevel
Print Level Enum.
Definition: IpJournalist.hpp:51
Ipopt::IpoptApplication::options_
SmartPtr< OptionsList > options_
OptionsList used for the application.
Definition: IpIpoptApplication.hpp:258
Ipopt::IpoptApplication::IpoptNLPObject
virtual SmartPtr< IpoptNLP > IpoptNLPObject()
Get the IpoptNLP Object.
Ipopt::IpoptApplication::OptimizeNLP
virtual ApplicationReturnStatus OptimizeNLP(const SmartPtr< NLP > &nlp)
Solve a problem that inherits from NLP.
Ipopt::SmartPtr
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:172
Ipopt::ReferencedObject
ReferencedObject class.
Definition: IpReferenced.hpp:174
Ipopt::IpoptApplication::reg_options_
SmartPtr< RegisteredOptions > reg_options_
RegisteredOptions.
Definition: IpIpoptApplication.hpp:255
Ipopt::IpoptApplication::jnlst_
SmartPtr< Journalist > jnlst_
Journalist for reporting output.
Definition: IpIpoptApplication.hpp:252
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::IpoptApplication::ReOptimizeTNLP
virtual ApplicationReturnStatus ReOptimizeTNLP(const SmartPtr< TNLP > &tnlp)
Solve a problem (that inherits from TNLP) for a repeated time.
Ipopt::IpoptApplication::Statistics
virtual SmartPtr< SolveStatistics > Statistics()
Get the object with the statistics about the most recent optimization run.
Ipopt::IpoptApplication::IpoptCQObject
virtual SmartPtr< IpoptCalculatedQuantities > IpoptCQObject()
Get the IpoptCQ Object.
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::Options
virtual SmartPtr< OptionsList > Options()
Get the options list for setting options.
Definition: IpIpoptApplication.hpp:160
Ipopt::IpoptApplication::~IpoptApplication
virtual ~IpoptApplication()
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::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
IpTNLP.hpp
Ipopt::IpoptApplication::call_optimize
ApplicationReturnStatus call_optimize()
Method for the actual optimize call of the Ipopt algorithm.
Ipopt::ConstPtr
SmartPtr< const U > ConstPtr(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:572
Ipopt::IpoptApplication::alg_
SmartPtr< IpoptAlgorithm > alg_
Object with the algorithm sceleton.
Definition: IpIpoptApplication.hpp:266
Ipopt::DECLARE_STD_EXCEPTION
DECLARE_STD_EXCEPTION(SUFFIX_EMPTY)
Ipopt::IpoptApplication::operator=
void operator=(const IpoptApplication &)
Overloaded Equals Operator.
IpJournalist.hpp
Ipopt::IpoptApplication::IpoptDataObject
SmartPtr< IpoptData > IpoptDataObject()
Get the IpoptData Object.
Ipopt::IpoptApplication::OptimizeTNLP
virtual ApplicationReturnStatus OptimizeTNLP(const SmartPtr< TNLP > &tnlp)
Solve a problem that inherits from TNLP.
Ipopt::IpoptApplication::Initialize
virtual ApplicationReturnStatus Initialize(const char *params_file, bool allow_clobber=false)
Initialization method.
Definition: IpIpoptApplication.hpp:99
Ipopt::ApplicationReturnStatus
ApplicationReturnStatus
Return codes for the Optimize call for an application.
Definition: IpReturnCodes.hpp:17
Ipopt::IpoptApplication::ReOptimizeNLP
virtual ApplicationReturnStatus ReOptimizeNLP(const SmartPtr< NLP > &nlp)
Solve a problem (that inherits from NLP) for a repeated time.
file_name
char * file_name
Definition: IpStdCInterface.h:202
Ipopt::IpoptApplication
This is the main application class for making calls to Ipopt.
Definition: IpIpoptApplication.hpp:47
Ipopt::IpoptApplication::ip_data_
SmartPtr< IpoptData > ip_data_
IpoptData Object for the NLP.
Definition: IpIpoptApplication.hpp:275
Ipopt::IpoptApplication::nlp_adapter_
SmartPtr< NLP > nlp_adapter_
Pointer to the TNLPAdapter used to convert the TNLP to an NLP.
Definition: IpIpoptApplication.hpp:284
Ipopt::IpoptApplication::IpoptApplication
IpoptApplication(bool create_console_out=true, bool create_empty=false)
Ipopt::IpoptApplication::replace_bounds_
bool replace_bounds_
Flag indicating if all bounds should be replaced by inequality constraints.
Definition: IpIpoptApplication.hpp:292
Ipopt::IpoptApplication::Initialize
virtual ApplicationReturnStatus Initialize(std::istream &is, bool allow_clobber=false)
Initialization method.
Ipopt::IpoptApplication::PrintCopyrightMessage
void PrintCopyrightMessage()
Method for printing Ipopt copyright message now instead of just before the optimization.
Ipopt::IpoptApplication::Options
virtual SmartPtr< const OptionsList > Options() const
Get the options list for setting options (const version)
Definition: IpIpoptApplication.hpp:166
Ipopt::IpoptApplication::clone
virtual SmartPtr< IpoptApplication > clone()
Method for creating a new IpoptApplication that uses the same journalist and registered options...
IPOPT_EXPORT
#define IPOPT_EXPORT(type)
Definition: IpIpoptApplication.hpp:20