Ipopt Documentation  
 
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// 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
15namespace Ipopt
16{
17
22{
23public:
26
28
32
39 const Journalist& jnlst,
40 const OptionsList& options,
41 const std::string& prefix);
42
45
48
55 void set_delta_cgpen(
57 );
58
67 void set_delta_cgpen(
69 );
70
73
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 }
113
114
117
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
143
145 {
146 return restor_iter_;
147 }
148
151 )
152 {
154 }
155
157 {
158 return restor_counter_;
159 }
160
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;
192 }
193
195 {
196 penalty_initialized_ = false;
197 }
198
200 {
202 }
203
209
211 Number kkt_penalty
212 )
213 {
214 curr_kkt_penalty_ = kkt_penalty;
216 }
217
222
224 {
226 }
227
228private:
229
238
243 // ToDo we could cue off of a null delta_cgpen_
246
255
261 // ToDo we could cue off of a null delta_cgfast_
264
267
269
273
282
285
296
298 const CGPenaltyData&
299 );
300
303 const CGPenaltyData&
304 );
306
307#if IPOPT_CHECKLEVEL > 0
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
335inline
338)
339{
341#if 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
358inline
361)
362{
364#if 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
381inline
384)
385{
387#if IPOPT_CHECKLEVEL > 0
388
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
#define DBG_ASSERT(test)
Definition IpDebug.hpp:27
void SetHaveCgPenDeltas(bool have_cgpen_deltas)
bool InitializeDataStructures()
Initialize Data Structures.
~CGPenaltyData()
Destructor.
SmartPtr< const IteratesVector > delta_cgfast_
void set_delta_cgpen(SmartPtr< IteratesVector > &delta_pen)
Set the delta_cgpen.
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)
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 &)
Default Assignment Operator.
void set_delta_cgfast(SmartPtr< IteratesVector > &delta_fast)
Set the delta_cgfast.
IpoptAdditionalData()
Default Constructor.
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.
This file contains a base class for all exceptions and a set of macros to help with exceptions.
SmartPtr< const U > ConstPtr(const SmartPtr< U > &smart_ptr)
bool IsValid(const SmartPtr< U > &smart_ptr)
ipindex Index
Type of all indices of vectors, matrices etc.
Definition IpTypes.hpp:20
ipnumber Number
Type of all numbers.
Definition IpTypes.hpp:17
bool IsNull(const SmartPtr< U > &smart_ptr)