Xyce  6.1
N_NLS_ConstraintBT.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 // Copyright Notice
3 //
4 // Copyright 2002 Sandia Corporation. Under the terms
5 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S.
6 // Government retains certain rights in this software.
7 //
8 // Xyce(TM) Parallel Electrical Simulator
9 // Copyright (C) 2002-2015 Sandia Corporation
10 //
11 // This program is free software: you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation, either version 3 of the License, or
14 // (at your option) any later version.
15 //
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 //-----------------------------------------------------------------------------
24 
25 //-------------------------------------------------------------------------
26 // Filename : $$
27 //
28 // Purpose : Constraint Backtracking Class.
29 //
30 // Special Notes :
31 //
32 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
33 //
34 // Creation Date : 01/26/01
35 //
36 // Revision Information:
37 // ---------------------
38 //
39 // Revision Number: $$
40 //
41 // Revision Date : $$
42 //
43 // Current Owner : $$
44 //-------------------------------------------------------------------------
45 
46 #ifndef Xyce_N_NLS_ConstraintBT_h
47 #define Xyce_N_NLS_ConstraintBT_h
48 
49 #include <N_LAS_fwd.h>
50 #include <N_NLS_fwd.h>
51 
52 namespace Xyce {
53 namespace Nonlinear {
54 
55 //-----------------------------------------------------------------------------
56 // Class : ConstraintBT
57 // Purpose : Supports constraint backtracking (damping) for the nonlinear
58 // solver.
59 // Special Notes :
60 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
61 // Creation Date : 01/26/01
62 //-----------------------------------------------------------------------------
63 
65 {
66 public:
67 
68  // ***** Constructors and destructor and general operators *****
69 
70  ConstraintBT();
71 
72  ~ConstraintBT();
73 
74  bool initializeAll (Linear::System * lasSysPtr,
75  const NLParams & nlParams);
76 
77  // ***** Methods *****
78 
79  void updateThetaBoundNeg(const Linear::Vector * oldSoln,
80  const Linear::Vector * solnUpdate);
81  void updateThetaBoundPos(const Linear::Vector * oldSoln,
82  const Linear::Vector * solnUpdate);
83  void updateThetaChange(const Linear::Vector * oldSoln,
84  const Linear::Vector * solnUpdate);
85 
86  // ***** Accessor Methods *****
87 
88  inline void setThetaBoundNeg(double value);
89  inline void resetThetaBoundNeg();
90  inline double getThetaBoundNeg() const;
91 
92  inline void setThetaBoundPos(double value);
93  inline void resetThetaBoundPos();
94  inline double getThetaBoundPos() const;
95 
96  inline void setThetaChange(double value);
97  inline void resetThetaChange();
98  inline double getThetaChange() const;
99 
100 protected:
101 
102  // Global bounds for the constraint backtracking - the names correspond
103  // roughly to those used by John Shadid (SNL) in his writeup on the MPSalsa
104  // implementation.
107  double thetaChange_;
108 
109 private:
110  ConstraintBT(const ConstraintBT &); ///< No copying
111  ConstraintBT &operator=(const ConstraintBT &); ///< No Assignment
112 
113  int operator==(const ConstraintBT & right) const;
114  int operator!=(const ConstraintBT & right) const;
115 
116  // Constraint backtracking vectors.
117  Linear::Vector * constraintMinVector_;
118  Linear::Vector * constraintMaxVector_;
119  Linear::Vector * constraintChangeVector_;
120  Linear::Vector * constraintTempVector_;
121 
122 };
123 
124 //-----------------------------------------------------------------------------
125 // Function : ConstraintBT::setThetaBoundNeg
126 // Purpose : Accessor method to set the negative bound.
127 // Special Notes :
128 // Scope : public
129 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
130 // Creation Date : 01/26/01
131 //-----------------------------------------------------------------------------
133 {
135 }
136 
137 //-----------------------------------------------------------------------------
138 // Function : ConstraintBT::resetThetaBoundNeg
139 // Purpose : Accessor method to reset the negative bound to the default.
140 // Special Notes :
141 // Scope : public
142 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
143 // Creation Date : 01/26/01
144 //-----------------------------------------------------------------------------
146 {
147  thetaBoundNeg_ = 1.0;
148 }
149 
150 //-----------------------------------------------------------------------------
151 // Function : ConstraintBT::getThetaBoundNeg
152 // Purpose : Accessor method which returns the negative bound constraint.
153 // Special Notes :
154 // Scope : public
155 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
156 // Creation Date : 01/26/01
157 //-----------------------------------------------------------------------------
158 inline double ConstraintBT::getThetaBoundNeg() const
159 {
160  return thetaBoundNeg_;
161 }
162 
163 //-----------------------------------------------------------------------------
164 // Function : ConstraintBT::setThetaBoundPos
165 // Purpose : Accessor method to set the positive bound.
166 // Special Notes :
167 // Scope : public
168 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
169 // Creation Date : 01/26/01
170 //-----------------------------------------------------------------------------
172 {
174 }
175 
176 //-----------------------------------------------------------------------------
177 // Function : ConstraintBT::resetThetaBoundPos
178 // Purpose : Accessor method to reset the positive bound to the default.
179 // Special Notes :
180 // Scope : public
181 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
182 // Creation Date : 01/26/01
183 //-----------------------------------------------------------------------------
185 {
186  thetaBoundPos_ = 1.0;
187 }
188 
189 //-----------------------------------------------------------------------------
190 // Function : ConstraintBT::getThetaBoundPos
191 // Purpose : Accessor method which returns the positive bound constraint.
192 // Special Notes :
193 // Scope : public
194 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
195 // Creation Date : 01/26/01
196 //-----------------------------------------------------------------------------
197 inline double ConstraintBT::getThetaBoundPos() const
198 {
199  return thetaBoundPos_;
200 }
201 
202 //-----------------------------------------------------------------------------
203 // Function : ConstraintBT::setThetaChange
204 // Purpose : Accessor method to set the percentage change bound.
205 // Special Notes :
206 // Scope : public
207 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
208 // Creation Date : 01/26/01
209 //-----------------------------------------------------------------------------
211 {
213 }
214 
215 //-----------------------------------------------------------------------------
216 // Function : ConstraintBT::resetThetaChange
217 // Purpose : Accessor method to reset the percentage change to the
218 // default.
219 // Special Notes :
220 // Scope : public
221 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
222 // Creation Date : 01/26/01
223 //-----------------------------------------------------------------------------
225 {
226  thetaChange_ = 1.0;
227 }
228 
229 //-----------------------------------------------------------------------------
230 // Function : ConstraintBT::getThetaChange
231 // Purpose : Accessor method which returns the percentage change
232 // constraint.
233 // Special Notes :
234 // Scope : public
235 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
236 // Creation Date : 01/26/01
237 //-----------------------------------------------------------------------------
238 inline double ConstraintBT::getThetaChange() const
239 {
240  return thetaChange_;
241 }
242 
243 } // namespace Nonlinear
244 } // namespace Xyce
245 
246 #endif
ConstraintBT & operator=(const ConstraintBT &)
No Assignment.
int operator==(const ConstraintBT &right) const
Linear::Vector * constraintChangeVector_
Pure virtual class to augment a linear system.
const T & value(const ParameterBase &entity, const Descriptor &descriptor)
Returns the value of the parameter for the entity.
Definition: N_DEV_Pars.h:1224
int operator!=(const ConstraintBT &right) const
void updateThetaBoundNeg(const Linear::Vector *oldSoln, const Linear::Vector *solnUpdate)
void updateThetaChange(const Linear::Vector *oldSoln, const Linear::Vector *solnUpdate)
void updateThetaBoundPos(const Linear::Vector *oldSoln, const Linear::Vector *solnUpdate)
bool initializeAll(Linear::System *lasSysPtr, const NLParams &nlParams)