-
Notifications
You must be signed in to change notification settings - Fork 1
/
globals.c
270 lines (235 loc) · 9.33 KB
/
globals.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
/* File: globals.c
*
* Defines global variables for the DISCERN system.
*
* Copyright (C) 1994 Risto Miikkulainen
*
* This software can be copied, modified and distributed freely for
* educational and research purposes, provided that this notice is included
* in the code, and the author is acknowledged in any materials and reports
* that result from its use. It may not be used for commercial purposes
* without expressed permission from the author.
*
* $Id: globals.c,v 1.31 1994/09/19 03:16:06 risto Exp $
*/
#ifdef DEFINE_GLOBALS /* Defined in the main.c file */
/* these definitions are in effect in main.c */
/************ general stuff *************/
/* lexical and semantic lexica (for checks); index [-1] is used for blank */
WORDSTRUCT *lwords, *swords; /* actual array pointers */
int nlwords, nswords, /* number of lexical and semantic words */
nlrep, nsrep; /* dimension of lexical and semantic reps */
int sentdelimindex, /* index of period representation */
questdelimindex; /* index of question mark rep */
int instances[MAXWORDS]; /* indices of the instance words */
int ninstances; /* number of instances */
/* story and qa data */
STORYSTRUCT story;
QASTRUCT qa;
int nslot = NONE, /* number of assemblies in story rep */
ncase = NONE; /* number of assemblies in sentence rep */
int
inputs[NMODULES][MAXCASE + MAXSLOT], /* indices of current inputs */
targets[NMODULES][MAXCASE + MAXSLOT], /* indices of current targets*/
ninputs[NMODULES], /* # of word reps at input */
noutputs[NMODULES]; /* # of word reps at output */
/* input and output layers of the modules */
double
inprep[NMODULES][MAXIOREP], /* input layer activities */
outrep[NMODULES][MAXIOREP], /* output layer activities */
tgtrep[NMODULES][MAXIOREP]; /* target activities */
int ninprep[NMODULES], /* input layer dimension */
noutrep[NMODULES]; /* output layer dimension */
/* active reps on the pathways */
double swordrep[MAXREP], /* semantic words in and out of lexicon */
caserep[MAXCASE * MAXREP], /* sentence case-role reps */
slotrep[MAXSLOT * MAXREP]; /* story reps */
int ncaserep, nslotrep; /* dimensions of sentence and story reps */
/* file names */
char initfile[MAXFILENAMEL + 1],/* initialization file */
lrepfile[MAXFILENAMEL + 1], /* lexical representations */
srepfile[MAXFILENAMEL + 1], /* semantic representations */
procfile[MAXFILENAMEL + 1], /* proc simulation file */
hfmfile[MAXFILENAMEL + 1], /* hfm simulation file */
hfminpfile[MAXFILENAMEL + 1], /* hfm labels */
lexfile[MAXFILENAMEL + 1], /* lexicon simulation file */
current_inpfile[MAXFILENAMEL + 1];/* input commands and stories */
/* simulation parameters */
int chain, /* whether modules feed input to each other */
withlex, withhfm, /* whether lexicon and hfm are included */
displaying, /* whether X display is up */
babbling, /* print verbose log output */
print_mistakes, /* print only errors in the log */
log_lexicon, /* print also lexicon translation in log */
ignore_stops, /* do not stop simulation when told so */
text_question; /* flag to process question without target */
/* simulation flags */
int simulator_running, /* flag: process events or run */
stepping, /* stop after every major propagation */
nohfmmouseevents = FALSE, /* whether mouse events are disabled */
nolexmouseevents = FALSE;
double withinerr; /* defines "close enough" error for stats*/
char *promptstr = DISCERNPROMPT;/* prompt in the terminal I/O */
/* graphics data */
XtAppContext app_con; /* application context */
Display *theDisplay; /* display pointer */
Visual *visual; /* type of display */
Colormap colormap; /* colormap definition */
Widget main_widget, form; /* main widget and organization */
NETSTRUCT net[NMODULES]; /* outline of network geometry etc. */
int asmboxhght, titleboxhght; /* size of text boxes */
RESOURCE_DATA data; /* resource data structure */
/************ proc stuff *************/
int nhidrep[NPROCMODULES]; /* hidden layer dimension */
/* units and weights */
double
prevhidrep[NPROCMODULES][MAXHIDREP], /* prevhid layer activities */
hidrep[NPROCMODULES][MAXHIDREP], /* hidden layer activities */
hidbias[NPROCMODULES][MAXHIDREP], /* hidden unit biases */
outbias[NPROCMODULES][MAXIOREP], /* output unit biases */
wih[NPROCMODULES][MAXIOREP][MAXHIDREP], /* input to hidden weights */
who[NPROCMODULES][MAXIOREP][MAXHIDREP], /* hidden to output weights */
wph[NPROCMODULES][MAXHIDREP][MAXHIDREP]; /* prevhid to hidden weights */
/************ lexicon stuff *************/
int nlnet, nsnet; /* size (side) of lex and sem maps */
FMUNIT lunits[MAXLSNET][MAXLSNET], /* lexical feature map */
sunits[MAXLSNET][MAXLSNET]; /* semantic feature map */
double
lsassoc[MAXLSNET][MAXLSNET][MAXLSNET][MAXLSNET], /* lex->sem assoc */
slassoc[MAXLSNET][MAXLSNET][MAXLSNET][MAXLSNET]; /* sem->lex assoc */
/************ hfm stuff *************/
int ntopnet, /* size (side) of top-level maps */
nmidnet, /* size (side) of middle-level maps */
nbotnet; /* size (side) of bottom-level maps */
double topsearch, /* top-level search threshold */
midsearch; /* middle-level search threshold */
FMUNIT topunits[MAXTOPNET][MAXTOPNET], /* top-level maps */
midunits[MAXTOPNET][MAXTOPNET]
[MAXMIDNET][MAXMIDNET], /* middle */
botunits[MAXTOPNET][MAXTOPNET]
[MAXMIDNET][MAXMIDNET]
[MAXBOTNET][MAXBOTNET]; /* bottom-level maps */
int
/* indices of the input components passed down to the middle level */
midindices[MAXTOPNET][MAXTOPNET][MAXSLOT * MAXREP],
nmidindices[MAXTOPNET][MAXTOPNET], /* their number */
/* indices of the input components passed down to the bottom level */
botindices[MAXTOPNET][MAXTOPNET][MAXMIDNET][MAXMIDNET][MAXSLOT * MAXREP],
nbotindices[MAXTOPNET][MAXTOPNET][MAXMIDNET][MAXMIDNET]; /* their number */
/************ trace stuff *************/
int tracenc, /* radius of the trace */
tsettle; /* number of settling iterations */
double minact, /* lower threshold for trace map sigmoid */
maxact, /* upper threshold for trace map sigmoid */
gammaexc, /* exc lat weight on trace feature maps */
gammainh, /* inh lat weight on trace feature maps */
aliveact, /* threshold for successful retrieval */
epsilon; /* min activ. for trace to be stored on unit */
double latweights[MAXTOPNET][MAXTOPNET]
[MAXMIDNET][MAXMIDNET]
[MAXBOTNET][MAXBOTNET]
[MAXBOTNET][MAXBOTNET]; /* lateral weights for trace units */
/************ end definitions *************/
#else
/* these definitions are in effect in all other files except main.c */
extern WORDSTRUCT *lwords, *swords;
extern int nlwords, nswords,
nlrep, nsrep;
extern int
sentdelimindex,
questdelimindex;
extern int instances[MAXWORDS];
extern int ninstances;
extern STORYSTRUCT story;
extern QASTRUCT qa;
extern int nslot,
ncase;
extern int
inputs[NMODULES][MAXCASE + MAXSLOT],
targets[NMODULES][MAXCASE + MAXSLOT],
ninputs[NMODULES],
noutputs[NMODULES];
extern double
inprep[NMODULES][MAXIOREP],
outrep[NMODULES][MAXIOREP],
tgtrep[NMODULES][MAXIOREP];
extern int ninprep[NMODULES],
noutrep[NMODULES];
extern double swordrep[MAXREP],
caserep[MAXCASE * MAXREP],
slotrep[MAXSLOT * MAXREP];
extern int ncaserep, nslotrep;
extern char initfile[MAXFILENAMEL + 1],
lrepfile[MAXFILENAMEL + 1],
srepfile[MAXFILENAMEL + 1],
procfile[MAXFILENAMEL + 1],
hfmfile[MAXFILENAMEL + 1],
hfminpfile[MAXFILENAMEL + 1],
lexfile[MAXFILENAMEL + 1],
current_inpfile[MAXFILENAMEL + 1];
extern int chain,
withlex, withhfm,
displaying,
babbling,
print_mistakes,
log_lexicon,
ignore_stops,
text_question;
extern int simulator_running,
stepping,
nohfmmouseevents,
nolexmouseevents;
extern double withinerr;
extern char *promptstr;
extern XtAppContext app_con;
extern Display *theDisplay;
extern Visual *visual;
extern Colormap colormap;
extern Widget main_widget, form;
extern NETSTRUCT net[NMODULES];
extern int asmboxhght, titleboxhght;
extern RESOURCE_DATA data;
extern int nhidrep[NPROCMODULES];
extern double
prevhidrep[NPROCMODULES][MAXHIDREP],
hidrep[NPROCMODULES][MAXHIDREP],
hidbias[NPROCMODULES][MAXHIDREP],
outbias[NPROCMODULES][MAXIOREP],
wih[NPROCMODULES][MAXIOREP][MAXHIDREP],
who[NPROCMODULES][MAXIOREP][MAXHIDREP],
wph[NPROCMODULES][MAXHIDREP][MAXHIDREP];
extern int nlnet, nsnet;
extern FMUNIT lunits[MAXLSNET][MAXLSNET],
sunits[MAXLSNET][MAXLSNET];
extern double
lsassoc[MAXLSNET][MAXLSNET][MAXLSNET][MAXLSNET],
slassoc[MAXLSNET][MAXLSNET][MAXLSNET][MAXLSNET];
extern int ntopnet,
nmidnet,
nbotnet;
extern double topsearch,
midsearch;
extern FMUNIT topunits[MAXTOPNET][MAXTOPNET],
midunits[MAXTOPNET][MAXTOPNET]
[MAXMIDNET][MAXMIDNET],
botunits[MAXTOPNET][MAXTOPNET]
[MAXMIDNET][MAXMIDNET]
[MAXBOTNET][MAXBOTNET];
extern int
midindices[MAXTOPNET][MAXTOPNET][MAXSLOT * MAXREP],
nmidindices[MAXTOPNET][MAXTOPNET],
botindices[MAXTOPNET][MAXTOPNET][MAXMIDNET][MAXMIDNET][MAXSLOT * MAXREP],
nbotindices[MAXTOPNET][MAXTOPNET][MAXMIDNET][MAXMIDNET];
extern int tracenc,
tsettle;
extern double minact,
maxact,
gammaexc,
gammainh,
aliveact,
epsilon;
extern double latweights[MAXTOPNET][MAXTOPNET]
[MAXMIDNET][MAXMIDNET]
[MAXBOTNET][MAXBOTNET]
[MAXBOTNET][MAXBOTNET];
#endif /* #ifdef DEFINE_GLOBALS */