Ipopt 3.11.9
Loading...
Searching...
No Matches
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 2476 2014-04-08 09:41:07Z 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
17namespace Ipopt
18{
19
23 {
24 public:
29
33
37 bool Initialize(const Journalist& jnlst,
38 const OptionsList& options,
39 const std::string& prefix);
40
43
46
52
60
63
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 {
85 }
86 void SetHaveCgFastDeltas(bool have_cgfast_deltas)
87 {
88 have_cgfast_deltas_ = have_cgfast_deltas;
89 }
91
98
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 }
116
118 {
119 return restor_iter_;
120 }
121
127 {
128 return restor_counter_;
129 }
134
135 void SetPrimalStepSize(Number max_alpha_x)
136 {
137 max_alpha_x_ = max_alpha_x;
138 }
140 {
141 return max_alpha_x_;
142 }
143
145 {
147 return curr_penalty_;
148 }
149 void Set_penalty(Number penalty)
150 {
151 curr_penalty_ = penalty;
153 }
155 {
156 penalty_initialized_ = false;
157 }
159 {
161 }
167 void Set_kkt_penalty(Number kkt_penalty)
168 {
169 curr_kkt_penalty_ = kkt_penalty;
171 }
177 {
179 }
180
181
182 private:
183
197
211
216
220
229
233
244
248
249#if COIN_IPOPT_CHECKLEVEL > 0
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
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
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
281 {
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
300 {
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
319 {
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
#define DBG_ASSERT(test)
Definition IpDebug.hpp:38
Class to organize all the additional data required by the Chen-Goldfarb penalty function algorithm.
void SetHaveCgPenDeltas(bool have_cgpen_deltas)
bool InitializeDataStructures()
Initialize Data Structures.
~CGPenaltyData()
Default destructor.
SmartPtr< const IteratesVector > delta_cgfast_
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...
SmartPtr< const IteratesVector > delta_cgpen() const
Delta for the Chen-Goldfarb search direction.
CGPenaltyData()
Constructor.
void Set_kkt_penalty(Number kkt_penalty)
bool never_try_pure_Newton_
Flag indicating whether the pure Newton method is used.
bool KKTPenaltyInitialized() const
bool PenaltyInitialized() const
void Set_penalty(Number penalty)
void SetNeverTryPureNewton(bool never_try_pure_Newton)
CGPenaltyData(const CGPenaltyData &)
Copy Constructor.
SmartPtr< const IteratesVector > delta_cgpen_
void SetCurrPenaltyPert(Number curr_penalty_pert)
void SetRestorCounter(Number restor_counter)
Index restor_iter_
The iteration at which pure Newton method is given up.
void AcceptTrialPoint()
Set the current iterate values from the trial values.
void SetPrimalStepSize(Number max_alpha_x)
bool have_cgpen_deltas_
The following flag is set to true, if some other part of the algorithm has already computed the Chen-...
Number curr_penalty() const
bool Initialize(const Journalist &jnlst, const OptionsList &options, const std::string &prefix)
This method must be called to initialize the global algorithmic parameters.
bool have_cgfast_deltas_
The following flag is set to true, if some other part of the algorithm has already computed the fast ...
void SetRestorIter(Index restor_iter)
bool HaveCgFastDeltas() const
SmartPtr< const IteratesVector > delta_cgfast() const
Delta for the fast Chen-Goldfarb search direction.
bool initialize_called_
flag indicating if Initialize method has been called (for debugging)
void SetHaveCgFastDeltas(bool have_cgfast_deltas)
Number curr_kkt_penalty() const
void operator=(const CGPenaltyData &)
Overloaded Equals Operator.
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...
Base class for additional data that is special to a particular type of algorithm, such as the CG pena...
Class responsible for all message output.
This class stores a list of user set options.
Template class for Smart Pointers.
unsigned int Tag
Type for the Tag values.
SmartPtr< const U > ConstPtr(const SmartPtr< U > &smart_ptr)
bool IsValid(const SmartPtr< U > &smart_ptr)
int Index
Type of all indices of vectors, matrices etc.
Definition IpTypes.hpp:19
bool IsNull(const SmartPtr< U > &smart_ptr)
double Number
Type of all numbers.
Definition IpTypes.hpp:17