1 |
/* |
2 |
Problem Analysis Routines |
3 |
by Benjamin Andrew Allan 5/19/96 |
4 |
|
5 |
Version: $Revision: 1.10 $ |
6 |
Date last modified: $Date: 1997/07/18 12:13:50 $ |
7 |
Last modified by: $Author: mthomas $ |
8 |
Copyright(C) 1996 Benjamin Andrew Allan |
9 |
Copyright(C) 2006 Carnegie Mellon University |
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 |
/** @file |
30 |
Problem Analysis Routines. |
31 |
|
32 |
These functions are the start of a new design for feeding |
33 |
solvers from the ASCEND compiler or any arbitrary backend. |
34 |
|
35 |
The intention is that eventually the other code in the solver |
36 |
directory will really be for *solution algorithms* and the |
37 |
definition of a *problem* will come from here. In essence, most |
38 |
of what was solver/system.c will be here. Negotiating directly |
39 |
with the ASCEND instance hierarchy should not be a solver's |
40 |
job. |
41 |
The goal of this module is to CREATE a slv_system_t data structure |
42 |
capable of supporting code generation, an interactive interface, and |
43 |
in-core solvers, while being expandable in the future to out of core |
44 |
solvers/external-process solvers. |
45 |
|
46 |
A secondary goal is to have nonlinear solver files be independent of |
47 |
all the compiler directory files except ascmalloc.h. |
48 |
The present fly in the ointment is expr.h because of the objective fcns. |
49 |
The relman and exprman modules go away because they are indicative of |
50 |
functionality that belongs either in the compiler or rel.c. |
51 |
If we meet this goal, then it is a simple matter to connect any |
52 |
arbitrary compiler backend to the solver API by replacing the rel |
53 |
and var and analyze modules. |
54 |
|
55 |
Requires: |
56 |
#include "utilities/ascConfig.h" |
57 |
#include "system.h" |
58 |
#include "instance_enum.h" |
59 |
</pre> |
60 |
*/ |
61 |
|
62 |
#ifndef ASC_ANALYZE_H |
63 |
#define ASC_ANALYZE_H |
64 |
|
65 |
/** Used to give an integer value to each symbol used in a when */ |
66 |
struct SymbolValues { |
67 |
char *name; |
68 |
int value; |
69 |
}; |
70 |
|
71 |
extern int analyze_make_problem(slv_system_t sys, struct Instance *inst); |
72 |
/**< |
73 |
Takes a system and populates the guts of it from the instance. |
74 |
|
75 |
@NOTE |
76 |
This implementation of analyze is specific to the ascend compiler |
77 |
back end. |
78 |
*/ |
79 |
|
80 |
#if 0 /* NOT IMPLEMENTED */ |
81 |
extern int analyze_remake_problem(slv_system_t sys); |
82 |
/* |
83 |
Reanalyzes the system, reordering solvers var and relation lists |
84 |
if needed. |
85 |
|
86 |
@todo Not implemented. Remove from header if not needed. |
87 |
*/ |
88 |
#endif |
89 |
|
90 |
extern void analyze_free_reused_mem(void); |
91 |
/**< |
92 |
Resets all internal memory recycles. |
93 |
*/ |
94 |
|
95 |
extern int varinst_found_in_whenlist(slv_system_t sys, struct Instance *inst); |
96 |
/**< |
97 |
Determine if the conditional variable inst is part of the |
98 |
variable list of some when in the when list of slv_system_t |
99 |
*/ |
100 |
|
101 |
extern int dis_var_in_a_when(struct Instance *var, struct w_when *when); |
102 |
/**< |
103 |
Return 1 if the discrete var is a member of the when var list, else |
104 |
return 0 |
105 |
*/ |
106 |
|
107 |
extern int GetIntFromSymbol(CONST char *symval, struct gl_list_t *symbol_list); |
108 |
/**< |
109 |
Creates the gl_list of SymboValues struct to asign an integer |
110 |
value to a symbol value |
111 |
*/ |
112 |
|
113 |
extern void DestroySymbolValuesList(struct gl_list_t *symbol_list); |
114 |
/**< |
115 |
Destroy the gl_list of SymbolValues struct created to asign an integer |
116 |
value to symbol value |
117 |
*/ |
118 |
|
119 |
#endif /* ASC_ANALYZE_H */ |