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 #ifndef IPOPT_EXPORT
11 #ifdef _MSC_VER
12 #define IPOPT_EXPORT(type) type __cdecl
13 #else
14 #define IPOPT_EXPORT(type) type
15 #endif
16 #endif
17 
18 #include <iostream>
19 
20 #include "IpJournalist.hpp"
21 #include "IpTNLP.hpp"
22 #include "IpNLP.hpp"
23 /* Return codes for the Optimize call for an application */
24 #include "IpReturnCodes.hpp"
25 
26 namespace Ipopt
27 {
28 DECLARE_STD_EXCEPTION(IPOPT_APPLICATION_ERROR);
29 
30 /* forward declarations */
31 class IpoptAlgorithm;
32 class IpoptNLP;
33 class IpoptData;
35 class AlgorithmBuilder;
36 class RegisteredOptions;
37 class OptionsList;
38 class SolveStatistics;
39 
42 {
43 public:
45  bool create_console_out = true,
46  bool create_empty = false
47  );
48 
53  SmartPtr<RegisteredOptions> reg_options,
54  SmartPtr<OptionsList> options,
56  );
57 
58  virtual ~IpoptApplication();
59 
64 
79  std::istream& is,
80  bool allow_clobber = false
81  );
82 
101  std::string params_file,
102  bool allow_clobber = false
103  );
104 
123  const char* params_file,
124  bool allow_clobber = false
125  )
126  {
127  return Initialize(std::string(params_file), allow_clobber);
128  }
129 
145  bool allow_clobber = false
146  );
147 
152  const SmartPtr<TNLP>& tnlp
153  );
154 
157  const SmartPtr<NLP>& nlp
158  );
159 
162  const SmartPtr<NLP>& nlp,
163  SmartPtr<AlgorithmBuilder>& alg_builder
164  );
165 
174  const SmartPtr<TNLP>& tnlp
175  );
176 
185  const SmartPtr<NLP>& nlp
186  );
188 
193  virtual bool OpenOutputFile(
194  std::string file_name,
195  EJournalLevel print_level
196  );
197 
202  {
203  return jnlst_;
204  }
205 
208  {
209  return reg_options_;
210  }
211 
214  {
215  return options_;
216  }
217 
220  {
221  return ConstPtr(options_);
222  }
223 
228 
231 
234 
237 
241 
249 
261  bool dorethrow
262  )
263  {
264  bool oldval = rethrow_nonipoptexception_;
265  rethrow_nonipoptexception_ = dorethrow;
266  return oldval;
267  }
268 
269  static void RegisterOptions(
271  );
272 
274  static void
276  const SmartPtr<RegisteredOptions>& roptions
277  );
278 
279 private:
290  const IpoptApplication&
291  );
292 
294  void operator=(
295  const IpoptApplication&
296  );
298 
304 
309 
313 
316 
319 
322 
327 
331 
337 
343 
349 
355 
360 
368 };
369 
370 } // namespace Ipopt
371 
373 
374 #endif
Ipopt::IpoptApplication::operator=
void operator=(const IpoptApplication &)
Default Assignment Operator.
Ipopt::IpoptApplication::RegisterOptions
static void RegisterOptions(SmartPtr< RegisteredOptions > roptions)
Ipopt::IpoptApplication::options_
SmartPtr< OptionsList > options_
OptionsList used for the application.
Definition: IpIpoptApplication.hpp:321
Ipopt::IpoptData
Class to organize all the data required by the algorithm.
Definition: IpIpoptData.hpp:98
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:201
Ipopt::IpoptApplication::nlp_adapter_
SmartPtr< NLP > nlp_adapter_
Pointer to the TNLPAdapter used to convert the TNLP to an NLP.
Definition: IpIpoptApplication.hpp:354
Ipopt::IpoptCalculatedQuantities
Class for all IPOPT specific calculated quantities.
Definition: IpIpoptCalculatedQuantities.hpp:89
Ipopt
This file contains a base class for all exceptions and a set of macros to help with exceptions.
Definition: IpInexactAlgBuilder.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:336
Ipopt::EJournalLevel
EJournalLevel
Print Level Enum.
Definition: IpJournalist.hpp:32
Ipopt::IpoptApplication::Options
virtual SmartPtr< OptionsList > Options()
Get the options list for setting options.
Definition: IpIpoptApplication.hpp:213
Ipopt::IpoptApplication::RegisterAllIpoptOptions
static void RegisterAllIpoptOptions(const SmartPtr< RegisteredOptions > &roptions)
Method to register all Ipopt options.
IPOPTLIB_EXPORT
#define IPOPTLIB_EXPORT
Definition: config_default.h:16
Ipopt::IpoptApplication::Initialize
virtual ApplicationReturnStatus Initialize(std::string params_file, bool allow_clobber=false)
Initialization method.
Ipopt::IpoptApplication::IpoptApplication
IpoptApplication(const IpoptApplication &)
Copy Constructor.
Ipopt::IpoptApplication::call_optimize
ApplicationReturnStatus call_optimize()
Method for the actual optimize call of the Ipopt algorithm.
Ipopt::RegisteredOptions
Class for storing registered options.
Definition: IpRegOptions.hpp:555
Ipopt::IpoptApplication::reg_options_
SmartPtr< RegisteredOptions > reg_options_
RegisteredOptions.
Definition: IpIpoptApplication.hpp:318
ApplicationReturnStatus
ApplicationReturnStatus
Return codes for the Optimize call for an application.
Definition: IpReturnCodes_inc.h:14
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:315
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:311
Ipopt::IpoptApplication::IpoptNLPObject
virtual SmartPtr< IpoptNLP > IpoptNLPObject()
Get the IpoptNLP Object.
Ipopt::IpoptApplication::IpoptDataObject
SmartPtr< IpoptData > IpoptDataObject()
Get the IpoptData Object.
IpTNLP.hpp
Ipopt::SmartPtr
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:172
Ipopt::IpoptApplication::Initialize
virtual ApplicationReturnStatus Initialize(bool allow_clobber=false)
Initialize method.
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:342
Ipopt::IpoptApplication
This is the main application class for making calls to Ipopt.
Definition: IpIpoptApplication.hpp:42
Ipopt::IpoptApplication::~IpoptApplication
virtual ~IpoptApplication()
Ipopt::IpoptApplication::statistics_
SmartPtr< SolveStatistics > statistics_
Object for storing statistics about the most recent optimization run.
Definition: IpIpoptApplication.hpp:326
Ipopt::IpoptApplication::ip_cq_
SmartPtr< IpoptCalculatedQuantities > ip_cq_
IpoptCalculatedQuantities Object for the NLP.
Definition: IpIpoptApplication.hpp:348
Ipopt::IpoptApplication::alg_
SmartPtr< IpoptAlgorithm > alg_
Object with the algorithm skeleton.
Definition: IpIpoptApplication.hpp:330
Ipopt::IpoptApplication::RethrowNonIpoptException
bool RethrowNonIpoptException(bool dorethrow)
Method to set whether non-ipopt non-bad_alloc exceptions are rethrown by Ipopt.
Definition: IpIpoptApplication.hpp:260
Ipopt::SolveStatistics
This class collects statistics about an optimization run, such as iteration count,...
Definition: IpSolveStatistics.hpp:27
Ipopt::ConstPtr
SmartPtr< const U > ConstPtr(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:665
Ipopt::IpoptApplication::Initialize
virtual ApplicationReturnStatus Initialize(const char *params_file, bool allow_clobber=false)
Initialization method.
Definition: IpIpoptApplication.hpp:122
Ipopt::IpoptApplication::inexact_algorithm_
bool inexact_algorithm_
Flag indicating if we are to use the inexact linear solver option.
Definition: IpIpoptApplication.hpp:359
Ipopt::IpoptApplication::IpoptCQObject
virtual SmartPtr< IpoptCalculatedQuantities > IpoptCQObject()
Get the IpoptCQ Object.
Ipopt::IpoptAlgorithm
The main ipopt algorithm class.
Definition: IpIpoptAlg.hpp:45
Ipopt::IpoptApplication::OptimizeNLP
virtual ApplicationReturnStatus OptimizeNLP(const SmartPtr< NLP > &nlp, SmartPtr< AlgorithmBuilder > &alg_builder)
Solve a problem that inherits from NLP.
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:207
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:308
Ipopt::IpoptApplication::replace_bounds_
bool replace_bounds_
Flag indicating if all bounds should be replaced by inequality constraints.
Definition: IpIpoptApplication.hpp:366
Ipopt::IpoptApplication::PrintCopyrightMessage
void PrintCopyrightMessage()
Method for printing Ipopt copyright message now instead of just before the optimization.
IpoptApplicationFactory
IPOPTLIB_EXPORT class Ipopt::IpoptApplication * IpoptApplicationFactory()
Ipopt::DECLARE_STD_EXCEPTION
DECLARE_STD_EXCEPTION(FATAL_ERROR_IN_LINEAR_SOLVER)
Ipopt::AlgorithmBuilder
Builder for creating a complete IpoptAlg object.
Definition: IpAlgBuilder.hpp:49
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:219
Ipopt::IpoptApplication::OptimizeTNLP
virtual ApplicationReturnStatus OptimizeTNLP(const SmartPtr< TNLP > &tnlp)
Solve a problem that inherits from TNLP.
Ipopt::OptionsList
This class stores a list of user set options.
Definition: IpOptionsList.hpp:33
Ipopt::ReferencedObject
Storing the reference count of all the smart pointers that currently reference it.
Definition: IpReferenced.hpp:170
Ipopt::IpoptApplication::IpoptApplication
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...
Ipopt::IpoptNLP
This is the abstract base class for classes that map the traditional NLP into something that is more ...
Definition: IpIpoptNLP.hpp:28