Ipopt 3.11.9
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// $Id: IpIpoptApplication.hpp 2400 2013-10-19 18:38: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
32namespace Ipopt
33{
34 DECLARE_STD_EXCEPTION(IPOPT_APPLICATION_ERROR);
35
36 /* forward declarations */
37 class IpoptAlgorithm;
38 class IpoptNLP;
39 class IpoptData;
41 class AlgorithmBuilder;
43 class OptionsList;
44 class SolveStatistics;
45
48 {
49 public:
50 IpoptApplication(bool create_console_out = true,
51 bool create_empty = false);
52
58
60
65
73 virtual ApplicationReturnStatus Initialize(std::istream& is);
83 virtual ApplicationReturnStatus Initialize(std::string params_file);
92
97
100
103
110
118
122
127 {
128 return jnlst_;
129 }
130
134 {
135 return reg_options_;
136 }
137
140 {
141 return options_;
142 }
143
146 {
147 return ConstPtr(options_);
148 }
149
153
156
159
162
166
172
180 void RethrowNonIpoptException(bool dorethrow)
181 {
182 rethrow_nonipoptexception_ = dorethrow;
183 }
184
189
191 static void
193
194 private:
204 // IpoptApplication();
205
208
212
216
221
225
228
231
234
238
242
246
251
256
260
269 };
270
271} // namespace Ipopt
272
273extern "C" IPOPT_EXPORT(class Ipopt::IpoptApplication *) IpoptApplicationFactory();
274
275#endif
#define DECLARE_STD_EXCEPTION(__except_type)
#define IPOPT_EXPORT(type)
ApplicationReturnStatus
Return codes for the Optimize call for an application.
char Int print_level
char * file_name
Builder to create a complete IpoptAlg object.
The main ipopt algorithm class.
This is the main application class for making calls to Ipopt.
void operator=(const IpoptApplication &)
Overloaded Equals 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 registering all Ipopt options.
bool rethrow_nonipoptexception_
Decide whether non-ipopt non-bad_alloc 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 &)
Default 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(std::string params_file)
Initialization 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::istream &is)
Initialization method.
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,...
void RethrowNonIpoptException(bool dorethrow)
Method to set whether non-ipopt non-bad_alloc exceptions are rethrown by Ipopt.
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.
SmartPtr< SolveStatistics > statistics_
Object for storing statistics about the most recent optimization run.
virtual ApplicationReturnStatus Initialize()
Initialize method.
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 sceleton.
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.
ReferencedObject class.
Class for storing registered options.
Template class for Smart Pointers.
This class collects statistics about an optimziation run, such as iteration count,...
SmartPtr< const U > ConstPtr(const SmartPtr< U > &smart_ptr)
EJournalLevel
Print Level Enum.