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