Ipopt 3.12.10

- Main Page
- Classes
- Files

- File List
- File Members

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"
14 #include "IpIpoptCalculatedQuantities.hpp"
15 #include "IpIpoptNLP.hpp"
16 #include "IpIpoptData.hpp"
17
18 namespace Ipopt
19 {
20
35 class AlgorithmStrategyObject : public ReferencedObject
36 {
37 public:
41 AlgorithmStrategyObject()
42 :
43 initialize_called_(false)
44 {}
45
47 virtual ~AlgorithmStrategyObject()
48 {}
50
66 bool Initialize(const Journalist& jnlst,
67 IpoptNLP& ip_nlp,
68 IpoptData& ip_data,
69 IpoptCalculatedQuantities& ip_cq,
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 {
122 DBG_ASSERT(initialize_called_);
123 return *jnlst_;
124 }
125 IpoptNLP& IpNLP() const
126 {
127 DBG_ASSERT(initialize_called_);
128 DBG_ASSERT(IsValid(ip_nlp_));
129 return *ip_nlp_;
130 }
131 IpoptData& IpData() const
132 {
133 DBG_ASSERT(initialize_called_);
134 DBG_ASSERT(IsValid(ip_data_));
135 return *ip_data_;
136 }
137 IpoptCalculatedQuantities& IpCq() const
138 {
139 DBG_ASSERT(initialize_called_);
140 DBG_ASSERT(IsValid(ip_cq_));
141 return *ip_cq_;
142 }
143 bool HaveIpData() const
144 {
145 return IsValid(ip_data_);
146 }
148
149 private:
159 //AlgorithmStrategyObject();
160
161
163 AlgorithmStrategyObject(const AlgorithmStrategyObject&);
164
166 void operator=(const AlgorithmStrategyObject&);
168
172 SmartPtr<const Journalist> jnlst_;
173 SmartPtr<IpoptNLP> ip_nlp_;
174 SmartPtr<IpoptData> ip_data_;
175 SmartPtr<IpoptCalculatedQuantities> ip_cq_;
177
180 bool initialize_called_;
181 };
182
183 } // namespace Ipopt
184
185 #endif
Ipopt::IsValid
bool IsValid(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:579
Ipopt::AlgorithmStrategyObject::~AlgorithmStrategyObject
virtual ~AlgorithmStrategyObject()
Default Destructor.
Definition: IpAlgStrategy.hpp:47
Ipopt::IpoptCalculatedQuantities
Class for all IPOPT specific calculated quantities.
Definition: IpIpoptCalculatedQuantities.hpp:81
Ipopt::AlgorithmStrategyObject::ip_nlp_
SmartPtr< IpoptNLP > ip_nlp_
Definition: IpAlgStrategy.hpp:173
IpIpoptNLP.hpp
Ipopt::AlgorithmStrategyObject
This is the base class for all algorithm strategy objects.
Definition: IpAlgStrategy.hpp:35
Ipopt::AlgorithmStrategyObject::AlgorithmStrategyObject
AlgorithmStrategyObject()
Default Constructor.
Definition: IpAlgStrategy.hpp:41
IpIpoptCalculatedQuantities.hpp
Ipopt::AlgorithmStrategyObject::operator=
void operator=(const AlgorithmStrategyObject &)
Overloaded Equals Operator.
Ipopt::AlgorithmStrategyObject::IpNLP
IpoptNLP & IpNLP() const
Definition: IpAlgStrategy.hpp:125
Ipopt::AlgorithmStrategyObject::ip_data_
SmartPtr< IpoptData > ip_data_
Definition: IpAlgStrategy.hpp:174
Ipopt::SmartPtr
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:172
Ipopt::ReferencedObject
ReferencedObject class.
Definition: IpReferenced.hpp:174
Ipopt::OptionsList
This class stores a list of user set options.
Definition: IpOptionsList.hpp:32
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::IpoptData
Class to organize all the data required by the algorithm.
Definition: IpIpoptData.hpp:83
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:92
DBG_ASSERT
#define DBG_ASSERT(test)
Definition: IpDebug.hpp:38
IpOptionsList.hpp
Ipopt::AlgorithmStrategyObject::jnlst_
SmartPtr< const Journalist > jnlst_
Definition: IpAlgStrategy.hpp:172
Ipopt::AlgorithmStrategyObject::InitializeImpl
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...
IpJournalist.hpp
Ipopt::Journalist
Class responsible for all message output.
Definition: IpJournalist.hpp:134
Ipopt::AlgorithmStrategyObject::IpData
IpoptData & IpData() const
Definition: IpAlgStrategy.hpp:131
Ipopt::AlgorithmStrategyObject::initialize_called_
bool initialize_called_
flag indicating if Initialize method has been called (for debugging)
Definition: IpAlgStrategy.hpp:180
Ipopt::IpoptNLP
This is the abstract base class for classes that map the traditional NLP into something that is more ...
Definition: IpIpoptNLP.hpp:28
Ipopt::AlgorithmStrategyObject::ip_cq_
SmartPtr< IpoptCalculatedQuantities > ip_cq_
Definition: IpAlgStrategy.hpp:175
Ipopt::AlgorithmStrategyObject::IpCq
IpoptCalculatedQuantities & IpCq() const
Definition: IpAlgStrategy.hpp:137
IpIpoptData.hpp
Ipopt::AlgorithmStrategyObject::HaveIpData
bool HaveIpData() const
Definition: IpAlgStrategy.hpp:143
Ipopt::AlgorithmStrategyObject::Jnlst
const Journalist & Jnlst() const
Definition: IpAlgStrategy.hpp:120