Ipopt Documentation  
 
Loading...
Searching...
No Matches
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
17namespace Ipopt
18{
20
21/* forward declarations */
22class IpoptAlgorithm;
23class IpoptNLP;
24class IpoptData;
28class OptionsList;
29class SolveStatistics;
30
33{
34public:
36 bool create_console_out = true,
37 bool create_empty = false
38 );
39
47 );
48
50
55
70 std::istream& is,
71 bool allow_clobber = false
72 );
73
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
136 bool allow_clobber = false
137 );
138
141
143 const SmartPtr<TNLP>& tnlp
144 );
145
148 const SmartPtr<NLP>& nlp
149 );
150
153 const SmartPtr<NLP>& nlp,
155 );
156
164 const SmartPtr<TNLP>& tnlp
165 );
166
174 const SmartPtr<NLP>& nlp
175 );
177
182 virtual bool OpenOutputFile(
183 std::string file_name,
184 EJournalLevel print_level
185 );
186
189
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
221
224
227
230
234
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
270 );
271
272private:
281
283 const IpoptApplication&
284 );
285
288 const IpoptApplication&
289 );
291
297
300
302
306
309
312
315
320
324
330
336
342
348
351
353
361};
362
363} // namespace Ipopt
364
366
367#endif
#define DECLARE_STD_EXCEPTION(__except_type)
IPOPTLIB_EXPORT class Ipopt::IpoptApplication *IPOPT_CALLCONV IpoptApplicationFactory()
ApplicationReturnStatus
Return codes for the Optimize call for an application.
#define IPOPT_CALLCONV
Definition IpTypes.h:41
Builder for creating a complete IpoptAlg object.
Templated class which stores one entry for the CachedResult class.
The main ipopt algorithm class.
This is the main application class for making calls to Ipopt.
void operator=(const IpoptApplication &)
Default Assignment Operator.
virtual SmartPtr< SolveStatistics > Statistics()
Get the object with the statistics about the most recent optimization run.
virtual bool OpenOutputFile(std::string file_name, EJournalLevel print_level)
Method for opening an output file with given print_level.
virtual ApplicationReturnStatus ReOptimizeTNLP(const SmartPtr< TNLP > &tnlp)
Solve a problem (that inherits from TNLP) for a repeated time.
ApplicationReturnStatus call_optimize()
Method for the actual optimize call of the Ipopt algorithm.
void PrintCopyrightMessage()
Method for printing Ipopt copyright message now instead of just before the optimization.
static void RegisterAllIpoptOptions(const SmartPtr< RegisteredOptions > &roptions)
Method to register all Ipopt options.
bool rethrow_nonipoptexception_
Decide whether non-ipopt non-bad_alloc non-overflow_error exceptions should be rethrown.
SmartPtr< Journalist > jnlst_
Journalist for reporting output.
virtual ApplicationReturnStatus ReOptimizeNLP(const SmartPtr< NLP > &nlp)
Solve a problem (that inherits from NLP) for a repeated time.
IpoptApplication(const IpoptApplication &)
Copy Constructor.
IpoptApplication(SmartPtr< RegisteredOptions > reg_options, SmartPtr< OptionsList > options, SmartPtr< Journalist > jnlst)
Another constructor that assumes that the code in the (default) constructor has already been executed...
SmartPtr< IpoptNLP > ip_nlp_
IpoptNLP Object for the NLP.
bool inexact_algorithm_
Flag indicating if we are to use the inexact linear solver option.
virtual ApplicationReturnStatus Initialize(bool allow_clobber=false)
Initialize method.
virtual SmartPtr< RegisteredOptions > RegOptions()
Get a pointer to RegisteredOptions object to add new options.
SmartPtr< IpoptAlgorithm > AlgorithmObject()
Get the Algorithm Object.
virtual SmartPtr< const OptionsList > Options() const
Get the options list for setting options (const version)
SmartPtr< IpoptData > IpoptDataObject()
Get the IpoptData Object.
virtual ApplicationReturnStatus Initialize(std::string params_file, bool allow_clobber=false)
Initialization method.
bool RethrowNonIpoptException(bool dorethrow)
Method to set whether non-ipopt non-bad_alloc non-overflow_error exceptions are rethrown by Ipopt.
virtual SmartPtr< OptionsList > Options()
Get the options list for setting options.
virtual SmartPtr< IpoptApplication > clone()
Method for creating a new IpoptApplication that uses the same journalist and registered options,...
virtual ApplicationReturnStatus Initialize(const char *params_file, bool allow_clobber=false)
Initialization method.
virtual ApplicationReturnStatus OptimizeNLP(const SmartPtr< NLP > &nlp)
Solve a problem that inherits from NLP.
bool read_params_dat_
Decide whether or not the ipopt.opt file should be read.
IpoptApplication(bool create_console_out=true, bool create_empty=false)
virtual ApplicationReturnStatus OptimizeNLP(const SmartPtr< NLP > &nlp, SmartPtr< AlgorithmBuilder > &alg_builder)
Solve a problem that inherits from NLP.
virtual SmartPtr< IpoptCalculatedQuantities > IpoptCQObject()
Get the IpoptCQ Object.
SmartPtr< IpoptData > ip_data_
IpoptData Object for the NLP.
bool replace_bounds_
Flag indicating if all bounds should be replaced by inequality constraints.
SmartPtr< IpoptCalculatedQuantities > ip_cq_
IpoptCalculatedQuantities Object for the NLP.
SmartPtr< RegisteredOptions > reg_options_
RegisteredOptions.
virtual ApplicationReturnStatus Initialize(std::istream &is, bool allow_clobber=false)
Initialization method.
SmartPtr< SolveStatistics > statistics_
Object for storing statistics about the most recent optimization run.
SmartPtr< OptionsList > options_
OptionsList used for the application.
virtual ApplicationReturnStatus OptimizeTNLP(const SmartPtr< TNLP > &tnlp)
Solve a problem that inherits from TNLP.
SmartPtr< IpoptAlgorithm > alg_
Object with the algorithm skeleton.
SmartPtr< NLP > nlp_adapter_
Pointer to the TNLPAdapter used to convert the TNLP to an NLP.
virtual SmartPtr< IpoptNLP > IpoptNLPObject()
Get the IpoptNLP Object.
static void RegisterOptions(SmartPtr< RegisteredOptions > roptions)
virtual SmartPtr< Journalist > Jnlst()
Get the Journalist for printing output.
Class for all IPOPT specific calculated quantities.
Class to organize all the data required by the algorithm.
This is the abstract base class for classes that map the traditional NLP into something that is more ...
This class stores a list of user set options.
Storing the reference count of all the smart pointers that currently reference it.
Class for storing registered options.
This class collects statistics about an optimization run, such as iteration count,...
#define IPOPTLIB_EXPORT
Definition config.h:94
This file contains a base class for all exceptions and a set of macros to help with exceptions.
SmartPtr< const U > ConstPtr(const SmartPtr< U > &smart_ptr)
EJournalLevel
Print Level Enum.