Ipopt Documentation  
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 // Authors: Andreas Waechter IBM 2007-06-04
6 // based on IpIpoptData.hpp
7 
8 #ifndef __IPCGPENALTYDATA_HPP__
9 #define __IPCGPENALTYDATA_HPP__
10 
11 #include "IpIteratesVector.hpp"
12 #include "IpOptionsList.hpp"
13 #include "IpIpoptData.hpp"
14 
15 namespace Ipopt
16 {
17 
22 {
23 public:
28 
32 
38  bool Initialize(
39  const Journalist& jnlst,
40  const OptionsList& options,
41  const std::string& prefix);
42 
45 
48 
55  void set_delta_cgpen(
56  SmartPtr<IteratesVector>& delta_pen
57  );
58 
67  void set_delta_cgpen(
69  );
70 
73 
80  void set_delta_cgfast(
81  SmartPtr<IteratesVector>& delta_fast
82  );
83 
90  bool HaveCgPenDeltas() const
91  {
92  return have_cgpen_deltas_;
93  }
94 
96  bool have_cgpen_deltas
97  )
98  {
99  have_cgpen_deltas_ = have_cgpen_deltas;
100  }
101 
102  bool HaveCgFastDeltas() const
103  {
104  return have_cgfast_deltas_;
105  }
106 
108  bool have_cgfast_deltas
109  )
110  {
111  have_cgfast_deltas_ = have_cgfast_deltas;
112  }
114 
120 
122  {
123  return curr_penalty_pert_;
124  }
125 
127  Number curr_penalty_pert)
128  {
129  curr_penalty_pert_ = curr_penalty_pert;
130  }
131 
133  bool never_try_pure_Newton
134  )
135  {
136  never_try_pure_Newton_ = never_try_pure_Newton;
137  }
138 
140  {
141  return never_try_pure_Newton_;
142  }
143 
145  {
146  return restor_iter_;
147  }
148 
151  )
152  {
154  }
155 
157  {
158  return restor_counter_;
159  }
160 
163  )
164  {
166  }
167 
169  Number max_alpha_x
170  )
171  {
172  max_alpha_x_ = max_alpha_x;
173  }
174 
176  {
177  return max_alpha_x_;
178  }
179 
181  {
183  return curr_penalty_;
184  }
185 
187  Number penalty
188  )
189  {
190  curr_penalty_ = penalty;
191  penalty_initialized_ = true;
192  }
193 
195  {
196  penalty_initialized_ = false;
197  }
198 
199  bool PenaltyInitialized() const
200  {
201  return penalty_initialized_;
202  }
203 
205  {
207  return curr_kkt_penalty_;
208  }
209 
211  Number kkt_penalty
212  )
213  {
214  curr_kkt_penalty_ = kkt_penalty;
216  }
217 
219  {
220  kkt_penalty_initialized_ = false;
221  }
222 
224  {
226  }
227 
228 private:
229 
238 
246 
255 
264 
269 
273 
282 
285 
298  const CGPenaltyData&
299  );
300 
302  void operator=(
303  const CGPenaltyData&
304  );
306 
307 #if COIN_IPOPT_CHECKLEVEL > 0
308 
312  TaggedObject::Tag debug_delta_cgpen_tag_;
313  TaggedObject::Tag debug_delta_cgfast_tag_;
314  TaggedObject::Tag debug_delta_cgpen_tag_sum_;
315  TaggedObject::Tag debug_delta_cgfast_tag_sum_;
317 #endif
318 
319 };
320 
322 {
323  DBG_ASSERT(IsNull(delta_cgpen_) || (delta_cgpen_->GetTag() == debug_delta_cgpen_tag_ && delta_cgpen_->GetTagSum() == debug_delta_cgpen_tag_sum_) );
324 
325  return delta_cgpen_;
326 }
327 
329 {
330  DBG_ASSERT(IsNull(delta_cgfast_) || (delta_cgfast_->GetTag() == debug_delta_cgfast_tag_ && delta_cgfast_->GetTagSum() == debug_delta_cgfast_tag_sum_) );
331 
332  return delta_cgfast_;
333 }
334 
335 inline
337  SmartPtr<IteratesVector>& delta_cgpen
338 )
339 {
341 #if COIN_IPOPT_CHECKLEVEL > 0
342 
343  if (IsValid(delta_cgpen))
344  {
345  debug_delta_cgpen_tag_ = delta_cgpen->GetTag();
346  debug_delta_cgpen_tag_sum_ = delta_cgpen->GetTagSum();
347  }
348  else
349  {
350  debug_delta_cgpen_tag_ = 0;
351  debug_delta_cgpen_tag_sum_ = delta_cgpen->GetTagSum();
352  }
353 #endif
354 
355  delta_cgpen = NULL;
356 }
357 
358 inline
360  SmartPtr<const IteratesVector>& delta_cgpen
361 )
362 {
364 #if COIN_IPOPT_CHECKLEVEL > 0
365 
366  if (IsValid(delta_cgpen))
367  {
368  debug_delta_cgpen_tag_ = delta_cgpen->GetTag();
369  debug_delta_cgpen_tag_sum_ = delta_cgpen->GetTagSum();
370  }
371  else
372  {
373  debug_delta_cgpen_tag_ = 0;
374  debug_delta_cgpen_tag_sum_ = delta_cgpen->GetTagSum();
375  }
376 #endif
377 
378  delta_cgpen = NULL;
379 }
380 
381 inline
383  SmartPtr<IteratesVector>& delta_cgfast
384 )
385 {
387 #if COIN_IPOPT_CHECKLEVEL > 0
388 
389  if (IsValid(delta_cgfast))
390  {
391  debug_delta_cgfast_tag_ = delta_cgfast->GetTag();
392  debug_delta_cgfast_tag_sum_ = delta_cgfast->GetTagSum();
393  }
394  else
395  {
396  debug_delta_cgfast_tag_ = 0;
397  debug_delta_cgfast_tag_sum_ = delta_cgfast->GetTagSum();
398  }
399 #endif
400 
401  delta_cgfast = NULL;
402 }
403 
404 } // namespace Ipopt
405 
406 #endif
Ipopt::CGPenaltyData::SetKKTPenaltyUninitialized
void SetKKTPenaltyUninitialized()
Definition: IpCGPenaltyData.hpp:218
Ipopt::CGPenaltyData::HaveCgPenDeltas
bool HaveCgPenDeltas() const
Definition: IpCGPenaltyData.hpp:90
Ipopt::CGPenaltyData::~CGPenaltyData
~CGPenaltyData()
Destructor.
Ipopt::CGPenaltyData::HaveCgFastDeltas
bool HaveCgFastDeltas() const
Definition: IpCGPenaltyData.hpp:102
Ipopt::CGPenaltyData::PenaltyInitialized
bool PenaltyInitialized() const
Definition: IpCGPenaltyData.hpp:199
Ipopt::CGPenaltyData::InitializeDataStructures
bool InitializeDataStructures()
Initialize Data Structures.
Ipopt::CGPenaltyData::set_delta_cgpen
void set_delta_cgpen(SmartPtr< IteratesVector > &delta_pen)
Set the delta_cgpen.
Definition: IpCGPenaltyData.hpp:336
Ipopt::CGPenaltyData::restor_counter_
Number restor_counter_
Definition: IpCGPenaltyData.hpp:272
IpOptionsList.hpp
Ipopt::CGPenaltyData::restor_iter_
Index restor_iter_
The iteration at which pure Newton method is given up.
Definition: IpCGPenaltyData.hpp:271
Ipopt::CGPenaltyData::restor_counter
Number restor_counter()
Definition: IpCGPenaltyData.hpp:156
Ipopt
This file contains a base class for all exceptions and a set of macros to help with exceptions.
Definition: IpInexactAlgBuilder.hpp:14
Ipopt::CGPenaltyData::penalty_initialized_
bool penalty_initialized_
Definition: IpCGPenaltyData.hpp:276
Ipopt::Number
double Number
Type of all numbers.
Definition: IpTypes.hpp:15
Ipopt::CGPenaltyData::CGPenaltyData
CGPenaltyData()
Constructor.
Ipopt::CGPenaltyData
Class to organize all the additional data required by the Chen-Goldfarb penalty function algorithm.
Definition: IpCGPenaltyData.hpp:22
IpIteratesVector.hpp
Ipopt::CGPenaltyData::never_try_pure_Newton_
bool never_try_pure_Newton_
Flag indicating whether the pure Newton method is used.
Definition: IpCGPenaltyData.hpp:268
Ipopt::CGPenaltyData::SetRestorIter
void SetRestorIter(Index restor_iter)
Definition: IpCGPenaltyData.hpp:149
Ipopt::CGPenaltyData::curr_kkt_penalty
Number curr_kkt_penalty() const
Definition: IpCGPenaltyData.hpp:204
Ipopt::CGPenaltyData::delta_cgpen_
SmartPtr< const IteratesVector > delta_cgpen_
Definition: IpCGPenaltyData.hpp:237
Ipopt::Index
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:17
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::IpoptAdditionalData
Base class for additional data that is special to a particular type of algorithm, such as the CG pena...
Definition: IpIpoptData.hpp:30
Ipopt::CGPenaltyData::PrimalStepSize
Number PrimalStepSize()
Definition: IpCGPenaltyData.hpp:175
Ipopt::CGPenaltyData::curr_kkt_penalty_
Number curr_kkt_penalty_
Definition: IpCGPenaltyData.hpp:277
Ipopt::SmartPtr
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:172
Ipopt::CGPenaltyData::CurrPenaltyPert
Number CurrPenaltyPert()
Definition: IpCGPenaltyData.hpp:121
Ipopt::CGPenaltyData::restor_iter
Index restor_iter()
Definition: IpCGPenaltyData.hpp:144
Ipopt::CGPenaltyData::CGPenaltyData
CGPenaltyData(const CGPenaltyData &)
Copy Constructor.
Ipopt::CGPenaltyData::initialize_called_
bool initialize_called_
flag indicating if Initialize method has been called (for debugging)
Definition: IpCGPenaltyData.hpp:284
Ipopt::CGPenaltyData::operator=
void operator=(const CGPenaltyData &)
Default Assignment Operator.
Ipopt::CGPenaltyData::NeverTryPureNewton
Index NeverTryPureNewton()
Definition: IpCGPenaltyData.hpp:139
Ipopt::CGPenaltyData::Set_kkt_penalty
void Set_kkt_penalty(Number kkt_penalty)
Definition: IpCGPenaltyData.hpp:210
Ipopt::CGPenaltyData::delta_cgfast_
SmartPtr< const IteratesVector > delta_cgfast_
Definition: IpCGPenaltyData.hpp:254
IpIpoptData.hpp
Ipopt::CGPenaltyData::curr_penalty_
Number curr_penalty_
Definition: IpCGPenaltyData.hpp:275
Ipopt::CGPenaltyData::kkt_penalty_initialized_
bool kkt_penalty_initialized_
Definition: IpCGPenaltyData.hpp:278
Ipopt::CGPenaltyData::Set_penalty
void Set_penalty(Number penalty)
Definition: IpCGPenaltyData.hpp:186
Ipopt::ConstPtr
SmartPtr< const U > ConstPtr(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:665
Ipopt::Journalist
Class responsible for all message output.
Definition: IpJournalist.hpp:117
Ipopt::CGPenaltyData::SetHaveCgPenDeltas
void SetHaveCgPenDeltas(bool have_cgpen_deltas)
Definition: IpCGPenaltyData.hpp:95
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:262
Ipopt::CGPenaltyData::set_delta_cgfast
void set_delta_cgfast(SmartPtr< IteratesVector > &delta_fast)
Set the delta_cgfast.
Definition: IpCGPenaltyData.hpp:382
Ipopt::CGPenaltyData::curr_penalty_pert_
Number curr_penalty_pert_
Definition: IpCGPenaltyData.hpp:279
Ipopt::CGPenaltyData::SetPrimalStepSize
void SetPrimalStepSize(Number max_alpha_x)
Definition: IpCGPenaltyData.hpp:168
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:244
Ipopt::CGPenaltyData::delta_cgfast
SmartPtr< const IteratesVector > delta_cgfast() const
Delta for the fast Chen-Goldfarb search direction.
Definition: IpCGPenaltyData.hpp:328
Ipopt::CGPenaltyData::max_alpha_x_
Number max_alpha_x_
Definition: IpCGPenaltyData.hpp:280
Ipopt::IsValid
bool IsValid(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:674
Ipopt::CGPenaltyData::SetPenaltyUninitialized
void SetPenaltyUninitialized()
Definition: IpCGPenaltyData.hpp:194
Ipopt::TaggedObject::Tag
unsigned int Tag
Type for the Tag values.
Definition: IpTaggedObject.hpp:63
Ipopt::CGPenaltyData::SetHaveCgFastDeltas
void SetHaveCgFastDeltas(bool have_cgfast_deltas)
Definition: IpCGPenaltyData.hpp:107
Ipopt::IsNull
bool IsNull(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:682
Ipopt::CGPenaltyData::KKTPenaltyInitialized
bool KKTPenaltyInitialized() const
Definition: IpCGPenaltyData.hpp:223
DBG_ASSERT
#define DBG_ASSERT(test)
Definition: IpDebug.hpp:28
Ipopt::CGPenaltyData::SetRestorCounter
void SetRestorCounter(Number restor_counter)
Definition: IpCGPenaltyData.hpp:161
Ipopt::OptionsList
This class stores a list of user set options.
Definition: IpOptionsList.hpp:33
Ipopt::CGPenaltyData::AcceptTrialPoint
void AcceptTrialPoint()
Set the current iterate values from the trial values.
Ipopt::CGPenaltyData::delta_cgpen
SmartPtr< const IteratesVector > delta_cgpen() const
Delta for the Chen-Goldfarb search direction.
Definition: IpCGPenaltyData.hpp:321
Ipopt::CGPenaltyData::SetNeverTryPureNewton
void SetNeverTryPureNewton(bool never_try_pure_Newton)
Definition: IpCGPenaltyData.hpp:132
Ipopt::CGPenaltyData::curr_penalty
Number curr_penalty() const
Definition: IpCGPenaltyData.hpp:180
Ipopt::CGPenaltyData::SetCurrPenaltyPert
void SetCurrPenaltyPert(Number curr_penalty_pert)
Definition: IpCGPenaltyData.hpp:126