/[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 908 - (show annotations) (download) (as text)
Thu Oct 26 10:18:53 2006 UTC (14 years, 4 months ago) by johnpye
File MIME type: text/x-chdr
File size: 24461 byte(s)
first attempt at merging with Ben's changes on the trunk
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 #ifdef NDEBUG
331 # define var_n_incidences(var) ((var)->n_incidences)
332 #else
333 ASC_DLLSPEC(int32) var_n_incidencesF(struct var_variable *var);
334 # define var_n_incidences(var) var_n_incidencesF(var)
335 #endif
336 /**<
337 Returns the length of the incidence list.
338 Not everything in the incidence list is necessarily a
339 variable for your particular solver -- check the flags.
340 @param var const struct var_variable *, the variable to query.
341 @return Returns the index as an int32.
342 @see var_n_incidencesF().
343 */
344
345 #ifdef NDEBUG
346 # define var_set_incidences(var,n,ilist) \
347 (var)->n_incidences=(n); (var)->incidence = (ilist)
348 #else
349 # define var_set_incidences(var,n,ilist) var_set_incidencesF((var),(n),(ilist))
350 #endif
351 /**<
352 Sets the incidence list for a variable.
353 Solver clients should not call var_set_incidences(). It is
354 only for use by constructors of bridges to varation back ends.
355 @param var struct var_variable *, the variable to query.
356 @param n int32, length of the new incidence list.
357 @param ilist struct rel_relation **, the new incidence list.
358 @return No return value.
359 @see var_set_incidencesF().
360 */
361
362 extern void var_set_incidencesF(struct var_variable *var,
363 int32 n,
364 struct rel_relation **ilist);
365 /**<
366 Implementation function for var_set_incidences(). Do not call this
367 function directly - use var_set_incidences() instead.
368 */
369
370 ASC_DLLSPEC(struct rel_relation **) var_incidence_list_to_modify(
371 struct var_variable *var);
372 /**< Same as var_incidence_list(), except the returned list is modifiable. */
373
374 extern const struct rel_relation **var_incidence_list(struct var_variable *var);
375 /**<
376 Returns a pointer to an array var_n_incidences(var) long of vars.
377 Each element of the array is a struct rel_relation *.
378 Check the var sindex to see where each might go in a jacobian.
379 If there is no incidence, NULL is returned.
380 Pointers in this array will be unique.
381
382 The list belongs to the varation. Do not destroy it. Do not change it.
383
384 RA IS NOT a NULL-TERMINATED LIST.
385 */
386
387 #ifdef NDEBUG
388 # define var_flags(var) ((var)->flags)
389 #else
390 # define var_flags(var) var_flagsF(var)
391 #endif
392 /**<
393 Returns the flags field of the var. This flags value should
394 be composed of the var_xxx values defined above.
395 @param var const struct var_variable *, the variable to query.
396 @return Returns the index as an int32.
397 @see var_flagsF().
398 */
399
400 #ifdef NDEBUG
401 # define var_set_flags(var,flags) ((var)->flags = (flags))
402 #else
403 # define var_set_flags(var,flags) var_set_flagsF((var),(flags))
404 #endif
405 /**<
406 Sets the entire flag field to the value of flags given.
407 This flags value should be composed of the var_xxx values
408 defined above.
409 @param var struct var_variable *, the variable to query.
410 @param flags uint32, the new flags value.
411 @return No return value.
412 @see var_set_flagsF().
413 */
414
415 ASC_DLLSPEC(uint32) var_flagsF(const struct var_variable *var);
416 /**<
417 Implementation function for var_flags(). Do not call this
418 function directly - use var_flags() instead.
419 */
420 extern void var_set_flagsF(struct var_variable *var, uint32 flags);
421 /**<
422 Implementation function for var_set_flags(). Do not call this
423 function directly - use var_set_flags() instead.
424 */
425
426 ASC_DLLSPEC(uint32) var_flagbit(const struct var_variable *rel, const uint32 name);
427 /**<
428 Returns the value of the bit specified from the variable flags.
429 name should be a VAR_xx flag defined above.
430 */
431
432 ASC_DLLSPEC(void ) var_set_flagbit(struct var_variable *var,
433 uint32 NAME,
434 uint32 oneorzero);
435 /**<
436 Sets the bit, which should be referred to by its macro name,
437 on if oneorzero is >0 and off is oneorzero is 0.
438 The macro names are the defined up at the top of this file.<br><br>
439
440 Example: var_set_flags(var,VAR_PARTITION,1) turns on the
441 VAR_PARTITION bit.
442 <pre>
443 What it really does is:
444 if (oneorzero) {
445 var->flags |= field;
446 } else {
447 var->flags &= ~field;
448 }
449 </pre>
450 */
451
452 /*
453 * At present there is some insanity about asking the instance tree
454 * vs asking our data structure about the flag values. This needs to
455 * be fixed. In the process of that fix, we should establish a
456 * protocol that means vars/rels never need to look back at ATOM
457 * instances to be queried during the solution process. Rather, we
458 * need to establish a process in which the var list tells all its
459 * atoms about the solver derived values or the var list updates
460 * its values and flags from the instance tree.
461 * There is a counterpart exercise that needs to go on in the
462 * rel module so that (for remote processing) it is possible to
463 * do everything without looking back at the instance tree.
464 * At present, we will always keep VAR_FIXED in sync with the
465 * instance tree, but the instance tree is the leader.
466 * 6/96. baa
467 */
468
469 ASC_DLLSPEC(int32 ) var_apply_filter(const struct var_variable *var,
470 const var_filter_t *filter);
471 /**<
472 Returns 1 if filter and var flags are compatible, 0 elsewise.
473 See the filter description in rel.h. This is exactly the same.
474 */
475
476 ASC_DLLSPEC(uint32 ) var_fixed(struct var_variable *var);
477 /**< Returns the fixed flag of var. Has side effects in the ascend instance. */
478 extern void var_set_fixed(struct var_variable *var, uint32 fixed);
479 /**< Sets the fixed flag of var. Has side effects in the ascend instance. */
480 extern uint32 var_relaxed(struct var_variable *var);
481 /**< Returns the relaxed flag of var. Has side effects in the ascend instance. */
482 extern void var_set_relaxed(struct var_variable *var, uint32 fixed);
483 /**< Sets the relaxed flag of var. Has side effects in the ascend instance. */
484 extern uint32 var_interface(struct var_variable *var);
485 /**< Returns the interface flag of var. Has side effects in the ascend instance. */
486 extern void var_set_interface(struct var_variable *var, uint32 fixed);
487 /**< Sets the interface flag of var. Has side effects in the ascend instance.
488 @todo solver/var.h: var_set_interface() not implemented. Implement or remove.
489 */
490 /*
491 The above... Gets/sets the fixed/relaxed/interface flag of the variable. This
492 has side effects in the ascend instance, with which
493 we are keeping the bits in sync.
494 */
495
496 #ifdef NDEBUG
497 # define var_in_block(var) ((var)->flags & VAR_INBLOCK)
498 /**< Returns the in_block flag of var as a uint32. */
499 # define var_incident(var) ((var)->flags & VAR_INCIDENT)
500 /**< Returns the incident flag of var as a uint32. */
501
502 # define var_active(var) ((var)->flags & VAR_ACTIVE)
503 /**< Returns the active flag of var as a uint32. */
504 # define var_nonbasic(var) ((var)->flags & VAR_NONBASIC)
505 /**< Returns the nonbasic flag of var as a uint32. */
506 # define var_active_at_bnd(var) ((var)->flags & VAR_ACTIVE_AT_BND)
507 /**< Returns the active_at_bnd flag of var as a uint32. */
508 # define var_eligible(var) ((var)->flags & VAR_ELIGIBLE)
509 /**< Returns the eligible flag of var as a uint32. */
510 # define var_eligible_in_subregion(var) ((var)->flags & VAR_ELIGIBLE_IN_SUBREGION)
511 /**< Returns the eligible_in_subregion flag of var as a uint32. */
512 # define var_incident_in_case(var) ((var)->flags & VAR_INCIDENT_IN_CASE)
513 /**< Returns the incident_in_case flag of var as a uint32. */
514 # define var_potentially_fixed(var) ((var)->flags & VAR_POTENTIALLY_FIXED)
515 /**< Returns the potentially_fixed flag of var as a uint32. */
516 #else
517 # define var_in_block(var) var_flagbit((var),VAR_INBLOCK)
518 /**< Returns the in_block flag of var as a uint32. */
519
520 # define var_incident(var) var_flagbit((var),VAR_INCIDENT)
521 /**< Returns the incident flag of var as a uint32. */
522 # define var_active(var) var_flagbit((var),VAR_ACTIVE)
523 /**< Returns the active flag of var as a uint32. */
524 # define var_nonbasic(var) var_flagbit((var),VAR_NONBASIC)
525 /**< Returns the nonbasic flag of var as a uint32. */
526 # define var_active_at_bnd(var) var_flagbit((var),VAR_ACTIVE_AT_BND)
527 /**< Returns the active_at_bnd flag of var as a uint32. */
528 # define var_eligible(var) var_flagbit((var),VAR_ELIGIBLE)
529 /**< Returns the eligible flag of var as a uint32. */
530 # define var_eligible_in_subregion(var) var_flagbit((var),VAR_ELIGIBLE_IN_SUBREGION)
531 /**< Returns the eligible_in_subregion flag of var as a uint32. */
532 # define var_incident_in_case(var) var_flagbit((var),VAR_INCIDENT_IN_CASE)
533 /**< Returns the incident_in_case flag of var as a uint32. */
534 # define var_potentially_fixed(var) var_flagbit((var),VAR_POTENTIALLY_FIXED)
535 /**< Returns the potentially_fixed flag of var as a uint32. */
536 #endif /* NDEBUG */
537
538 #define var_set_in_block(var,oneorzero) \
539 var_set_flagbit((var),VAR_INBLOCK,(oneorzero))
540 /**< Sets the in_block flag of var on (1) or off (0). */
541 #define var_set_incident(var,oneorzero) \
542 var_set_flagbit((var),VAR_INCIDENT,(oneorzero))
543 /**< Sets the incident flag of var on (1) or off (0). */
544 #define var_set_interface(var,oneorzero) \
545 var_set_flagbit((var),VAR_INTERFACE,(oneorzero))
546 /**< Sets the interface flag of var on (1) or off (0). */
547 #define var_set_active(var,oneorzero) \
548 var_set_flagbit((var),VAR_ACTIVE,(oneorzero))
549 /**< Sets the active flag of var on (1) or off (0). */
550 #define var_set_nonbasic(var,oneorzero) \
551 var_set_flagbit((var),VAR_NONBASIC,(oneorzero))
552 /**< Sets the nonbasic flag of var on (1) or off (0). */
553 #define var_set_active_at_bnd(var,oneorzero) \
554 var_set_flagbit((var),VAR_ACTIVE_AT_BND,(oneorzero))
555 /**< Sets the active_at_bnd flag of var on (1) or off (0). */
556 #define var_set_eligible(var,oneorzero) \
557 var_set_flagbit((var),VAR_ELIGIBLE,(oneorzero))
558 /**< Sets the eligible flag of var on (1) or off (0). */
559 #define var_set_eligible_in_subregion(var,oneorzero) \
560 var_set_flagbit((var),VAR_ELIGIBLE_IN_SUBREGION,(oneorzero))
561 /**< Sets the eligible_in_subregion flag of var on (1) or off (0). */
562 #define var_set_incident_in_case(var,oneorzero) \
563 var_set_flagbit((var),VAR_INCIDENT_IN_CASE,(oneorzero))
564 /**< Sets the incident_in_case flag of var on (1) or off (0). */
565 #define var_set_potentially_fixed(var,oneorzero) \
566 var_set_flagbit((var),VAR_POTENTIALLY_FIXED,(oneorzero))
567 /**< Sets the potentially_fixed flag of var on (1) or off (0). */
568
569 extern struct var_variable **
570 var_BackendTokens_to_vars(slv_system_t sys, SlvBackendToken *tokenlist, int32 len);
571 /**<
572 varp is NULL iff something is amiss, OTHERWISE it
573 contains len struct var_variable * s.
574 The user should free the array varp when done with it.
575 Some entries in the array varp may be NULL if the tokenlist
576 contains a token which is not from the sys given.
577 tokenlist[i] <--> varp[i];<br><br>
578
579 The whole point of a slv_system_t is to isolate the client from
580 the compiler backend. Clients who find themselves in need of
581 this function are very much in need of rethinking as well.
582 For that reason, among others, this function is not heavily
583 optimized, it is however reasonable for 1-off jobs.<br><br>
584
585 CPU Cost = k1*complexity of the instance under sys +
586 k2*number of vars in sys + k3*len.
587
588 @todo Hasn't been through verification and testing - SQA asleep.
589 */
590
591 /*
592 * What constitutes a solver_var (and some other interesting types)
593 * is controlled by the ascend server via the following functions.
594 * Clients shouldn't use these.
595 */
596
597 #define SOLVER_VAR_STR "solver_var"
598 #define SOLVER_INT_STR "solver_int"
599 #define SOLVER_BINARY_STR "solver_binary"
600 #define SOLVER_SEMI_STR "solver_semi"
601
602 #define solver_par(i) (0)
603
604 extern boolean solver_var(SlvBackendToken inst);
605 /**<
606 Returns true if the instance in question matches the currently
607 known definition of solver_var. Since these definitions
608 involve refinement, solver_var() will report TRUE on variables
609 matching any of these types:
610 - solver_var
611 - solver_int
612 - solver_binary
613 - solver_semi
614
615 SERVER ONLY. clients should just look at the flagbits.
616 */
617 extern boolean solver_int(SlvBackendToken inst);
618 /**<
619 Returns true if the instance in question matches the currently
620 known definition of solver_int.
621 SERVER ONLY. clients should just look at the flagbits.
622 */
623 extern boolean solver_binary(SlvBackendToken inst);
624 /**<
625 Returns true if the instance in question matches the currently
626 known definition of solver_binary.
627 SERVER ONLY. clients should just look at the flagbits.
628 */
629 extern boolean solver_semi(SlvBackendToken inst);
630 /**<
631 Returns true if the instance in question matches the currently
632 known definition of solver_semi.
633 SERVER ONLY. clients should just look at the flagbits.
634 */
635 /* For the above...
636 Note that these definitions involve refinement, so
637 solver_var will report TRUE on variables matching any of
638 these types, while solver_binary will only be TRUE on binaries.
639
640 hierarchy is solvervar-\----solver_int-----solver_binary
641 \-solver_semi
642
643 */
644
645 extern boolean set_solver_types(void);
646 /**<
647 Sets (changes) the current definition of solver_var to match
648 the current library. Returns 1 if unsuccessful, 0 if ok.
649 If 1, it is useless to invoke the solvers.
650 Also sets all the related types listed above.
651 */
652
653 #endif /* ASC_VAR_H */
654

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