-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodelobjects.h
More file actions
391 lines (335 loc) · 7.92 KB
/
modelobjects.h
File metadata and controls
391 lines (335 loc) · 7.92 KB
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
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
#ifndef MODELOBJECTS_H
#define MODELOBJECTS_H
#include <QString>
#include <QVector>
#include <QHash>
#include <QMap>
#include <QSet>
/* forward declarations */
class PopulationInfo;
class Component;
class Population;
class Neuron;
class Property;
class PropertyValue;
class Input;
class Projection;
class Synapse;
class WeightUpdate;
class Postsynapse;
class AbstractionConnection;
/* typedefs */
typedef enum
{
NULL_CONNECTIVITY_TYPE,
ALL_TO_ALL_CONNECTVITY_TYPE,
ONE_TO_ONE_CONNECTVITY_TYPE,
LIST_CONNECTVITY_TYPE,
FIXED_PROBABILITY_CONNECTVITY_TYPE
}ConnectivityType;
typedef enum
{
COMPONENT_TYPE_POPULATION,
COMPONENT_TYPE_WEIGHT_UPDATE,
COMPONENT_TYPE_POSTSYNAPSE
}ComponentType;
typedef enum
{
NULL_VALUE_TYPE,
FIXED_VALUE_TYPE,
VALUE_LIST_TYPE,
UNIFORM_DISTRIBUTION_STOCHASTIC_TYPE,
NORMAL_DISTRIBUTION_STOCHASTIC_TYPE,
POISSON_DISTRIBUTION_STOCHASTIC_TYPE
}PropertyValueType;
/* Component Info Classes - for information parsing stage */
class ComponentInfo
{
public:
ComponentInfo(){ size = 0;}
virtual ~ComponentInfo(){};
virtual ComponentType Type() = 0;
virtual void calculateDimensions(QHash<QString, ComponentInfo *> &component_info) = 0;
public:
QString name;
uint size;
};
class PopulationInfo: public ComponentInfo
{
public:
PopulationInfo(){}
virtual ~PopulationInfo(){}
ComponentType Type(){return COMPONENT_TYPE_POPULATION;}
void calculateDimensions(QHash<QString, ComponentInfo *> &component_info);
public:
uint global_index;
uint global_sub_start_index;
uint splits;
};
class WeightUpdateInfo: public ComponentInfo
{
public:
WeightUpdateInfo(){}
virtual ~WeightUpdateInfo(){}
ComponentType Type(){return COMPONENT_TYPE_WEIGHT_UPDATE;}
void calculateDimensions(QHash<QString, ComponentInfo *> &component_info);
public:
QString projPopulation;
uint srcPopSize;
uint dstPopSize;
ConnectivityType connectivity;
uint connectionListCount; //only used when ConnectivityType == LIST
};
class PostsynapseInfo: public ComponentInfo
{
public:
PostsynapseInfo(){}
virtual ~PostsynapseInfo(){}
ComponentType Type(){return COMPONENT_TYPE_POSTSYNAPSE;}
void calculateDimensions(QHash<QString, ComponentInfo *> &component_info);
public:
QString projPopulation;
};
/* Component Classes - for full parsing stage */
class Component
{
public:
Component(){}
~Component();
virtual ComponentType Type() = 0;
public:
QString name;
QString definition_url;
QVector <Property*> properties;
QHash <QString, Input*> inputs;
};
class Population
{
public:
Population();
~Population();
public:
Neuron* neuron;
uint sub_pop_index;
QHash <QString, Projection*> projections; //< dst_sub_population_name, subprojection >
};
class Neuron: public Component
{
public:
Neuron(){}
virtual ~Neuron(){}
ComponentType Type(){return COMPONENT_TYPE_POPULATION;}
public:
uint size;
};
class Property
{
public:
Property();
~Property();
public:
QString name;
PropertyValue *value;
QString dimension;
};
class PropertyValue
{
public:
virtual ~PropertyValue(){}
public:
virtual PropertyValueType Type() = 0;
};
class FixedPropertyValue: public PropertyValue
{
public:
FixedPropertyValue(){}
PropertyValueType Type(){return FIXED_VALUE_TYPE;}
public:
double value;
};
class PropertyValueInstance
{
public:
PropertyValueInstance(){}
public:
uint index;
double value;
};
class PropertyValueList: public PropertyValue
{
public:
PropertyValueList(){}
~PropertyValueList();
PropertyValueType Type(){return VALUE_LIST_TYPE;}
public:
QHash <int, PropertyValueInstance*> valueInstances; // <index, value instance>
};
class UniformDistPropertyValue: public PropertyValue
{
public:
UniformDistPropertyValue(){}
PropertyValueType Type(){return UNIFORM_DISTRIBUTION_STOCHASTIC_TYPE;}
public:
int seed;
double minimum;
double maximum;
};
class NormalDistPropertyValue: public PropertyValue
{
public:
NormalDistPropertyValue(){}
PropertyValueType Type(){return NORMAL_DISTRIBUTION_STOCHASTIC_TYPE;}
public:
int seed;
double mean;
double variance;
};
class PoissonDistPropertyValue: public PropertyValue
{
public:
PoissonDistPropertyValue(){}
PropertyValueType Type(){return POISSON_DISTRIBUTION_STOCHASTIC_TYPE;}
public:
int seed;
double mean;
};
class Input
{
public:
Input();
~Input();
public:
QString src;
QString src_port;
QString dst_port;
AbstractionConnection *remapping;
public:
Input * unsplit_input;
uint sub_inp_max; //stores (in unsplit input) the max number of sub inputs for the in any of split populations
uint sub_inp_index; //stores (in sub synapse) the sub synapse index
uint unsplit_index; //stores (for unsplit inputs) the index of the inputs (with respect to the parent component)
};
class Projection
{
public:
Projection(){}
~Projection();
public:
QString proj_population;
QHash<QString, Synapse*> synapses; //<synapse name used as id, target>
uint index; //unsplit index of projection in population
};
class Synapse
{
public:
Synapse();
~Synapse();
public:
AbstractionConnection *connection;
WeightUpdate *weightupdate;
Postsynapse *postsynapse;
public:
Synapse * unsplit_synapse;
uint _sub_syn_max; //stores (in unsplit synapse) the max number of sub synapses for any split populations
uint _sub_syn_index; //stores (in sub synapse) the sub synapse index
uint _sub_target_index; //sub target index only for splits
};
class WeightUpdate: public Component
{
public:
WeightUpdate(){}
virtual ~WeightUpdate(){}
ComponentType Type(){return COMPONENT_TYPE_WEIGHT_UPDATE;}
static QString unsplitName(QString split_name);
public:
AbstractionConnection *target_connectivity; //not owned by object
QString input_src_port;
QString input_dst_port;
};
class Postsynapse: public Component
{
public:
Postsynapse(){}
virtual ~Postsynapse(){}
ComponentType Type(){return COMPONENT_TYPE_POSTSYNAPSE;}
public:
QString input_src_port;
QString input_dst_port;
QString output_src_port;
QString output_dst_port;
};
class AbstractionConnection
{
public:
AbstractionConnection();
~AbstractionConnection();
virtual ConnectivityType Type() = 0;
public:
PropertyValue *delay;
};
class AllToAllConnection: public AbstractionConnection
{
public:
ConnectivityType Type(){return ALL_TO_ALL_CONNECTVITY_TYPE;}
};
class OneToOneConnection: public AbstractionConnection
{
public:
ConnectivityType Type(){return ONE_TO_ONE_CONNECTVITY_TYPE;}
};
class ConnectionInstance
{
public:
ConnectionInstance(){}
public:
uint index;
int src_neuron;
int dst_neuron;
double delay;
};
class ConnectionList: public AbstractionConnection
{
public:
ConnectionList(){connection_count = 0;}
~ConnectionList();
ConnectivityType Type(){return LIST_CONNECTVITY_TYPE;}
public:
QMap<int, ConnectionInstance*> connectionIndices; //<index, connection instance>
QHash <uint, QHash<uint, ConnectionInstance*> > connectionMatrix; //src, dst -> connection index
uint connection_count;
};
class FixedProbabilityConnection: public AbstractionConnection
{
public:
ConnectivityType Type(){return FIXED_PROBABILITY_CONNECTVITY_TYPE;}
public:
double probability;
int seed;
};
/* Experiment layer */
class LogOutput
{
public:
LogOutput();
~LogOutput();
public:
QString name;
QString target;
QString port;
double start_time;
double end_time;
QSet <int> indices;
};
class Experiment
{
public:
Experiment();
~Experiment();
public:
double duration;
double time_step;
QHash<QString, LogOutput*> outputs; // key=target, multiple values per key!
QString network_layer_url;
//No input support yet!
};
#endif // MODELOBJECTS_H