1 |
/* |
2 |
* Interface to Karl Westerberg's Solver |
3 |
* Tom Epperly |
4 |
* Created: June, 1990 |
5 |
* Copyright (C) 1990 Thomas Guthrie Epperly |
6 |
* Patched 1/94 for ASCEND3C -baa |
7 |
* Only Solve is implemented in slv_interface.c |
8 |
* |
9 |
* Version: $Revision: 1.4 $ |
10 |
* Version control file: $RCSfile: slv_interface.h,v $ |
11 |
* Date last modified: $Date: 1997/07/18 12:17:10 $ |
12 |
* Last modified by: $Author: mthomas $ |
13 |
* |
14 |
* This file is part of the SLV solver. |
15 |
* |
16 |
* Copyright (C) 1994 Joseph Zaher, Benjamin Andrew Allan |
17 |
* |
18 |
* The SLV solver is free software; you can redistribute |
19 |
* it and/or modify it under the terms of the GNU General Public License as |
20 |
* published by the Free Software Foundation; either version 2 of the |
21 |
* License, or (at your option) any later version. |
22 |
* |
23 |
* The SLV solver is distributed in hope that it will be |
24 |
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
25 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
26 |
* General Public License for more details. |
27 |
* |
28 |
* You should have received a copy of the GNU General Public License |
29 |
* along with the program; if not, write to the Free Software Foundation, |
30 |
* Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check the file named |
31 |
* COPYING. COPYING is found in ../compiler. |
32 |
*/ |
33 |
|
34 |
#ifndef slv_interface_module_loaded |
35 |
#define slv_interface_module_loaded |
36 |
/* requires #include<stdio.h> */ |
37 |
/* requires #include"instance_enum.h" */ |
38 |
|
39 |
extern void Solve(struct Instance *); |
40 |
/* |
41 |
* This is the link that the command line interface should call. |
42 |
*/ |
43 |
|
44 |
/* the rest of this is junk */ |
45 |
extern unsigned long NumberVars(); |
46 |
/* |
47 |
* Returns the number of variables. |
48 |
*/ |
49 |
|
50 |
/* extern unsigned long NumberEquations(); */ |
51 |
/* |
52 |
* Returns the number of equations. |
53 |
*/ |
54 |
|
55 |
/* extern unsigned long NumberJacobianElements(); */ |
56 |
/* |
57 |
* Returns an upper bound on the number of non-zero elements in the |
58 |
* Jacobian. |
59 |
*/ |
60 |
|
61 |
/* extern void GetNominalValues(double *); */ |
62 |
/* |
63 |
* void GetNominalValues(nom) |
64 |
* double *nom; |
65 |
* Return the nominal value of the variables from the Ascend data structure. |
66 |
* If any of the variables have an undefined or zero nominal value, |
67 |
* 1 is used. |
68 |
*/ |
69 |
|
70 |
/* extern void GetVarValues(double *,double *,double *); */ |
71 |
/* |
72 |
* void GetVarValues(x,xl,xu) |
73 |
* double *x,*xl,*xu; |
74 |
* Get the values of the variables from the Ascend data structure and store |
75 |
* them in the arrays x, xl, and xu which are assumed to be large enough. |
76 |
* Array Description |
77 |
* x Gets the value of the variable |
78 |
* xl Gets a lower bound on the variable |
79 |
* xu Gets an upper bound on the variable |
80 |
* You may pass NULL parameters to this procedure, and it will not provide |
81 |
* that information. |
82 |
*/ |
83 |
|
84 |
/* extern void StoreVarValues(double *,double *,double *); */ |
85 |
/* |
86 |
* void StoreXValues(x,xl,xu) |
87 |
* double *x,*xl,*xu; |
88 |
* Store the values found in the arrays in the Ascend data structure. |
89 |
* Array Description |
90 |
* x Holds the variable value |
91 |
* xl Holds the lower bound on the variable value |
92 |
* xu Holds the upper bound on the variable value |
93 |
* You may pass NULL parameters to this procedure, and it will not store |
94 |
* that information. |
95 |
*/ |
96 |
|
97 |
/* extern void EvaluateFunction(double *); */ |
98 |
/* |
99 |
* void EvaluateFunction(f); |
100 |
* double *f; |
101 |
* Evaluate the functions at the value current stored in the Ascend data |
102 |
* structure. The residual is stored in the Ascend data structure, and it |
103 |
* is also return in the array f. If f is NULL, this procedure will |
104 |
* evaluate the function and the results only in the Ascend data structure. |
105 |
*/ |
106 |
|
107 |
#define JACFUNC void (*)(int,int,double) |
108 |
/* |
109 |
* Type definition for storing Jacobian elements. The function definition |
110 |
* is as follows: |
111 |
* |
112 |
* void JacStore(row,col,value) |
113 |
* int row,col; |
114 |
* double value; |
115 |
*/ |
116 |
|
117 |
#define SLOPEFUNC void (*)(int,int,double,double) |
118 |
/* |
119 |
* Type definition for storing slope matrix elements. The function |
120 |
* definition is as follows: |
121 |
* |
122 |
* void SlopeStore(row,col,low,high) |
123 |
* int row,col; |
124 |
* double low,high; |
125 |
*/ |
126 |
|
127 |
/* extern void EvaluateJac(double *,JACFUNC); */ |
128 |
/* |
129 |
* void EvaluateJac(f,JacStore) |
130 |
* double f[]; |
131 |
* void (*JacStore)(row,col,value); |
132 |
* It is assumed that the Jacobian starts out empty and zero. |
133 |
*/ |
134 |
|
135 |
/* extern void EvaluateAll(double *,double *,double *,double *,double *, |
136 |
JACFUNC,SLOPEFUNC); */ |
137 |
/* |
138 |
* void EvaluateAll(f,fl,fu,JacStore,SlopeStore) |
139 |
* double f[], |
140 |
* fl[], |
141 |
* fu[], |
142 |
* flu[], |
143 |
* fuu[]; |
144 |
* void (*JacStore)(row,col,value); |
145 |
* void (*SlopeStore)(row,col,low,high); |
146 |
* It is assumed that the Jacobian and slope matrix start out empty(the |
147 |
* zero matrix). |
148 |
*/ |
149 |
|
150 |
/* extern void EvaluateI(int,double *,double *,double *); */ |
151 |
/* |
152 |
* void EvaluateI(i,f,Jl,Ju) |
153 |
* int i; |
154 |
* double *f,*Jl,*Ju; |
155 |
* This evaluates the i'th function at the value currently stored in the |
156 |
* Ascend data structure. The residual of the i'th function is stored in |
157 |
* the Ascend data structure as well as in *f. |
158 |
* |
159 |
* It is assumed that Jl and Ju are filled with zeros on input! |
160 |
* |
161 |
* Outputs |
162 |
* f holds value of the function |
163 |
* Jl lower bound on the Jacobian for the i'th function(array) |
164 |
* Ju upper bound on the Jacobian for the i'th function(array) |
165 |
*/ |
166 |
|
167 |
/* extern void VariableReport(FILE *,int); */ |
168 |
/* |
169 |
* void VariableReport(f,level) |
170 |
* FILE *f; |
171 |
* int level; |
172 |
* Print a report of all the variables in the system. This prints the |
173 |
* value of the variables currently found in the Ascend data structure. |
174 |
* At this point level is ignored. |
175 |
* |
176 |
* level |
177 |
* Always Prints variable number, name and values. |
178 |
*/ |
179 |
|
180 |
/* extern void FunctionReport(FILE *,int); */ |
181 |
/* |
182 |
* void FunctionReport(f,level) |
183 |
* FILE *f; |
184 |
* int level; |
185 |
* Print a report of all the equations found in the system. This prints |
186 |
* the residual of all the functions as currently found in the Ascend |
187 |
* data structure. This value could be inconsistent with the variable |
188 |
* values because the residual is only updated by the evaluation routines. |
189 |
* |
190 |
* level |
191 |
* Always Prints equation number, name and residual. |
192 |
* >= 1 Prints the equation |
193 |
*/ |
194 |
#endif /* module loaded*/ |