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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 944 - (show annotations) (download) (as text)
Sat Nov 25 10:46:13 2006 UTC (14 years, 2 months ago) by johnpye
File MIME type: text/x-chdr
File size: 24598 byte(s)
Implemented ATOLVECT, ATOL, RTOL parameters for the IDA integrator.
1 /* ASCEND modelling environment
2 Copyright (C) 1990 Karl Michael Westerberg
3 Copyright (C) 1993 Joseph Zaher
4 Copyright (C) 1994 Joseph Zaher, Benjamin Andrew Allan
5 Copyright (C) 2006 Carnegie Mellon University
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA.
21 *//**
22 @file
23 Variable module of the SLV solver.
24
25 This module provides a SLV solver (the "client") with access to
26 variables present in the ASCEND compiler (the "server").
27
28 Access to ASCEND variables is abstracted so that SLV solvers
29 can theoretically be used to solve other kinds of systems as
30 well. @see analyze.h
31
32 The idea of a var makes no sense outside the context of
33 a slv_system_t, so some of the functions here may require
34 the passing of a slv_system_t with the var.
35
36 06/90 - original version
37 01/94 - added var_make_name() to create a copy of the
38 instance name
39 04/94 - added var_apply_filter() which uses the new
40 var_filter_t data structure for perfoming all
41 variable filtering needs (eliminating the
42 filter module)
43 08/94 - added var_BackendTokens_to_vars. BAA.
44
45 Requires:
46 #include <stdio.h>
47 #include "utilities/ascConfig.h"
48 #include "solver/slv_types.h"
49
50 @TODO
51 At present there is some insanity about asking the instance tree
52 vs asking our data structure about the flag values - This needs to
53 be fixed (see longer BAA comment in var.h).
54 *//*
55 Authors: Karl Westerberg and Joseph Zaher
56 Version: $Revision: 1.26 $
57 Date last modified: $Date: 1998/03/30 22:07:10 $
58 Last modified by: $Author: rv2a $
59 */
60
61 #ifndef ASC_VAR_H
62 #define ASC_VAR_H
63
64 #include <utilities/ascConfig.h>
65
66 /*
67 The first section of flagbit definitions are those flags to be
68 set by the server. Clients should not mess with them unless
69 they are very, very smart.
70 */
71 #define VAR_REAL 0x1
72 /**< don't know what this is good for. */
73 #define VAR_INCIDENT 0x2
74 /**< is this variable incident on some equation in the slv_system? */
75 #define VAR_PVAR 0x4
76 /**< do we think this var a 'solver_par'? */
77 #define VAR_SVAR 0x8
78 /**< do we think this var a 'solver_var'? */
79 #define VAR_INTEGER 0x10
80 /**< do we think this var a solver_integer? */
81 #define VAR_BINARY 0x20
82 /**< do we think this var a solver_binary? */
83 #define VAR_SEMICONT 0x40
84 /**< do we think this var a solver_semi(continuous) ? */
85
86 /*
87 The remaining flagbit definitions are those flags to be
88 manipulated by registered clients. Unregistered clients
89 should not change these bits unless the manner in which
90 they affect the bits is explained in the header for the
91 unregistered client.
92 */
93
94 #define VAR_PARAM 0x1000
95 /**< is this variable considered parametric currently? */
96 #define VAR_FIXED 0x2000
97 /**< is this variable considered fixed currently? */
98 #define VAR_INBLOCK 0x4000
99 /**< is this var in the columns of the block we are currently solving? */
100 #define VAR_INTERFACE 0x8000
101 /**< is this var an interface var currently? */
102 #define VAR_RELAXED 0x10000
103 /**< is this var currently a relaxed int or binary or semi var? */
104 #define VAR_ACTIVE 0x20000
105 /**< is this var currently a part of my problem? */
106 #define VAR_NONBASIC 0x40000
107 /**< is this var currently an independent variable (optimization)? */
108 #define VAR_ACTIVE_AT_BND 0x80000
109 /**< is this var active in some of the subregions neighboring the
110 boundary on which the problem currently lies ? */
111 #define VAR_ELIGIBLE 0x100000
112 /**< is this variable eligible to be fixed (globally)? */
113 #define VAR_ELIGIBLE_IN_SUBREGION 0x200000
114 /**< is this variable eligible to be fixed (in current subregion) ? */
115 #define VAR_POTENTIALLY_FIXED 0x400000
116 /**< this bit is auxiliar while iteratively and recurively we are
117 performing a combinatorial search, looking for a consitent
118 partition for all the alternatives in an conditional model */
119 #define VAR_INCIDENT_IN_CASE 0x800000
120 /**< is this variable incident in some relation of a CASE in a
121 WHEN statement ?. This is for purposes of simplfying the
122 analysis of conditional models */
123
124 /**
125 Variable structure.
126 Finally, we have a real structure so that we aren't hanging stuff
127 of the global instance tree. Do not dereference this structure except
128 via macros/functions, because we make no commitments about being
129 backward compatible with such code.
130
131 struct Instance * and struct var_variable * are no longer synonymous!
132 */
133 struct var_variable {
134 SlvBackendToken ratom; /**< the associated ascend ATOM */
135 struct rel_relation **incidence; /**< array rels which contain var */
136 int32 n_incidences; /**< length of incidence. */
137 int32 sindex; /**< index in the solver clients list (often column index) */
138 int32 mindex; /**< index in the slv_system_t master list */
139 uint32 flags; /**< batch of binary flags. The bit positions are as above */
140 };
141
142 /** Variable filter structure */
143 typedef struct var_filter_structure {
144 uint32 matchbits; /**< Bits to match. */
145 uint32 matchvalue; /**< Value to match. */
146 } var_filter_t;
147 /**< Variable filter type */
148
149 #define var_NO_UPPER_BOUND MAXDOUBLE
150 #define var_NO_LOWER_BOUND (-MAXDOUBLE/2)
151
152 #ifdef NDEBUG
153 # define var_instance(var) ((var)->ratom)
154 #else
155 # define var_instance(var) var_instanceF(var)
156 #endif
157 /**<
158 Returns the ATOM instance associated with the variable.
159 @param var const struct var_variable *, the variable to query.
160 @return Returns the instance as a SlvBackendToken.
161 @see var_instanceF()
162 */
163
164 #ifdef NDEBUG
165 # define var_set_instance(var,inst) ((var)->ratom = (inst))
166 #else
167 # define var_set_instance(var,inst) var_set_instanceF((var),(inst))
168 #endif
169 /**<
170 Sets the ATOM instance associated with the variable.
171 @param var struct var_variable *, the variable to modify.
172 @param inst SlvBackendToken, the new instance value.
173 @return No return value.
174 @see var_instanceF()
175 */
176
177 ASC_DLLSPEC(SlvBackendToken) var_instanceF(const struct var_variable *var);
178 /**<
179 Implementation function for var_instance(). Do not call this
180 function directly - use var_instance() instead.
181 */
182 extern void var_set_instanceF(struct var_variable *var, SlvBackendToken i);
183 /**<
184 Implementation function for var_set_instance(). Do not call this
185 function directly - use var_set_instance() instead.
186 */
187
188 extern char *var_make_xname(const struct var_variable *var);
189 /**<
190 Returns the index name, eg x23 rather than full name.
191 See var_make_name() for more information.
192 */
193 ASC_DLLSPEC(char*) var_make_name(
194 const slv_system_t sys,
195 const struct var_variable *var
196 );
197 /**<
198 Creates and returns a sufficiently large string storing the
199 qualified name of var as known by the solver instance tree.
200 If the instance is not found, "?" is returned. The string
201 should be destroyed when no longer in use.<br><br>
202
203 The name of a var is context dependent, so you have to provide the
204 slv_system_t from which you got the var.
205 */
206
207 ASC_DLLSPEC(void) var_write_name(const slv_system_t sys,
208 const struct var_variable *var,
209 FILE *file);
210 /**<
211 Writes a name to the file given. Handles NULL inputs gracefully.
212 Does not print any whitespace, including carriage returns.
213 Is faster than slv_print_var_name().
214 If sys is NULL, writes full ascend name. If file or var is NULL
215 does not write.
216 */
217
218 void var_destroy(struct var_variable *var);
219 /**<
220 Since someone else allocates vars en masse, this just sets
221 our integrity check to ERROR.
222 */
223
224 #ifdef NDEBUG
225 # define var_mindex(var) (var)->mindex
226 #else
227 # define var_mindex(var) var_mindexF(var)
228 #endif
229 /**<
230 Returns the index of the variable as it appears in a variable list.
231 The index is also used to assign the variable to a specific
232 original column of a matrix.
233 @param var const struct var_variable *, the variable to query.
234 @return Returns the index as an int32.
235 @see var_mindexF().
236 */
237
238 #ifdef NDEBUG
239 # define var_set_mindex(var,index) (var)->mindex = (index)
240 #else
241 # define var_set_mindex(var,index) var_set_mindexF((var),(index))
242 #endif
243 /**<
244 Sets the index of the variable as it appears in a variable list.
245 @param var struct var_variable *, the variable to modify.
246 @param index int32, the new value for the index.
247 @return No return value.
248 @see var_set_mindexF().
249 */
250
251 extern int32 var_mindexF(const struct var_variable *var);
252 /**<
253 Implementation function for var_mindex(). Do not call this
254 function directly - use var_mindex() instead.
255 */
256 extern void var_set_mindexF(struct var_variable *var, int32 mindex);
257 /**<
258 Implementation function for var_set_mindex(). Do not call this
259 function directly - use var_set_mindex() instead.
260 */
261
262 #ifdef NDEBUG
263 # define var_sindex(var) (var)->sindex
264 #else
265 # define var_sindex(var) var_sindexF(var)
266 #endif
267 /**<
268 Returns the index of the variable as it appears in a solvers
269 variable list. The index is also used to assign the variable
270 to a specific original column of a matrix.
271 @param var const struct var_variable *, the variable to query.
272 @return Returns the index as an int32.
273 @see var_sindexF().
274 */
275
276 #ifdef NDEBUG
277 # define var_set_sindex(var,index) (var)->sindex = (index)
278 #else
279 # define var_set_sindex(var,index) var_set_sindexF((var),(index))
280 #endif
281 /**<
282 Sets the index of the variable as it appears in a solver's
283 variable list.
284 @param var struct var_variable *, the variable to modify.
285 @param index int32, the new value for the index.
286 @return No return value.
287 @see var_set_sindexF().
288 */
289
290 ASC_DLLSPEC(int32) var_sindexF(const struct var_variable *var);
291 /**<
292 Implementation function for var_sindex(). Do not call this
293 function directly - use var_sindex() instead.
294 */
295 extern void var_set_sindexF(struct var_variable *var, int32 sindex);
296 /**<
297 Implementation function for var_set_sindex(). Do not call this
298 function directly - use var_set_sindex() instead.
299 */
300
301 ASC_DLLSPEC(real64) var_value(const struct var_variable *var);
302 /**< Returns the value of the variable. */
303 ASC_DLLSPEC(void ) var_set_value(struct var_variable *var, real64 value);
304 /**<
305 Sets the value of the variable.
306 */
307
308 ASC_DLLSPEC(real64) var_nominal(struct var_variable *var);
309 /**< Returns the nominal value of the variable, or 1.0 if it has none. */
310 ASC_DLLSPEC(void ) var_set_nominal(struct var_variable *var, real64 nominal);
311 /**<
312 Sets the nominal value of the variable.
313 If no nominal field in var, returns 1.0.
314 */
315
316 ASC_DLLSPEC(real64) var_lower_bound(struct var_variable *var);
317 /**< Returns the lower bound value of the variable. */
318 extern void var_set_lower_bound(struct var_variable *var, real64 lower_bound);
319 /**<
320 Sets the lower bound value of the variable.
321 */
322
323 ASC_DLLSPEC(real64) var_upper_bound(struct var_variable *var);
324 /**< Returns the upper bound value of the variable. */
325 extern void var_set_upper_bound(struct var_variable *var, real64 upper_bound);
326 /**<
327 Gets/sets the upper bound value of the variable.
328 */
329
330 double var_odeatol(struct var_variable *var);
331 /**< Returns the ODE absolute error tolerance for the variable, or -1 if not available */
332
333 #ifdef NDEBUG
334 # define var_n_incidences(var) ((var)->n_incidences)
335 #else
336 ASC_DLLSPEC(int32) var_n_incidencesF(struct var_variable *var);
337 # define var_n_incidences(var) var_n_incidencesF(var)
338 #endif
339 /**<
340 Returns the length of the incidence list.
341 Not everything in the incidence list is necessarily a
342 variable for your particular solver -- check the flags.
343 @param var const struct var_variable *, the variable to query.
344 @return Returns the index as an int32.
345 @see var_n_incidencesF().
346 */
347
348 #ifdef NDEBUG
349 # define var_set_incidences(var,n,ilist) \
350 (var)->n_incidences=(n); (var)->incidence = (ilist)
351 #else
352 # define var_set_incidences(var,n,ilist) var_set_incidencesF((var),(n),(ilist))
353 #endif
354 /**<
355 Sets the incidence list for a variable.
356 Solver clients should not call var_set_incidences(). It is
357 only for use by constructors of bridges to varation back ends.
358 @param var struct var_variable *, the variable to query.
359 @param n int32, length of the new incidence list.
360 @param ilist struct rel_relation **, the new incidence list.
361 @return No return value.
362 @see var_set_incidencesF().
363 */
364
365 extern void var_set_incidencesF(struct var_variable *var,
366 int32 n,
367 struct rel_relation **ilist);
368 /**<
369 Implementation function for var_set_incidences(). Do not call this
370 function directly - use var_set_incidences() instead.
371 */
372
373 ASC_DLLSPEC(struct rel_relation **) var_incidence_list_to_modify(
374 struct var_variable *var);
375 /**< Same as var_incidence_list(), except the returned list is modifiable. */
376
377 extern const struct rel_relation **var_incidence_list(struct var_variable *var);
378 /**<
379 Returns a pointer to an array var_n_incidences(var) long of vars.
380 Each element of the array is a struct rel_relation *.
381 Check the var sindex to see where each might go in a jacobian.
382 If there is no incidence, NULL is returned.
383 Pointers in this array will be unique.
384
385 The list belongs to the varation. Do not destroy it. Do not change it.
386
387 RA IS NOT a NULL-TERMINATED LIST.
388 */
389
390 #ifdef NDEBUG
391 # define var_flags(var) ((var)->flags)
392 #else
393 # define var_flags(var) var_flagsF(var)
394 #endif
395 /**<
396 Returns the flags field of the var. This flags value should
397 be composed of the var_xxx values defined above.
398 @param var const struct var_variable *, the variable to query.
399 @return Returns the index as an int32.
400 @see var_flagsF().
401 */
402
403 #ifdef NDEBUG
404 # define var_set_flags(var,flags) ((var)->flags = (flags))
405 #else
406 # define var_set_flags(var,flags) var_set_flagsF((var),(flags))
407 #endif
408 /**<
409 Sets the entire flag field to the value of flags given.
410 This flags value should be composed of the var_xxx values
411 defined above.
412 @param var struct var_variable *, the variable to query.
413 @param flags uint32, the new flags value.
414 @return No return value.
415 @see var_set_flagsF().
416 */
417
418 ASC_DLLSPEC(uint32) var_flagsF(const struct var_variable *var);
419 /**<
420 Implementation function for var_flags(). Do not call this
421 function directly - use var_flags() instead.
422 */
423 extern void var_set_flagsF(struct var_variable *var, uint32 flags);
424 /**<
425 Implementation function for var_set_flags(). Do not call this
426 function directly - use var_set_flags() instead.
427 */
428
429 ASC_DLLSPEC(uint32) var_flagbit(const struct var_variable *rel, const uint32 name);
430 /**<
431 Returns the value of the bit specified from the variable flags.
432 name should be a VAR_xx flag defined above.
433 */
434
435 ASC_DLLSPEC(void ) var_set_flagbit(struct var_variable *var,
436 uint32 NAME,
437 uint32 oneorzero);
438 /**<
439 Sets the bit, which should be referred to by its macro name,
440 on if oneorzero is >0 and off is oneorzero is 0.
441 The macro names are the defined up at the top of this file.<br><br>
442
443 Example: var_set_flags(var,VAR_PARTITION,1) turns on the
444 VAR_PARTITION bit.
445 <pre>
446 What it really does is:
447 if (oneorzero) {
448 var->flags |= field;
449 } else {
450 var->flags &= ~field;
451 }
452 </pre>
453 */
454
455 /*
456 * At present there is some insanity about asking the instance tree
457 * vs asking our data structure about the flag values. This needs to
458 * be fixed. In the process of that fix, we should establish a
459 * protocol that means vars/rels never need to look back at ATOM
460 * instances to be queried during the solution process. Rather, we
461 * need to establish a process in which the var list tells all its
462 * atoms about the solver derived values or the var list updates
463 * its values and flags from the instance tree.
464 * There is a counterpart exercise that needs to go on in the
465 * rel module so that (for remote processing) it is possible to
466 * do everything without looking back at the instance tree.
467 * At present, we will always keep VAR_FIXED in sync with the
468 * instance tree, but the instance tree is the leader.
469 * 6/96. baa
470 */
471
472 ASC_DLLSPEC(int32 ) var_apply_filter(const struct var_variable *var,
473 const var_filter_t *filter);
474 /**<
475 Returns 1 if filter and var flags are compatible, 0 elsewise.
476 See the filter description in rel.h. This is exactly the same.
477 */
478
479 ASC_DLLSPEC(uint32 ) var_fixed(struct var_variable *var);
480 /**< Returns the fixed flag of var. Has side effects in the ascend instance. */
481 extern void var_set_fixed(struct var_variable *var, uint32 fixed);
482 /**< Sets the fixed flag of var. Has side effects in the ascend instance. */
483 extern uint32 var_relaxed(struct var_variable *var);
484 /**< Returns the relaxed flag of var. Has side effects in the ascend instance. */
485 extern void var_set_relaxed(struct var_variable *var, uint32 fixed);
486 /**< Sets the relaxed flag of var. Has side effects in the ascend instance. */
487 extern uint32 var_interface(struct var_variable *var);
488 /**< Returns the interface flag of var. Has side effects in the ascend instance. */
489 extern void var_set_interface(struct var_variable *var, uint32 fixed);
490 /**< Sets the interface flag of var. Has side effects in the ascend instance.
491 @todo solver/var.h: var_set_interface() not implemented. Implement or remove.
492 */
493 /*
494 The above... Gets/sets the fixed/relaxed/interface flag of the variable. This
495 has side effects in the ascend instance, with which
496 we are keeping the bits in sync.
497 */
498
499 #ifdef NDEBUG
500 # define var_in_block(var) ((var)->flags & VAR_INBLOCK)
501 /**< Returns the in_block flag of var as a uint32. */
502 # define var_incident(var) ((var)->flags & VAR_INCIDENT)
503 /**< Returns the incident flag of var as a uint32. */
504
505 # define var_active(var) ((var)->flags & VAR_ACTIVE)
506 /**< Returns the active flag of var as a uint32. */
507 # define var_nonbasic(var) ((var)->flags & VAR_NONBASIC)
508 /**< Returns the nonbasic flag of var as a uint32. */
509 # define var_active_at_bnd(var) ((var)->flags & VAR_ACTIVE_AT_BND)
510 /**< Returns the active_at_bnd flag of var as a uint32. */
511 # define var_eligible(var) ((var)->flags & VAR_ELIGIBLE)
512 /**< Returns the eligible flag of var as a uint32. */
513 # define var_eligible_in_subregion(var) ((var)->flags & VAR_ELIGIBLE_IN_SUBREGION)
514 /**< Returns the eligible_in_subregion flag of var as a uint32. */
515 # define var_incident_in_case(var) ((var)->flags & VAR_INCIDENT_IN_CASE)
516 /**< Returns the incident_in_case flag of var as a uint32. */
517 # define var_potentially_fixed(var) ((var)->flags & VAR_POTENTIALLY_FIXED)
518 /**< Returns the potentially_fixed flag of var as a uint32. */
519 #else
520 # define var_in_block(var) var_flagbit((var),VAR_INBLOCK)
521 /**< Returns the in_block flag of var as a uint32. */
522
523 # define var_incident(var) var_flagbit((var),VAR_INCIDENT)
524 /**< Returns the incident flag of var as a uint32. */
525 # define var_active(var) var_flagbit((var),VAR_ACTIVE)
526 /**< Returns the active flag of var as a uint32. */
527 # define var_nonbasic(var) var_flagbit((var),VAR_NONBASIC)
528 /**< Returns the nonbasic flag of var as a uint32. */
529 # define var_active_at_bnd(var) var_flagbit((var),VAR_ACTIVE_AT_BND)
530 /**< Returns the active_at_bnd flag of var as a uint32. */
531 # define var_eligible(var) var_flagbit((var),VAR_ELIGIBLE)
532 /**< Returns the eligible flag of var as a uint32. */
533 # define var_eligible_in_subregion(var) var_flagbit((var),VAR_ELIGIBLE_IN_SUBREGION)
534 /**< Returns the eligible_in_subregion flag of var as a uint32. */
535 # define var_incident_in_case(var) var_flagbit((var),VAR_INCIDENT_IN_CASE)
536 /**< Returns the incident_in_case flag of var as a uint32. */
537 # define var_potentially_fixed(var) var_flagbit((var),VAR_POTENTIALLY_FIXED)
538 /**< Returns the potentially_fixed flag of var as a uint32. */
539 #endif /* NDEBUG */
540
541 #define var_set_in_block(var,oneorzero) \
542 var_set_flagbit((var),VAR_INBLOCK,(oneorzero))
543 /**< Sets the in_block flag of var on (1) or off (0). */
544 #define var_set_incident(var,oneorzero) \
545 var_set_flagbit((var),VAR_INCIDENT,(oneorzero))
546 /**< Sets the incident flag of var on (1) or off (0). */
547 #define var_set_interface(var,oneorzero) \
548 var_set_flagbit((var),VAR_INTERFACE,(oneorzero))
549 /**< Sets the interface flag of var on (1) or off (0). */
550 #define var_set_active(var,oneorzero) \
551 var_set_flagbit((var),VAR_ACTIVE,(oneorzero))
552 /**< Sets the active flag of var on (1) or off (0). */
553 #define var_set_nonbasic(var,oneorzero) \
554 var_set_flagbit((var),VAR_NONBASIC,(oneorzero))
555 /**< Sets the nonbasic flag of var on (1) or off (0). */
556 #define var_set_active_at_bnd(var,oneorzero) \
557 var_set_flagbit((var),VAR_ACTIVE_AT_BND,(oneorzero))
558 /**< Sets the active_at_bnd flag of var on (1) or off (0). */
559 #define var_set_eligible(var,oneorzero) \
560 var_set_flagbit((var),VAR_ELIGIBLE,(oneorzero))
561 /**< Sets the eligible flag of var on (1) or off (0). */
562 #define var_set_eligible_in_subregion(var,oneorzero) \
563 var_set_flagbit((var),VAR_ELIGIBLE_IN_SUBREGION,(oneorzero))
564 /**< Sets the eligible_in_subregion flag of var on (1) or off (0). */
565 #define var_set_incident_in_case(var,oneorzero) \
566 var_set_flagbit((var),VAR_INCIDENT_IN_CASE,(oneorzero))
567 /**< Sets the incident_in_case flag of var on (1) or off (0). */
568 #define var_set_potentially_fixed(var,oneorzero) \
569 var_set_flagbit((var),VAR_POTENTIALLY_FIXED,(oneorzero))
570 /**< Sets the potentially_fixed flag of var on (1) or off (0). */
571
572 extern struct var_variable **
573 var_BackendTokens_to_vars(slv_system_t sys, SlvBackendToken *tokenlist, int32 len);
574 /**<
575 varp is NULL iff something is amiss, OTHERWISE it
576 contains len struct var_variable * s.
577 The user should free the array varp when done with it.
578 Some entries in the array varp may be NULL if the tokenlist
579 contains a token which is not from the sys given.
580 tokenlist[i] <--> varp[i];<br><br>
581
582 The whole point of a slv_system_t is to isolate the client from
583 the compiler backend. Clients who find themselves in need of
584 this function are very much in need of rethinking as well.
585 For that reason, among others, this function is not heavily
586 optimized, it is however reasonable for 1-off jobs.<br><br>
587
588 CPU Cost = k1*complexity of the instance under sys +
589 k2*number of vars in sys + k3*len.
590
591 @todo Hasn't been through verification and testing - SQA asleep.
592 */
593
594 /*
595 * What constitutes a solver_var (and some other interesting types)
596 * is controlled by the ascend server via the following functions.
597 * Clients shouldn't use these.
598 */
599
600 #define SOLVER_VAR_STR "solver_var"
601 #define SOLVER_INT_STR "solver_int"
602 #define SOLVER_BINARY_STR "solver_binary"
603 #define SOLVER_SEMI_STR "solver_semi"
604
605 #define solver_par(i) (0)
606
607 extern boolean solver_var(SlvBackendToken inst);
608 /**<
609 Returns true if the instance in question matches the currently
610 known definition of solver_var. Since these definitions
611 involve refinement, solver_var() will report TRUE on variables
612 matching any of these types:
613 - solver_var
614 - solver_int
615 - solver_binary
616 - solver_semi
617
618 SERVER ONLY. clients should just look at the flagbits.
619 */
620 extern boolean solver_int(SlvBackendToken inst);
621 /**<
622 Returns true if the instance in question matches the currently
623 known definition of solver_int.
624 SERVER ONLY. clients should just look at the flagbits.
625 */
626 extern boolean solver_binary(SlvBackendToken inst);
627 /**<
628 Returns true if the instance in question matches the currently
629 known definition of solver_binary.
630 SERVER ONLY. clients should just look at the flagbits.
631 */
632 extern boolean solver_semi(SlvBackendToken inst);
633 /**<
634 Returns true if the instance in question matches the currently
635 known definition of solver_semi.
636 SERVER ONLY. clients should just look at the flagbits.
637 */
638 /* For the above...
639 Note that these definitions involve refinement, so
640 solver_var will report TRUE on variables matching any of
641 these types, while solver_binary will only be TRUE on binaries.
642
643 hierarchy is solvervar-\----solver_int-----solver_binary
644 \-solver_semi
645
646 */
647
648 extern boolean set_solver_types(void);
649 /**<
650 Sets (changes) the current definition of solver_var to match
651 the current library. Returns 1 if unsuccessful, 0 if ok.
652 If 1, it is useless to invoke the solvers.
653 Also sets all the related types listed above.
654 */
655
656 #endif /* ASC_VAR_H */
657

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