1 |
aw0a |
1 |
/* |
2 |
|
|
* Problem Analysis Routines |
3 |
|
|
* by Benjamin Andrew Allan |
4 |
|
|
* 5/19/96 |
5 |
|
|
* Version: $Revision: 1.10 $ |
6 |
|
|
* Version control file: $RCSfile: analyze.h,v $ |
7 |
|
|
* Date last modified: $Date: 1997/07/18 12:13:50 $ |
8 |
|
|
* Last modified by: $Author: mthomas $ |
9 |
|
|
* Copyright(C) 1996 Benjamin Andrew Allan |
10 |
|
|
* |
11 |
|
|
* This file is part of the ASCEND IV math programming system. |
12 |
|
|
* |
13 |
|
|
* The SLV solver is free software; you can redistribute |
14 |
|
|
* it and/or modify it under the terms of the GNU General Public License as |
15 |
|
|
* published by the Free Software Foundation; either version 2 of the |
16 |
|
|
* License, or (at your option) any later version. |
17 |
|
|
* |
18 |
|
|
* The SLV solver is distributed in hope that it will be |
19 |
|
|
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
20 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
21 |
|
|
* General Public License for more details. |
22 |
|
|
* |
23 |
|
|
* You should have received a copy of the GNU General Public License |
24 |
|
|
* along with the program; if not, write to the Free Software Foundation, |
25 |
|
|
* Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check the file named |
26 |
|
|
* COPYING. COPYING is found in ../compiler. |
27 |
|
|
* |
28 |
|
|
* |
29 |
|
|
* These functions are the start of a new design for feeding |
30 |
|
|
* solvers from the ASCEND compiler or any arbitrary backend. |
31 |
|
|
* |
32 |
|
|
* The intention is that eventually the other code in the solver |
33 |
|
|
* directory will really be for *solution algorithms* and the |
34 |
|
|
* definition of a *problem* will come from here. In essence, most |
35 |
|
|
* of what was solver/system.c will be here. Negotiating directly |
36 |
|
|
* with the ASCEND instance hierarchy should not be a solver's |
37 |
|
|
* job. |
38 |
|
|
* The goal of this module is to CREATE a slv_system_t data structure |
39 |
|
|
* capable of supporting code generation, an interactive interface, and |
40 |
|
|
* in-core solvers, while being expandable in the future to out of core |
41 |
|
|
* solvers/external-process solvers. |
42 |
|
|
* |
43 |
|
|
* A secondary goal is to have nonlinear solver files be independent of |
44 |
|
|
* all the compiler directory files except ascmalloc.h. |
45 |
|
|
* The present fly in the ointment is expr.h because of the objective fcns. |
46 |
|
|
* The relman and exprman modules go away because they are indicative of |
47 |
|
|
* functionality that belongs either in the compiler or rel.c. |
48 |
|
|
* If we meet this goal, then it is a simple matter to connect any |
49 |
|
|
* arbitrary compiler backend to the solver API by replacing the rel |
50 |
|
|
* and var and analyze modules. |
51 |
|
|
* |
52 |
|
|
*/ |
53 |
|
|
|
54 |
|
|
#ifndef _analyze_h_seen_ |
55 |
|
|
#define _analyze_h_seen_ |
56 |
|
|
|
57 |
|
|
/* |
58 |
|
|
* requires #include "system.h" |
59 |
|
|
* requires #include "instance_enum.h" |
60 |
|
|
*/ |
61 |
|
|
|
62 |
|
|
/* used to give an integer value to each symbol used in a when */ |
63 |
|
|
struct SymbolValues { |
64 |
|
|
char *name; |
65 |
|
|
int value; |
66 |
|
|
}; |
67 |
|
|
|
68 |
|
|
extern int analyze_make_problem(slv_system_t, struct Instance *); |
69 |
|
|
/* |
70 |
|
|
* Takes a system and populates the guts of it from the instance. |
71 |
|
|
* this implementation of analyze is specific to the ascend compiler |
72 |
|
|
* back end. |
73 |
|
|
*/ |
74 |
|
|
|
75 |
|
|
extern int analyze_remake_problem(slv_system_t); |
76 |
|
|
/* |
77 |
|
|
* Reanalyzes the system, reordering solvers var and relation lists |
78 |
|
|
* if needed. |
79 |
|
|
*/ |
80 |
|
|
|
81 |
|
|
extern void analyze_free_reused_mem(void); |
82 |
|
|
/* |
83 |
|
|
* Resets all internal memory recycles. |
84 |
|
|
*/ |
85 |
|
|
|
86 |
|
|
extern int varinst_found_in_whenlist(slv_system_t, struct Instance *); |
87 |
|
|
/* |
88 |
|
|
* Determine if the conditional variable inst is part of the |
89 |
|
|
* variable list of some when in the when list of slv_system_t |
90 |
|
|
*/ |
91 |
|
|
|
92 |
|
|
extern int dis_var_in_a_when(struct Instance *, struct w_when *); |
93 |
|
|
/* |
94 |
|
|
* return 1 if the discrete var is a member of the when var list, else |
95 |
|
|
* return 0 |
96 |
|
|
*/ |
97 |
|
|
|
98 |
|
|
extern int GetIntFromSymbol(CONST char *,struct gl_list_t *); |
99 |
|
|
/* |
100 |
|
|
* Creates the gl list of SymboValues struct to asign an integer |
101 |
|
|
* value to a symbol value |
102 |
|
|
*/ |
103 |
|
|
|
104 |
|
|
extern void DestroySymbolValuesList(struct gl_list_t *); |
105 |
|
|
/* |
106 |
|
|
* Destroy the gl list of SymboValues struct created to asign an integer |
107 |
|
|
* value to symbol value |
108 |
|
|
*/ |
109 |
|
|
|
110 |
|
|
#endif /* _analyze_h_seen_ */ |