1 |
aw0a |
1 |
/* |
2 |
|
|
* Logical Relation Manipulator Module |
3 |
|
|
* Created: 04/97 |
4 |
|
|
* Version: $Revision: 1.3 $ |
5 |
|
|
* Version control file: $RCSfile: logrelman.h,v $ |
6 |
|
|
* Date last modified: $Date: 1997/07/18 12:14:41 $ |
7 |
|
|
* Last modified by: $Author: mthomas $ |
8 |
|
|
* |
9 |
|
|
* This file is part of the SLV solver. |
10 |
|
|
* |
11 |
|
|
* The SLV solver is free software; you can redistribute |
12 |
|
|
* it and/or modify it under the terms of the GNU General Public License as |
13 |
|
|
* published by the Free Software Foundation; either version 2 of the |
14 |
|
|
* License, or (at your option) any later version. |
15 |
|
|
* |
16 |
|
|
* The SLV solver is distributed in hope that it will be |
17 |
|
|
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
18 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
19 |
|
|
* General Public License for more details. |
20 |
|
|
* |
21 |
|
|
* You should have received a copy of the GNU General Public License |
22 |
|
|
* along with the program; if not, write to the Free Software Foundation, |
23 |
|
|
* Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check the file named |
24 |
|
|
* COPYING. COPYING is found in ../compiler. |
25 |
|
|
* |
26 |
|
|
*/ |
27 |
|
|
|
28 |
|
|
/* |
29 |
|
|
* Contents: Logical Relation manipulator module |
30 |
|
|
* |
31 |
|
|
* Authors: Vicente Rico-Ramirez based on relman.[ch] |
32 |
|
|
* |
33 |
|
|
* Dates: 04/97 - original version |
34 |
|
|
* |
35 |
|
|
* Description: This module will provide supplemental operations for |
36 |
|
|
* lofical relations such as evaluation. |
37 |
|
|
*/ |
38 |
|
|
|
39 |
|
|
#ifndef logrelman__already_included |
40 |
|
|
#define logrelman__already_included |
41 |
|
|
|
42 |
|
|
/* |
43 |
|
|
* requires #include "mtx.h" |
44 |
|
|
* requires #include "discrete.h" |
45 |
|
|
* requires #include "logrel.h" |
46 |
|
|
*/ |
47 |
|
|
|
48 |
|
|
|
49 |
|
|
extern void logrelman_get_incidence(struct logrel_relation *, |
50 |
|
|
dis_filter_t *,mtx_matrix_t); |
51 |
|
|
/* |
52 |
|
|
* logrelman_get_incidence(lrel,filter,matrix) |
53 |
|
|
* struct logrel_relation *lrel; |
54 |
|
|
* dis_filter_t *filter; |
55 |
|
|
* mtx_matrix_t matrix; |
56 |
|
|
* |
57 |
|
|
* Upon return, coefficient (logrel_n,disvar_n)(using original row and |
58 |
|
|
* column numbers) is non-zero if and only if the logical relation lrel |
59 |
|
|
* with index logrel_n depends on a discrete variable with index disvar_n. |
60 |
|
|
*/ |
61 |
|
|
|
62 |
|
|
|
63 |
|
|
extern int32 logrelman_eval(struct logrel_relation *, int32 *); |
64 |
|
|
/* |
65 |
|
|
* logresidual = logrelman_eval(lrel,status) |
66 |
|
|
* struct logrel_relation *lrel; |
67 |
|
|
* int32 *status; |
68 |
|
|
* int32 logresidual; |
69 |
|
|
* |
70 |
|
|
* The residual of the logical relation is calculated and returned. |
71 |
|
|
* In addition to returning the residual, the residual field of the |
72 |
|
|
* relation is updated. The status value can be monitored to |
73 |
|
|
* determine if any calculation errors were encountered. It will be set |
74 |
|
|
* 0 if a calculation results in an error. |
75 |
|
|
* The logresidual field of the logical relation is not updated when |
76 |
|
|
* an error occurs. |
77 |
|
|
*/ |
78 |
|
|
|
79 |
|
|
|
80 |
|
|
extern boolean logrelman_calc_satisfied(struct logrel_relation *); |
81 |
|
|
/* |
82 |
|
|
* satisfied = logrelman_calc_satisfied(lrel) |
83 |
|
|
* boolean satisfied; |
84 |
|
|
* |
85 |
|
|
* logrelman_calc_satisfied: |
86 |
|
|
* Returns TRUE or FALSE depending on whether the logical relation, whose |
87 |
|
|
* boolean residual has been previously calculated, is satisfied based on |
88 |
|
|
* the value stored in the residual field. The satisfied field of the |
89 |
|
|
* logical relation is also updated. |
90 |
|
|
*/ |
91 |
|
|
|
92 |
|
|
|
93 |
|
|
extern int32 *logrelman_directly_solve(struct logrel_relation *, |
94 |
|
|
struct dis_discrete *, |
95 |
|
|
int *,int *, int, |
96 |
|
|
struct gl_list_t *); |
97 |
|
|
/* |
98 |
|
|
* solution_list = logrelman_directly_solve(lrel,solvefor,able,nsolns, |
99 |
|
|
* perturb,insts) |
100 |
|
|
* int32 *solution_list; |
101 |
|
|
* struct logrel_relation *lrel; |
102 |
|
|
* struct dis_discrete *solvefor; |
103 |
|
|
* int *able; |
104 |
|
|
* int *nsolns; |
105 |
|
|
* int perturb; |
106 |
|
|
* struct gl_list_t *insts; |
107 |
|
|
* |
108 |
|
|
* Attempts to solve the given logical equation for the given variable. |
109 |
|
|
* If this function is able to determine the solution set, then *able |
110 |
|
|
* is set to TRUE and a newly allocated solution list is returned: |
111 |
|
|
* *nsolns will be set to the length of this array. |
112 |
|
|
* Otherwise *able is FALSE and NULL is returned. NULL may also be |
113 |
|
|
* returned if the solution set is empty. |
114 |
|
|
* The flag perturb and the gl_list are used to change the truth |
115 |
|
|
* value of some boundaries. This is sometimes useful in |
116 |
|
|
* conditional modeling. |
117 |
|
|
*/ |
118 |
|
|
|
119 |
|
|
|
120 |
|
|
extern char *logrelman_make_string_infix(slv_system_t, |
121 |
|
|
struct logrel_relation *,int); |
122 |
|
|
extern char *logrelman_make_string_postfix(slv_system_t, |
123 |
|
|
struct logrel_relation *,int); |
124 |
|
|
/* |
125 |
|
|
* string = logrelman_make_string_infix(sys,lrel,style) |
126 |
|
|
* string = logrelman_make_string_postfix(sys,lrel,style) |
127 |
|
|
* int style = FALSE; |
128 |
|
|
* char *string; |
129 |
|
|
* struct logrel_relation *lrel; |
130 |
|
|
* |
131 |
|
|
* Creates a sufficiently large string (you must free it when you're |
132 |
|
|
* done with it) into which it converts a logical relation. |
133 |
|
|
* The string will be terminated with a '\0' character. |
134 |
|
|
* The name of a discrete var is context dependent, so you have to |
135 |
|
|
* provide the slv_system_t from which you got the logical relation. |
136 |
|
|
*/ |
137 |
|
|
|
138 |
|
|
#endif /* logrelman__already_included */ |
139 |
|
|
|