-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsimulator_seq_table.h
More file actions
113 lines (86 loc) · 3.12 KB
/
simulator_seq_table.h
File metadata and controls
113 lines (86 loc) · 3.12 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
/*
ABCD-GPU: Simulating Population Dynamics P systems on the GPU, by DCBA
ABCD-GPU is a subproject of PMCGPU (Parallel simulators for Membrane
Computing on the GPU)
Copyright (c) 2015 Research Group on Natural Computing, Universidad de Sevilla
Dpto. Ciencias de la Computación e Inteligencia Artificial
Escuela Técnica Superior de Ingeniería Informática,
Avda. Reina Mercedes s/n, 41012 Sevilla (Spain)
Author: Miguel Ángel Martínez-del-Amor
This file is part of ABCD-GPU.
ABCD-GPU is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ABCD-GPU is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ABCD-GPU. If not, see <http://www.gnu.org/licenses/>. */
#ifndef __SEQ_SIM__TABLE__
#define __SEQ_SIM__TABLE__
#include <gsl/gsl_math.h>
#include <gsl/gsl_rng.h>
#include <gsl/gsl_randist.h>
#include "pdp_psystem_sab.h"
#include "simulator.h"
/* Warning: This simulator only operates with rules of Pi */
class Simulator_seq_table: public Simulator {
friend class PDP_Psystem_SAB;
public:
Simulator_seq_table(PDP_Psystem_SAB* PDPps) {
this->structures=PDPps->structures;
this->options=PDPps->options;
}
bool run();
bool step(int k);
/* Methods for querying data */
unsigned int get_object_value( int obj,
int membr,
int env,
int sim) {
return structures->configuration.multiset[env*options->num_objects*options->num_membranes+membr*options->num_objects+obj];
}
char get_membrane_charge( int membr,
int env,
int sim) {
return structures->configuration.membrane[env*options->num_membranes+membr];
}
private:
PDP_Psystem_SAB::Structures structures;
Options options;
/*****************************/
/* Auxiliary data structures */
/*****************************/
float * table;
bool *active_col;
bool *active_row;
bool *init_active_row;
unsigned int colsize;
unsigned int rowsize;
float *addition;
unsigned int *block_min;
/* Only debuggin purposes */
void print_configuration();
void print_table();
void print_activations(unsigned int environment);
void print_block_applications();
/* Initialization */
float * init_table();
void init_activations();
void delete_table();
void delete_activations();
/* Micro phases */
void selection_phase1();
void selection_phase2();
void selection_phase3();
/* Main phases */
unsigned int selection();
unsigned int execution();
};
/* Simulation algorithm based on a distribution table */
//bool simulation_seq_table(Structures* structures,Options* options);
/* Simulation algorithm based on a direct distribution */
//bool simulation_seq_dir(Structures* structures, Options* options);
#endif