Ipopt Documentation  
IpAlgStrategy.hpp
Go to the documentation of this file.
1 // Copyright (C) 2004, 2006 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 __IPALGSTRATEGY_HPP__
8 #define __IPALGSTRATEGY_HPP__
9 
10 #include "IpOptionsList.hpp"
11 #include "IpJournalist.hpp"
13 #include "IpIpoptNLP.hpp"
14 #include "IpIpoptData.hpp"
15 
16 namespace Ipopt
17 {
18 
35 {
36 public:
41  : initialize_called_(false)
42  { }
43 
46  { }
48 
66  bool Initialize(
67  const Journalist& jnlst,
68  IpoptNLP& ip_nlp,
69  IpoptData& ip_data,
71  const OptionsList& options,
72  const std::string& prefix
73  )
74  {
75  initialize_called_ = true;
76  // Copy the pointers for the problem defining objects
77  jnlst_ = &jnlst;
78  ip_nlp_ = &ip_nlp;
79  ip_data_ = &ip_data;
80  ip_cq_ = &ip_cq;
81 
82  bool retval = InitializeImpl(options, prefix);
83  if( !retval )
84  {
85  initialize_called_ = false;
86  }
87 
88  return retval;
89  }
90 
98  const Journalist& jnlst,
99  const OptionsList& options,
100  const std::string& prefix
101  )
102  {
103  initialize_called_ = true;
104  // Copy the pointers for the problem defining objects
105  jnlst_ = &jnlst;
106  ip_nlp_ = NULL;
107  ip_data_ = NULL;
108  ip_cq_ = NULL;
109 
110  bool retval = InitializeImpl(options, prefix);
111  if( !retval )
112  {
113  initialize_called_ = false;
114  }
115 
116  return retval;
117  }
118 
119 protected:
123  virtual bool InitializeImpl(
124  const OptionsList& options,
125  const std::string& prefix
126  ) = 0;
127 
133  const Journalist& Jnlst() const
134  {
135  DBG_ASSERT(initialize_called_);
136  return *jnlst_;
137  }
138  IpoptNLP& IpNLP() const
139  {
140  DBG_ASSERT(initialize_called_);
141  DBG_ASSERT(IsValid(ip_nlp_));
142  return *ip_nlp_;
143  }
144  IpoptData& IpData() const
145  {
146  DBG_ASSERT(initialize_called_);
147  DBG_ASSERT(IsValid(ip_data_));
148  return *ip_data_;
149  }
151  {
152  DBG_ASSERT(initialize_called_);
153  DBG_ASSERT(IsValid(ip_cq_));
154  return *ip_cq_;
155  }
156  bool HaveIpData() const
157  {
158  return IsValid(ip_data_);
159  }
161 
162 private:
174  //AlgorithmStrategyObject();
175 
179  );
180 
182  void operator=(
184  );
186 
194 
197 };
198 
199 } // namespace Ipopt
200 
201 #endif
Ipopt::AlgorithmStrategyObject::~AlgorithmStrategyObject
virtual ~AlgorithmStrategyObject()
Destructor.
Definition: IpAlgStrategy.hpp:45
Ipopt::IpoptData
Class to organize all the data required by the algorithm.
Definition: IpIpoptData.hpp:97
Ipopt::AlgorithmStrategyObject::IpCq
IpoptCalculatedQuantities & IpCq() const
Definition: IpAlgStrategy.hpp:150
Ipopt::IpoptCalculatedQuantities
Class for all IPOPT specific calculated quantities.
Definition: IpIpoptCalculatedQuantities.hpp:88
Ipopt::AlgorithmStrategyObject::Jnlst
const Journalist & Jnlst() const
Definition: IpAlgStrategy.hpp:133
IpOptionsList.hpp
Ipopt
This file contains a base class for all exceptions and a set of macros to help with exceptions.
Definition: IpInexactAlgBuilder.hpp:13
IpJournalist.hpp
Ipopt::AlgorithmStrategyObject::IpData
IpoptData & IpData() const
Definition: IpAlgStrategy.hpp:144
Ipopt::AlgorithmStrategyObject::IpNLP
IpoptNLP & IpNLP() const
Definition: IpAlgStrategy.hpp:138
IpIpoptCalculatedQuantities.hpp
IPOPTLIB_EXPORT
#define IPOPTLIB_EXPORT
Definition: config_default.h:16
Ipopt::AlgorithmStrategyObject::ip_nlp_
SmartPtr< IpoptNLP > ip_nlp_
Definition: IpAlgStrategy.hpp:190
Ipopt::AlgorithmStrategyObject::HaveIpData
bool HaveIpData() const
Definition: IpAlgStrategy.hpp:156
Ipopt::SmartPtr
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:171
IpIpoptData.hpp
Ipopt::AlgorithmStrategyObject::ReducedInitialize
bool ReducedInitialize(const Journalist &jnlst, const OptionsList &options, const std::string &prefix)
Reduced version of the Initialize method, which does not require special Ipopt information.
Definition: IpAlgStrategy.hpp:97
Ipopt::AlgorithmStrategyObject::jnlst_
SmartPtr< const Journalist > jnlst_
Definition: IpAlgStrategy.hpp:189
Ipopt::AlgorithmStrategyObject::AlgorithmStrategyObject
AlgorithmStrategyObject()
Default Constructor.
Definition: IpAlgStrategy.hpp:40
Ipopt::AlgorithmStrategyObject::ip_cq_
SmartPtr< IpoptCalculatedQuantities > ip_cq_
Definition: IpAlgStrategy.hpp:192
Ipopt::Journalist
Class responsible for all message output.
Definition: IpJournalist.hpp:116
Ipopt::AlgorithmStrategyObject
This is the base class for all algorithm strategy objects.
Definition: IpAlgStrategy.hpp:34
Ipopt::IsValid
bool IsValid(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:674
Ipopt::AlgorithmStrategyObject::Initialize
bool Initialize(const Journalist &jnlst, IpoptNLP &ip_nlp, IpoptData &ip_data, IpoptCalculatedQuantities &ip_cq, const OptionsList &options, const std::string &prefix)
This method is called every time the algorithm starts again - it is used to reset any internal state.
Definition: IpAlgStrategy.hpp:66
Ipopt::AlgorithmStrategyObject::ip_data_
SmartPtr< IpoptData > ip_data_
Definition: IpAlgStrategy.hpp:191
DBG_ASSERT
#define DBG_ASSERT(test)
Definition: IpDebug.hpp:28
Ipopt::OptionsList
This class stores a list of user set options.
Definition: IpOptionsList.hpp:32
Ipopt::AlgorithmStrategyObject::initialize_called_
bool initialize_called_
flag indicating if Initialize method has been called (for debugging)
Definition: IpAlgStrategy.hpp:196
IpIpoptNLP.hpp
Ipopt::ReferencedObject
Storing the reference count of all the smart pointers that currently reference it.
Definition: IpReferenced.hpp:169
Ipopt::IpoptNLP
This is the abstract base class for classes that map the traditional NLP into something that is more ...
Definition: IpIpoptNLP.hpp:27