/[ascend]/trunk/base/generic/solver/slv_stdcalls.h
ViewVC logotype

Contents of /trunk/base/generic/solver/slv_stdcalls.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 236 - (show annotations) (download) (as text)
Mon Jan 30 06:09:52 2006 UTC (14 years, 6 months ago) by johnpye
File MIME type: text/x-chdr
File size: 12198 byte(s)
Minor #ifdef changes
1 /*
2 * Standard Clients module of ASCEND environment
3 * by Benjamin Andrew Allan
4 * 5/19/96
5 * Version: $Revision: 1.8 $
6 * Version control file: $RCSfile: slv_stdcalls.h,v $
7 * Date last modified: $Date: 1998/06/16 16:53:07 $
8 * Last modified by: $Author: mthomas $
9 *
10 * Copyright(C) 1996 Benjamin Andrew Allan
11 * Copyright(C) 1998 Carnegie Mellon University
12 *
13 * This file is part of the ASCEND IV math programming system.
14 * It registers our primary clients (solvers) and provides a home
15 * for several unregistered utility clients.
16 *
17 * The Ascend Math Programming System is free software; you can
18 * redistribute it and/or modify it under the terms of the GNU
19 * General Public License as published by the Free Software
20 * Foundation; either version 2 of the License, or (at your option)
21 * any later version.
22 *
23 * The Ascend Math Programming System is distributed in hope that it
24 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
25 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
26 * See the GNU 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
30 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check
31 * the file named COPYING.
32 */
33
34 /** @file
35 * Standard Clients module of ASCEND environment
36 * <pre>
37 * Requires: #include <stdio.h>
38 * #include "utilities/ascConfig.h"
39 * #include "system.h"
40 * #include "slv_client.h"
41 * #include "mtx.h"
42 * #include "slvDOF.h"
43 * </pre>
44 */
45
46 #ifndef ASC_SLV_STDCLIENTS_H
47 #define ASC_SLV_STDCLIENTS_H
48
49 extern int slv_std_make_incidence_mtx(slv_system_t sys,
50 mtx_matrix_t mtx,
51 var_filter_t *vf,
52 rel_filter_t *rf);
53 /**<
54 * <!-- err = slv_std_make_incidence_mtx(sys,mtx,vf,rf); -->
55 *
56 * Populates a matrix according to the sys solvers_vars, solvers_rels
57 * lists and the filters given. The filter should have at least
58 * SVAR = 1 bit on. mtx given must be created (not null) and with
59 * order >= max( slv_get_num_solvers_rels(sys),slv_get_num_solvers_vars(sys));
60 * Vars and rels on solvers lists should be sindexed 0 -> len-1.
61 * Returns 0 if went ok.
62 */
63
64 #define slv_block_partition(s) slv_block_partition_real((s),0)
65 /**< do BLT permutation to system solvers lists */
66
67 #define slv_block_partition_upper(s) slv_block_partition_real((s),1)
68 /**< do BUT permutation to system solvers lists */
69
70 extern int slv_block_partition_real(slv_system_t sys, int uppertriangular);
71 /**<
72 * <!-- status = slv_block_partition(sys,uppertriangular); -->
73 *
74 * Takes a system and reorders its solvers_vars and solvers_rels
75 * list so that they fall into a block lower(upper) triangular form and
76 * the system's block list is set to match.
77 * Only included equality relations and free, incident solver_var
78 * are so ordered.<br><br>
79 *
80 * The blocks derived are put in the slv_system_t block list.
81 * If this succeeds, return value is 0.
82 * If fail due to insufficient memory, return is 2.
83 * If fail for any other reason, return is 1.
84 * Produces whine about DOF analysis on file stderr.<br><br>
85 *
86 * ASSUMPTION: We assume that the variable and relation bit flags
87 * are in sync with the flags on the atoms. The need for this
88 * assumption and the associated bookkeeping should go away when
89 * we move to using only the bit flags. Currently var_fixed and
90 * rel_included are in charge of the syncronization.
91 */
92
93 extern void slv_sort_rels_and_vars(slv_system_t sys,
94 int32 *rel_count,
95 int32 *var_count);
96 /**<
97 * <!-- slv_sort_rels_and_vars(sys,rel_count,var_count); -->
98 *
99 * Reindexes systems rel and var lists such that rel list is in order:
100 * rel_list = |included and active rels|unincluded|inactive|
101 * and the var list is in the order:
102 * var_list = |incident free solver vars|unincluded|inactive|<br><br>
103 *
104 * Upon return rel_count will be the number of included and active rels
105 * and var_count will be the number of incident free solver vars.
106 * If either rel_count or var_count is -1 then a memory allocation
107 * failed and this function bailed out without doing any work.
108 */
109
110 int slv_block_unify(slv_system_t sys);
111 /**<
112 * Takes a system that has been through slv_block_partition and combines
113 * the blocks that comprise rows 0 -> (structural_rank -1) and
114 * columns 0 to ncols-1 in the system's dof_t into one block.
115 * This may be useful for optimizers which want a whole rectangular
116 * block.
117 */
118
119 extern int slv_set_up_block(slv_system_t sys, int32 block);
120 /**<
121 * <!-- status = slv_set_up_block(sys,block); -->
122 *
123 * This function should be called on blocks which have previously
124 * been reordered. Variable and relation maintanence is performed
125 * so that the block will be ready for an interation.
126 * ***rest of this is cut from slv_spk1_reorder***<br><br>
127 *
128 * System should have first been processed by slv_block_partition,
129 * so that all the current rows and columns within the block
130 * correspond to org rows and columns within the block.
131 * solvers_vars and solvers_rels lists are
132 * reordered and reindexed within that region to match.<br><br>
133 *
134 * The block should contain only included equality relations and
135 * free, incident solver_vars.
136 * If we made a matrix out of the block, it should have a full<br><br>
137 * diagonal.
138 *
139 * If this succeeds, return value is 0.
140 * If fail due to insufficient memory, return is 2.
141 * If fail for any other reason, return is 1.<br><br>
142 *
143 * Preconditions of use:
144 * No vars outside the block in the solvers_var list should have
145 * VAR_INBLOCK set to TRUE.<br><br>
146 *
147 * Sideeffects:
148 * We will diddle with all the vars in the solvers_vars and solver_rels
149 * list so that all rel/vars inside the block respond TRUE to in_block.
150 * We will do this even if we decide to block is too small to be worth
151 * reordering or is the wrong shape.<br><br>
152 *
153 * @bug This should optionally take a user supplied matrix so it doesn't
154 * allocate a big matrix header+perms every time. This needs some
155 * thought.
156 *
157 * @todo Revisit design of slv_set_up_block() - take user matrix?
158 */
159
160 extern int slv_spk1_reorder_block(slv_system_t sys,
161 int32 block,
162 int32 transpose);
163 /**<
164 * <!-- status = slv_spk1_reorder_block(sys,block,transpose); -->
165 *
166 * System should have first been processed by slv_block_partition,
167 * so that all the current rows and columns within the block
168 * correspond to org rows and columns within the block.
169 * Within the diagonal block given (which must be square), an SPK1
170 * reordering is done. solvers_vars and solvers_rels lists are
171 * reordered and reindexed within that region to match.
172 * The block should contain only included equality relations and
173 * free, incident solver_vars.
174 * transpose determines if SPK1 is transposed.
175 * If we made a matrix out of the block, it should have a full
176 * diagonal.
177 *
178 * If this succeeds, return value is 0.
179 * If fail due to insufficient memory, return is 2.
180 * If fail for any other reason, return is 1.
181 *
182 * Preconditions of use:
183 * No vars outside the block in the solvers_var list should have
184 * VAR_INBLOCK set to TRUE.
185 *
186 * Sideeffects:
187 * We will diddle with all the vars in the solvers_vars and solver_rels
188 * list so that all rel/vars inside the block respond TRUE to in_block.
189 * We will do this even if we decide to block is too small to be worth
190 * reordering or is the wrong shape.
191 *
192 * @bug This should optionally take a user supplied matrix so it doesn't
193 * allocate a big matrix header+perms every time. This needs some
194 * thought.
195 *
196 * @todo Revisit design of slv_set_up_block() - take user matrix?
197 */
198
199 extern int slv_tear_drop_reorder_block(slv_system_t sys,
200 int32 blockindex,
201 int32 cutoff,
202 int two,
203 enum mtx_reorder_method blockmethod);
204 /**<
205 * <!-- slv_tear_drop_reorder_block(sys,blockindex,cutoff,two,blockmethod); -->
206 *
207 * System should have first been processed by slv_block_partition,
208 * so that all the current rows and columns within the block
209 * correspond to org rows and columns within the block.
210 * If you made a matrix out of the block, it should have a full
211 * diagonal.<br><br>
212 *
213 * Given a system and the index of a block in that system,
214 * applies a variant of the reordering hinted at in [Abbott,1996].
215 * The implementation here is by Ben Allan, so any discrepancies
216 * (positive) in performance with respect to the Abbott
217 * thesis data are Ben's fault.<br><br>
218 *
219 * If two != 0, applies an algorithm slightly more similar to that
220 * of Abbott, getting borders roughly twice as large.
221 * Preconditions of use: same as spk1_reorder_block.
222 * Sideeffects and bugs: same as spk1_reorder_block.
223 * Additional bugs: none known, but they're there.
224 */
225
226 extern int slv_insure_bounds(slv_system_t sys, int32 lo, int32 hi, FILE *fp);
227 /**<
228 * <!-- nchange = slv_insure_bounds(sys,lo,hi,fp); -->
229 *
230 * Takes a system and a range of vars (lo,hi) and makes sure all the
231 * variables are within bounds and bounds are reasonable. makes
232 * repairs in all cases where they are not. Returns the number
233 * of repairs made or -1 if something weird found.
234 * If fp is not NULL, prints notices to the file given.
235 */
236
237 extern void slv_check_bounds(const slv_system_t sys, int32 lo, int32 hi,
238 FILE * fp, const char *label);
239 /**<
240 * <!-- slv_check_bounds(sys,lo,hi,fp,label); -->
241 *
242 * Takes a system and a range of vars (lo,hi) and makes sure all the
243 * variables are within bounds and bounds are reasonable. Whines
244 * to fp using the label in all cases where they are not.
245 * Does not change anything.
246 * If fp is NULL, does nothing.
247 */
248
249 extern int SlvRegisterStandardClients(void);
250 /**<
251 * Attempts to register solvers slv0 through (as of 6/96) slv7.
252 * Returns the number of these which register successfully.
253 * The solvers registered here are those linked at build time of the
254 * ascend binary. See slv_client.h for registering dynamically loaded
255 * solvers.
256 */
257
258 /*===================================================================*\
259 Output Assignment and partitioning in Logical Relations
260 \*===================================================================*/
261
262 extern int slv_std_make_log_incidence_mtx(slv_system_t sys,
263 mtx_matrix_t mtx,
264 dis_filter_t *dvf,
265 logrel_filter_t *lrf);
266 /**<
267 * <!-- err = slv_std_make_log_incidence_mtx(sys,mtx,dvf,lrf); -->
268 *
269 * Populates a matrix according to the sys solvers_dvars, solvers_logrels
270 * lists and the filters given. mtx given must be created (not null) and with
271 * order >= max( slv_get_num_solvers_logrels(sys),
272 * slv_get_num_solvers_dvars(sys));
273 * Dvars and logrels on solvers lists should be sindexed 0 -> len-1.
274 * Returns 0 if went ok.
275 */
276
277 extern int slv_log_block_partition(slv_system_t sys);
278 /**<
279 * <!-- status = slv_log_block_partition(sys); -->
280 *
281 * Takes a system and reorders its solvers_dvars and solvers_logrels
282 * list so that they fall into a block lower triangular form and
283 * the system's block list is set to match.
284 * Only included and active logrelations and free, incident boolean_var
285 * are so ordered.
286 * The blocks derived are put in the slv_system_t block list.<br><br>
287 *
288 * If this succeeds, return value is 0.
289 * If fail due to insufficient memory, return is 2.
290 * If fail for any other reason, return is 1.
291 */
292
293 #endif /** ASC_SLV_STDCLIENTS_H */
294

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22