Ipopt 3.12.10

- Main Page
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
IpCGPenaltyData.hpp
Go to the documentation of this file.
1 // Copyright (C) 2007, 2008 International Business Machines and others.
2 // All Rights Reserved.
3 // This code is published under the Eclipse Public License.
4 //
5 // $Id: IpCGPenaltyData.hpp 2472 2014-04-05 17:47:20Z stefan $
6 //
7 // Authors: Andreas Waechter IBM 2007-06-04
8 // based on IpIpoptData.hpp
9
10 #ifndef __IPCGPENALTYDATA_HPP__
11 #define __IPCGPENALTYDATA_HPP__
12
13 #include "IpIteratesVector.hpp"
14 #include "IpOptionsList.hpp"
15 #include "IpIpoptData.hpp"
16
17 namespace Ipopt
18 {
19
22 class CGPenaltyData : public IpoptAdditionalData
23 {
24 public:
28 CGPenaltyData();
29
31 ~CGPenaltyData();
33
37 bool Initialize(const Journalist& jnlst,
38 const OptionsList& options,
39 const std::string& prefix);
40
42 bool InitializeDataStructures();
43
45 SmartPtr<const IteratesVector> delta_cgpen() const;
46
51 void set_delta_cgpen(SmartPtr<IteratesVector>& delta_pen);
52
59 void set_delta_cgpen(SmartPtr<const IteratesVector>& delta_pen);
60
62 SmartPtr<const IteratesVector> delta_cgfast() const;
63
68 void set_delta_cgfast(SmartPtr<IteratesVector>& delta_fast);
69
73 bool HaveCgPenDeltas() const
74 {
75 return have_cgpen_deltas_;
76 }
77 void SetHaveCgPenDeltas(bool have_cgpen_deltas)
78 {
79 have_cgpen_deltas_ = have_cgpen_deltas;
80 }
81
82 bool HaveCgFastDeltas() const
83 {
84 return have_cgfast_deltas_;
85 }
86 void SetHaveCgFastDeltas(bool have_cgfast_deltas)
87 {
88 have_cgfast_deltas_ = have_cgfast_deltas;
89 }
91
96 void AcceptTrialPoint();
98
99 Number CurrPenaltyPert()
100 {
101 return curr_penalty_pert_;
102 }
103 void SetCurrPenaltyPert(Number curr_penalty_pert)
104 {
105 curr_penalty_pert_ = curr_penalty_pert;
106 }
107
108 void SetNeverTryPureNewton(bool never_try_pure_Newton)
109 {
110 never_try_pure_Newton_ = never_try_pure_Newton;
111 }
112 Index NeverTryPureNewton()
113 {
114 return never_try_pure_Newton_;
115 }
116
117 Index restor_iter()
118 {
119 return restor_iter_;
120 }
121
122 void SetRestorIter(Index restor_iter)
123 {
124 restor_iter_ = restor_iter;
125 }
126 Number restor_counter()
127 {
128 return restor_counter_;
129 }
130 void SetRestorCounter(Number restor_counter)
131 {
132 restor_counter_ = restor_counter;
133 }
134
135 void SetPrimalStepSize(Number max_alpha_x)
136 {
137 max_alpha_x_ = max_alpha_x;
138 }
139 Number PrimalStepSize()
140 {
141 return max_alpha_x_;
142 }
143
144 Number curr_penalty() const
145 {
146 DBG_ASSERT(penalty_initialized_);
147 return curr_penalty_;
148 }
149 void Set_penalty(Number penalty)
150 {
151 curr_penalty_ = penalty;
152 penalty_initialized_ = true;
153 }
154 void SetPenaltyUninitialized()
155 {
156 penalty_initialized_ = false;
157 }
158 bool PenaltyInitialized() const
159 {
160 return penalty_initialized_;
161 }
162 Number curr_kkt_penalty() const
163 {
164 DBG_ASSERT(kkt_penalty_initialized_);
165 return curr_kkt_penalty_;
166 }
167 void Set_kkt_penalty(Number kkt_penalty)
168 {
169 curr_kkt_penalty_ = kkt_penalty;
170 kkt_penalty_initialized_ = true;
171 }
172 void SetKKTPenaltyUninitialized()
173 {
174 kkt_penalty_initialized_ = false;
175 }
176 bool KKTPenaltyInitialized() const
177 {
178 return kkt_penalty_initialized_;
179 }
180
181
182 private:
183
189 SmartPtr<const IteratesVector> delta_cgpen_;
195 bool have_cgpen_deltas_;
197
203 SmartPtr<const IteratesVector> delta_cgfast_;
209 bool have_cgfast_deltas_;
211
215 bool never_try_pure_Newton_;
216
218 Index restor_iter_;
219 Number restor_counter_;
220
222 Number curr_penalty_;
223 bool penalty_initialized_;
224 Number curr_kkt_penalty_;
225 bool kkt_penalty_initialized_;
226 Number curr_penalty_pert_;
227 Number max_alpha_x_;
229
232 bool initialize_called_;
233
243 CGPenaltyData(const CGPenaltyData&);
244
246 void operator=(const CGPenaltyData&);
248
249 #if COIN_IPOPT_CHECKLEVEL > 0
250
254 TaggedObject::Tag debug_delta_cgpen_tag_;
255 TaggedObject::Tag debug_delta_cgfast_tag_;
256 TaggedObject::Tag debug_delta_cgpen_tag_sum_;
257 TaggedObject::Tag debug_delta_cgfast_tag_sum_;
259 #endif
260
261 };
262
263 inline
264 SmartPtr<const IteratesVector> CGPenaltyData::delta_cgpen() const
265 {
266 DBG_ASSERT(IsNull(delta_cgpen_) || (delta_cgpen_->GetTag() == debug_delta_cgpen_tag_ && delta_cgpen_->GetTagSum() == debug_delta_cgpen_tag_sum_) );
267
268 return delta_cgpen_;
269 }
270
271 inline
272 SmartPtr<const IteratesVector> CGPenaltyData::delta_cgfast() const
273 {
274 DBG_ASSERT(IsNull(delta_cgfast_) || (delta_cgfast_->GetTag() == debug_delta_cgfast_tag_ && delta_cgfast_->GetTagSum() == debug_delta_cgfast_tag_sum_) );
275
276 return delta_cgfast_;
277 }
278
279 inline
280 void CGPenaltyData::set_delta_cgpen(SmartPtr<IteratesVector>& delta_cgpen)
281 {
282 delta_cgpen_ = ConstPtr(delta_cgpen);
283 #if COIN_IPOPT_CHECKLEVEL > 0
284
285 if (IsValid(delta_cgpen)) {
286 debug_delta_cgpen_tag_ = delta_cgpen->GetTag();
287 debug_delta_cgpen_tag_sum_ = delta_cgpen->GetTagSum();
288 }
289 else {
290 debug_delta_cgpen_tag_ = 0;
291 debug_delta_cgpen_tag_sum_ = delta_cgpen->GetTagSum();
292 }
293 #endif
294
295 delta_cgpen = NULL;
296 }
297
298 inline
299 void CGPenaltyData::set_delta_cgpen(SmartPtr<const IteratesVector>& delta_cgpen)
300 {
301 delta_cgpen_ = delta_cgpen;
302 #if COIN_IPOPT_CHECKLEVEL > 0
303
304 if (IsValid(delta_cgpen)) {
305 debug_delta_cgpen_tag_ = delta_cgpen->GetTag();
306 debug_delta_cgpen_tag_sum_ = delta_cgpen->GetTagSum();
307 }
308 else {
309 debug_delta_cgpen_tag_ = 0;
310 debug_delta_cgpen_tag_sum_ = delta_cgpen->GetTagSum();
311 }
312 #endif
313
314 delta_cgpen = NULL;
315 }
316
317 inline
318 void CGPenaltyData::set_delta_cgfast(SmartPtr<IteratesVector>& delta_cgfast)
319 {
320 delta_cgfast_ = ConstPtr(delta_cgfast);
321 #if COIN_IPOPT_CHECKLEVEL > 0
322
323 if (IsValid(delta_cgfast)) {
324 debug_delta_cgfast_tag_ = delta_cgfast->GetTag();
325 debug_delta_cgfast_tag_sum_ = delta_cgfast->GetTagSum();
326 }
327 else {
328 debug_delta_cgfast_tag_ = 0;
329 debug_delta_cgfast_tag_sum_ = delta_cgfast->GetTagSum();
330 }
331 #endif
332
333 delta_cgfast = NULL;
334 }
335
336 } // namespace Ipopt
337
338 #endif
Ipopt::CGPenaltyData::initialize_called_
bool initialize_called_
flag indicating if Initialize method has been called (for debugging)
Definition: IpCGPenaltyData.hpp:232
Ipopt::IsValid
bool IsValid(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:579
Ipopt::CGPenaltyData::never_try_pure_Newton_
bool never_try_pure_Newton_
Flag indicating whether the pure Newton method is used.
Definition: IpCGPenaltyData.hpp:215
Ipopt::CGPenaltyData::SetPrimalStepSize
void SetPrimalStepSize(Number max_alpha_x)
Definition: IpCGPenaltyData.hpp:135
IpIteratesVector.hpp
Ipopt::CGPenaltyData::SetRestorIter
void SetRestorIter(Index restor_iter)
Definition: IpCGPenaltyData.hpp:122
Ipopt::CGPenaltyData::Initialize
bool Initialize(const Journalist &jnlst, const OptionsList &options, const std::string &prefix)
This method must be called to initialize the global algorithmic parameters.
Ipopt::CGPenaltyData::kkt_penalty_initialized_
bool kkt_penalty_initialized_
Definition: IpCGPenaltyData.hpp:225
Ipopt::CGPenaltyData::AcceptTrialPoint
void AcceptTrialPoint()
Set the current iterate values from the trial values.
Ipopt::Number
double Number
Type of all numbers.
Definition: IpTypes.hpp:17
Ipopt::CGPenaltyData::CurrPenaltyPert
Number CurrPenaltyPert()
Definition: IpCGPenaltyData.hpp:99
Ipopt::CGPenaltyData::delta_cgfast
SmartPtr< const IteratesVector > delta_cgfast() const
Delta for the fast Chen-Goldfarb search direction.
Definition: IpCGPenaltyData.hpp:272
Ipopt::CGPenaltyData::delta_cgfast_
SmartPtr< const IteratesVector > delta_cgfast_
Definition: IpCGPenaltyData.hpp:203
Ipopt::IsNull
bool IsNull(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:585
Ipopt::CGPenaltyData::restor_counter_
Number restor_counter_
Definition: IpCGPenaltyData.hpp:219
Ipopt::CGPenaltyData::SetHaveCgFastDeltas
void SetHaveCgFastDeltas(bool have_cgfast_deltas)
Definition: IpCGPenaltyData.hpp:86
Ipopt::CGPenaltyData::curr_penalty
Number curr_penalty() const
Definition: IpCGPenaltyData.hpp:144
Ipopt::CGPenaltyData::PenaltyInitialized
bool PenaltyInitialized() const
Definition: IpCGPenaltyData.hpp:158
Ipopt::SmartPtr
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:172
Ipopt::OptionsList
This class stores a list of user set options.
Definition: IpOptionsList.hpp:32
Ipopt::CGPenaltyData
Class to organize all the additional data required by the Chen-Goldfarb penalty function algorithm...
Definition: IpCGPenaltyData.hpp:22
Ipopt::CGPenaltyData::NeverTryPureNewton
Index NeverTryPureNewton()
Definition: IpCGPenaltyData.hpp:112
Ipopt::CGPenaltyData::curr_penalty_
Number curr_penalty_
Definition: IpCGPenaltyData.hpp:222
Ipopt::CGPenaltyData::restor_counter
Number restor_counter()
Definition: IpCGPenaltyData.hpp:126
Ipopt::CGPenaltyData::curr_penalty_pert_
Number curr_penalty_pert_
Definition: IpCGPenaltyData.hpp:226
Ipopt::CGPenaltyData::Set_penalty
void Set_penalty(Number penalty)
Definition: IpCGPenaltyData.hpp:149
Ipopt::CGPenaltyData::set_delta_cgfast
void set_delta_cgfast(SmartPtr< IteratesVector > &delta_fast)
Set the delta_cgpen - like the trial point, this method copies the pointer for efficiency (no copy an...
Definition: IpCGPenaltyData.hpp:318
Ipopt::CGPenaltyData::have_cgpen_deltas_
bool have_cgpen_deltas_
The following flag is set to true, if some other part of the algorithm has already computed the Chen-...
Definition: IpCGPenaltyData.hpp:195
Ipopt::CGPenaltyData::delta_cgpen_
SmartPtr< const IteratesVector > delta_cgpen_
Definition: IpCGPenaltyData.hpp:189
Ipopt::CGPenaltyData::max_alpha_x_
Number max_alpha_x_
Definition: IpCGPenaltyData.hpp:227
Ipopt::CGPenaltyData::SetRestorCounter
void SetRestorCounter(Number restor_counter)
Definition: IpCGPenaltyData.hpp:130
Ipopt::CGPenaltyData::SetPenaltyUninitialized
void SetPenaltyUninitialized()
Definition: IpCGPenaltyData.hpp:154
Ipopt::Index
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:19
Ipopt::CGPenaltyData::SetCurrPenaltyPert
void SetCurrPenaltyPert(Number curr_penalty_pert)
Definition: IpCGPenaltyData.hpp:103
Ipopt::CGPenaltyData::delta_cgpen
SmartPtr< const IteratesVector > delta_cgpen() const
Delta for the Chen-Goldfarb search direction.
Definition: IpCGPenaltyData.hpp:264
Ipopt::CGPenaltyData::SetKKTPenaltyUninitialized
void SetKKTPenaltyUninitialized()
Definition: IpCGPenaltyData.hpp:172
Ipopt::CGPenaltyData::curr_kkt_penalty_
Number curr_kkt_penalty_
Definition: IpCGPenaltyData.hpp:224
Ipopt::CGPenaltyData::KKTPenaltyInitialized
bool KKTPenaltyInitialized() const
Definition: IpCGPenaltyData.hpp:176
DBG_ASSERT
#define DBG_ASSERT(test)
Definition: IpDebug.hpp:38
Ipopt::CGPenaltyData::set_delta_cgpen
void set_delta_cgpen(SmartPtr< IteratesVector > &delta_pen)
Set the delta_cgpen - like the trial point, this method copies the pointer for efficiency (no copy an...
Definition: IpCGPenaltyData.hpp:280
IpOptionsList.hpp
Ipopt::TaggedObject::Tag
unsigned int Tag
Type for the Tag values.
Definition: IpTaggedObject.hpp:80
Ipopt::CGPenaltyData::~CGPenaltyData
~CGPenaltyData()
Default destructor.
Ipopt::ConstPtr
SmartPtr< const U > ConstPtr(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:572
Ipopt::CGPenaltyData::curr_kkt_penalty
Number curr_kkt_penalty() const
Definition: IpCGPenaltyData.hpp:162
Ipopt::CGPenaltyData::HaveCgFastDeltas
bool HaveCgFastDeltas() const
Definition: IpCGPenaltyData.hpp:82
Ipopt::CGPenaltyData::restor_iter
Index restor_iter()
Definition: IpCGPenaltyData.hpp:117
Ipopt::Journalist
Class responsible for all message output.
Definition: IpJournalist.hpp:134
Ipopt::CGPenaltyData::InitializeDataStructures
bool InitializeDataStructures()
Initialize Data Structures.
Ipopt::CGPenaltyData::HaveCgPenDeltas
bool HaveCgPenDeltas() const
Definition: IpCGPenaltyData.hpp:73
Ipopt::CGPenaltyData::SetNeverTryPureNewton
void SetNeverTryPureNewton(bool never_try_pure_Newton)
Definition: IpCGPenaltyData.hpp:108
Ipopt::CGPenaltyData::penalty_initialized_
bool penalty_initialized_
Definition: IpCGPenaltyData.hpp:223
Ipopt::CGPenaltyData::restor_iter_
Index restor_iter_
The iteration at which pure Newton method is given up.
Definition: IpCGPenaltyData.hpp:218
Ipopt::CGPenaltyData::have_cgfast_deltas_
bool have_cgfast_deltas_
The following flag is set to true, if some other part of the algorithm has already computed the fast ...
Definition: IpCGPenaltyData.hpp:209
Ipopt::CGPenaltyData::SetHaveCgPenDeltas
void SetHaveCgPenDeltas(bool have_cgpen_deltas)
Definition: IpCGPenaltyData.hpp:77
Ipopt::CGPenaltyData::PrimalStepSize
Number PrimalStepSize()
Definition: IpCGPenaltyData.hpp:139
Ipopt::IpoptAdditionalData
Base class for additional data that is special to a particular type of algorithm, such as the CG pena...
Definition: IpIpoptData.hpp:28
Ipopt::CGPenaltyData::operator=
void operator=(const CGPenaltyData &)
Overloaded Equals Operator.
IpIpoptData.hpp
Ipopt::CGPenaltyData::Set_kkt_penalty
void Set_kkt_penalty(Number kkt_penalty)
Definition: IpCGPenaltyData.hpp:167
Ipopt::CGPenaltyData::CGPenaltyData
CGPenaltyData()
Constructor.