Ipopt  3.12.12
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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 // $Id: IpAlgStrategy.hpp 1861 2010-12-21 21:34:47Z andreasw $
6 //
7 // Authors: Carl Laird, Andreas Waechter IBM 2004-08-13
8 
9 #ifndef __IPALGSTRATEGY_HPP__
10 #define __IPALGSTRATEGY_HPP__
11 
12 #include "IpOptionsList.hpp"
13 #include "IpJournalist.hpp"
15 #include "IpIpoptNLP.hpp"
16 #include "IpIpoptData.hpp"
17 
18 namespace Ipopt
19 {
20 
36  {
37  public:
42  :
43  initialize_called_(false)
44  {}
45 
48  {}
50 
66  bool Initialize(const Journalist& jnlst,
67  IpoptNLP& ip_nlp,
68  IpoptData& ip_data,
70  const OptionsList& options,
71  const std::string& prefix)
72  {
73  initialize_called_ = true;
74  // Copy the pointers for the problem defining objects
75  jnlst_ = &jnlst;
76  ip_nlp_ = &ip_nlp;
77  ip_data_ = &ip_data;
78  ip_cq_ = &ip_cq;
79 
80  bool retval = InitializeImpl(options, prefix);
81  if (!retval) {
82  initialize_called_ = false;
83  }
84 
85  return retval;
86  }
87 
92  bool ReducedInitialize(const Journalist& jnlst,
93  const OptionsList& options,
94  const std::string& prefix)
95  {
96  initialize_called_ = true;
97  // Copy the pointers for the problem defining objects
98  jnlst_ = &jnlst;
99  ip_nlp_ = NULL;
100  ip_data_ = NULL;
101  ip_cq_ = NULL;
102 
103  bool retval = InitializeImpl(options, prefix);
104  if (!retval) {
105  initialize_called_ = false;
106  }
107 
108  return retval;
109  }
110 
111  protected:
114  virtual bool InitializeImpl(const OptionsList& options,
115  const std::string& prefix)=0;
116 
120  const Journalist& Jnlst() const
121  {
123  return *jnlst_;
124  }
125  IpoptNLP& IpNLP() const
126  {
129  return *ip_nlp_;
130  }
131  IpoptData& IpData() const
132  {
135  return *ip_data_;
136  }
138  {
141  return *ip_cq_;
142  }
143  bool HaveIpData() const
144  {
145  return IsValid(ip_data_);
146  }
148 
149  private:
159  //AlgorithmStrategyObject();
160 
161 
164 
166  void operator=(const AlgorithmStrategyObject&);
168 
177 
181  };
182 
183 } // namespace Ipopt
184 
185 #endif
bool IsValid(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:579
virtual ~AlgorithmStrategyObject()
Default Destructor.
Class for all IPOPT specific calculated quantities.
SmartPtr< IpoptNLP > ip_nlp_
This is the base class for all algorithm strategy objects.
AlgorithmStrategyObject()
Default Constructor.
void operator=(const AlgorithmStrategyObject &)
Overloaded Equals Operator.
SmartPtr< IpoptData > ip_data_
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:172
ReferencedObject class.
This class stores a list of user set options.
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...
Class to organize all the data required by the algorithm.
Definition: IpIpoptData.hpp:83
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.
#define DBG_ASSERT(test)
Definition: IpDebug.hpp:38
SmartPtr< const Journalist > jnlst_
virtual bool InitializeImpl(const OptionsList &options, const std::string &prefix)=0
Implementation of the initialization method that has to be overloaded by for each derived class...
Class responsible for all message output.
bool initialize_called_
flag indicating if Initialize method has been called (for debugging)
This is the abstract base class for classes that map the traditional NLP into something that is more ...
Definition: IpIpoptNLP.hpp:28
SmartPtr< IpoptCalculatedQuantities > ip_cq_
IpoptCalculatedQuantities & IpCq() const
const Journalist & Jnlst() const