Ipopt  3.12.12
 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 
23  {
24  public:
28  CGPenaltyData();
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  {
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 
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  }
113  {
114  return never_try_pure_Newton_;
115  }
116 
118  {
119  return restor_iter_;
120  }
121 
123  {
125  }
127  {
128  return restor_counter_;
129  }
131  {
133  }
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;
152  penalty_initialized_ = true;
153  }
155  {
156  penalty_initialized_ = false;
157  }
158  bool PenaltyInitialized() const
159  {
160  return penalty_initialized_;
161  }
163  {
165  return curr_kkt_penalty_;
166  }
167  void Set_kkt_penalty(Number kkt_penalty)
168  {
169  curr_kkt_penalty_ = kkt_penalty;
171  }
173  {
174  kkt_penalty_initialized_ = false;
175  }
177  {
179  }
180 
181 
182  private:
183 
197 
211 
216 
220 
229 
233 
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
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  {
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
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  {
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
bool initialize_called_
flag indicating if Initialize method has been called (for debugging)
bool IsValid(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:579
bool never_try_pure_Newton_
Flag indicating whether the pure Newton method is used.
void SetPrimalStepSize(Number max_alpha_x)
void SetRestorIter(Index restor_iter)
bool Initialize(const Journalist &jnlst, const OptionsList &options, const std::string &prefix)
This method must be called to initialize the global algorithmic parameters.
void AcceptTrialPoint()
Set the current iterate values from the trial values.
double Number
Type of all numbers.
Definition: IpTypes.hpp:17
SmartPtr< const IteratesVector > delta_cgfast() const
Delta for the fast Chen-Goldfarb search direction.
SmartPtr< const IteratesVector > delta_cgfast_
bool IsNull(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:585
void SetHaveCgFastDeltas(bool have_cgfast_deltas)
Number curr_penalty() const
bool PenaltyInitialized() const
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:172
This class stores a list of user set options.
Class to organize all the additional data required by the Chen-Goldfarb penalty function algorithm...
void Set_penalty(Number penalty)
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...
bool have_cgpen_deltas_
The following flag is set to true, if some other part of the algorithm has already computed the Chen-...
SmartPtr< const IteratesVector > delta_cgpen_
void SetRestorCounter(Number restor_counter)
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:19
void SetCurrPenaltyPert(Number curr_penalty_pert)
SmartPtr< const IteratesVector > delta_cgpen() const
Delta for the Chen-Goldfarb search direction.
bool KKTPenaltyInitialized() const
#define DBG_ASSERT(test)
Definition: IpDebug.hpp:38
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...
unsigned int Tag
Type for the Tag values.
~CGPenaltyData()
Default destructor.
SmartPtr< const U > ConstPtr(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:572
Number curr_kkt_penalty() const
bool HaveCgFastDeltas() const
Class responsible for all message output.
bool InitializeDataStructures()
Initialize Data Structures.
bool HaveCgPenDeltas() const
void SetNeverTryPureNewton(bool never_try_pure_Newton)
Index restor_iter_
The iteration at which pure Newton method is given up.
bool have_cgfast_deltas_
The following flag is set to true, if some other part of the algorithm has already computed the fast ...
void SetHaveCgPenDeltas(bool have_cgpen_deltas)
Base class for additional data that is special to a particular type of algorithm, such as the CG pena...
Definition: IpIpoptData.hpp:28
void operator=(const CGPenaltyData &)
Overloaded Equals Operator.
void Set_kkt_penalty(Number kkt_penalty)
CGPenaltyData()
Constructor.