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