Xyce  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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-2014 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 // ---------- Standard Includes ----------
50 
51 // ---------- Xyce Includes ----------
52 
53 #include <N_UTL_Xyce.h>
54 #include <N_NLS_fwd.h>
55 
56 // ---------- Fwd Declarations ----------
57 
58 class N_LAS_Vector;
59 class N_LAS_System;
60 
61 namespace Xyce {
62 namespace Nonlinear {
63 
64 //-----------------------------------------------------------------------------
65 // Class : ConstraintBT
66 // Purpose : Supports constraint backtracking (damping) for the nonlinear
67 // solver.
68 // Special Notes :
69 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
70 // Creation Date : 01/26/01
71 //-----------------------------------------------------------------------------
72 
74 {
75 public:
76 
77  // ***** Constructors and destructor and general operators *****
78 
79  ConstraintBT();
80 
81  ~ConstraintBT();
82 
83  ConstraintBT & operator=(const ConstraintBT & right);
84 
85  bool initializeAll (N_LAS_System * lasSysPtr,
86  const NLParams & nlParams);
87 
88  // ***** Methods *****
89 
90  void updateThetaBoundNeg(const N_LAS_Vector * oldSoln,
91  const N_LAS_Vector * solnUpdate);
92  void updateThetaBoundPos(const N_LAS_Vector * oldSoln,
93  const N_LAS_Vector * solnUpdate);
94  void updateThetaChange(const N_LAS_Vector * oldSoln,
95  const N_LAS_Vector * solnUpdate);
96 
97  // ***** Accessor Methods *****
98 
99  inline void setThetaBoundNeg(double value);
100  inline void resetThetaBoundNeg();
101  inline double getThetaBoundNeg() const;
102 
103  inline void setThetaBoundPos(double value);
104  inline void resetThetaBoundPos();
105  inline double getThetaBoundPos() const;
106 
107  inline void setThetaChange(double value);
108  inline void resetThetaChange();
109  inline double getThetaChange() const;
110 
111 protected:
112 
113  // Global bounds for the constraint backtracking - the names correspond
114  // roughly to those used by John Shadid (SNL) in his writeup on the MPSalsa
115  // implementation.
118  double thetaChange_;
119 
120 private:
121 
122  // Copy constructor - private until implemented...
123  ConstraintBT(const ConstraintBT & right);
124 
125  int operator==(const ConstraintBT & right) const;
126  int operator!=(const ConstraintBT & right) const;
127 
128  // Constraint backtracking vectors.
129  N_LAS_Vector * constraintMinVector_;
130  N_LAS_Vector * constraintMaxVector_;
131  N_LAS_Vector * constraintChangeVector_;
132  N_LAS_Vector * constraintTempVector_;
133 
134 };
135 
136 //-----------------------------------------------------------------------------
137 // Function : ConstraintBT::setThetaBoundNeg
138 // Purpose : Accessor method to set the negative bound.
139 // Special Notes :
140 // Scope : public
141 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
142 // Creation Date : 01/26/01
143 //-----------------------------------------------------------------------------
145 {
147 }
148 
149 //-----------------------------------------------------------------------------
150 // Function : ConstraintBT::resetThetaBoundNeg
151 // Purpose : Accessor method to reset the negative bound to the default.
152 // Special Notes :
153 // Scope : public
154 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
155 // Creation Date : 01/26/01
156 //-----------------------------------------------------------------------------
158 {
159  thetaBoundNeg_ = 1.0;
160 }
161 
162 //-----------------------------------------------------------------------------
163 // Function : ConstraintBT::getThetaBoundNeg
164 // Purpose : Accessor method which returns the negative bound constraint.
165 // Special Notes :
166 // Scope : public
167 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
168 // Creation Date : 01/26/01
169 //-----------------------------------------------------------------------------
170 inline double ConstraintBT::getThetaBoundNeg() const
171 {
172  return thetaBoundNeg_;
173 }
174 
175 //-----------------------------------------------------------------------------
176 // Function : ConstraintBT::setThetaBoundPos
177 // Purpose : Accessor method to set the positive bound.
178 // Special Notes :
179 // Scope : public
180 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
181 // Creation Date : 01/26/01
182 //-----------------------------------------------------------------------------
184 {
186 }
187 
188 //-----------------------------------------------------------------------------
189 // Function : ConstraintBT::resetThetaBoundPos
190 // Purpose : Accessor method to reset the positive bound to the default.
191 // Special Notes :
192 // Scope : public
193 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
194 // Creation Date : 01/26/01
195 //-----------------------------------------------------------------------------
197 {
198  thetaBoundPos_ = 1.0;
199 }
200 
201 //-----------------------------------------------------------------------------
202 // Function : ConstraintBT::getThetaBoundPos
203 // Purpose : Accessor method which returns the positive bound constraint.
204 // Special Notes :
205 // Scope : public
206 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
207 // Creation Date : 01/26/01
208 //-----------------------------------------------------------------------------
209 inline double ConstraintBT::getThetaBoundPos() const
210 {
211  return thetaBoundPos_;
212 }
213 
214 //-----------------------------------------------------------------------------
215 // Function : ConstraintBT::setThetaChange
216 // Purpose : Accessor method to set the percentage change bound.
217 // Special Notes :
218 // Scope : public
219 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
220 // Creation Date : 01/26/01
221 //-----------------------------------------------------------------------------
223 {
225 }
226 
227 //-----------------------------------------------------------------------------
228 // Function : ConstraintBT::resetThetaChange
229 // Purpose : Accessor method to reset the percentage change to the
230 // default.
231 // Special Notes :
232 // Scope : public
233 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
234 // Creation Date : 01/26/01
235 //-----------------------------------------------------------------------------
237 {
238  thetaChange_ = 1.0;
239 }
240 
241 //-----------------------------------------------------------------------------
242 // Function : ConstraintBT::getThetaChange
243 // Purpose : Accessor method which returns the percentage change
244 // constraint.
245 // Special Notes :
246 // Scope : public
247 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
248 // Creation Date : 01/26/01
249 //-----------------------------------------------------------------------------
250 inline double ConstraintBT::getThetaChange() const
251 {
252  return thetaChange_;
253 }
254 
255 } // namespace Nonlinear
256 } // namespace Xyce
257 
259 
260 #endif