-
Notifications
You must be signed in to change notification settings - Fork 0
/
qhg4_simulation_framework.html
242 lines (232 loc) · 12.3 KB
/
qhg4_simulation_framework.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
<title>The QHG4 simulation framework: an Overview — QHG4 4.1 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/jody.css" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="_static/doctools.js"></script>
<link rel="shortcut icon" href="http://aim-bigfoot.uzh.ch/~QHG/pmwiki/pub/skins/sinorca/gfx/favicon.png"/>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Agents: Parallelisation and Management" href="AgentManagement.html" />
<link rel="prev" title="QHG4 documentation" href="index.html" />
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="AgentManagement.html" title="Agents: Parallelisation and Management"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="index.html" title="QHG4 documentation"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">QHG4 4.1 documentation</a> »</li>
<li class="nav-item nav-item-this"><a href="">The QHG4 simulation framework: an Overview</a></li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="the-qhg4-simulation-framework-an-overview">
<h1>The QHG4 simulation framework: an Overview<a class="headerlink" href="#the-qhg4-simulation-framework-an-overview" title="Permalink to this heading">¶</a></h1>
<p>QHG4 is a framework for agent-based simulations, together with a set of various tools.</p>
<figure class="align-default" id="id1">
<img alt="_images/QHGStructure.png" src="_images/QHGStructure.png" />
<figcaption>
<p><span class="caption-text">The arrows between the components (solid border) denote ownership,
the boxes with dashed borders list the main classes associated with a component, with ‘…’ denoting derived classes.</span><a class="headerlink" href="#id1" title="Permalink to this image">¶</a></p>
</figcaption>
</figure>
<dl class="simple">
<dt>Short descriptions of the main elements</dt><dd><ul class="simple">
<li><p><a class="reference internal" href="#simulationframework-ov-ref"><span class="std std-ref">Simulation Framework</span></a></p></li>
<li><p><a class="reference internal" href="#environment-ov-ref"><span class="std std-ref">Environment</span></a></p></li>
<li><p><a class="reference internal" href="#populationmanagement-ov-ref"><span class="std std-ref">Populations and Population Management</span></a></p></li>
<li><p><a class="reference internal" href="#actions-ov-ref"><span class="std std-ref">Actions</span></a></p></li>
<li><p><a class="reference internal" href="#events-ov-ref"><span class="std std-ref">Events</span></a></p></li>
</ul>
</dd>
</dl>
<section id="simulation-framework">
<span id="simulationframework-ov-ref"></span><h2>Simulation Framework<a class="headerlink" href="#simulation-framework" title="Permalink to this heading">¶</a></h2>
<p>The simulation framework owns environment data as well as a population manager.
During the simulation loop all agents in all populations will execute their actions.
Additionally, events may change the environment or cause the output of population and/or environment data.</p>
<p>The essential classes for the simulation framework:</p>
<blockquote>
<div><ul class="simple">
<li><dl class="simple">
<dt><strong>QHGMain</strong></dt><dd><p>opens the log file, creates a <code class="docutils literal notranslate"><span class="pre">Simulator</span></code> object and runs it</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt><strong>SimParams</strong></dt><dd><p>base class for <code class="docutils literal notranslate"><span class="pre">Simulator</span></code> with methods for reading program options, creating objects and loading data</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt><strong>Simulator</strong></dt><dd><p>runs the simulation loop and handles events</p>
</dd>
</dl>
</li>
</ul>
</div></blockquote>
<p>The description of the relevant files cn be found in the <a class="reference internal" href="code_doc/app.html#app-ref"><span class="std std-ref">the “app” section of the documentation</span></a></p>
</section>
<section id="environment">
<span id="environment-ov-ref"></span><h2>Environment<a class="headerlink" href="#environment" title="Permalink to this heading">¶</a></h2>
<div class="line-block">
<div class="line">The environment consists of different layers.</div>
<div class="line">The basis of an environment is a cellgrid.</div>
<div class="line">The cellgrid holds pointers to the other environment layers such as geography, climate, vegetatiuon, navigation etc.</div>
<div class="line">This way each grid node has its set of environment data.</div>
<div class="line">Agents move from node to node and can access the environmental dat at these locations.</div>
</div>
<dl class="simple">
<dt>The essential environment classes:</dt><dd><ul class="simple">
<li><dl class="simple">
<dt><strong>SCellGrid</strong></dt><dd><p>The class <a class="reference internal" href="code_doc/core/SCellGrid.html#scellgrid-ref"><span class="std std-ref">SCellGrid</span></a> implements the grid on which the simulation is running: agents sit on nodes and can travel to connected nodes.
For global simulations the cellgrid is a subdivided Icosahedron, but planar grids with 4 or 6 neighborhood are also used.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt><strong>Geography</strong></dt><dd><p>The class <a class="reference internal" href="code_doc/core/Geography.html#geography-ref"><span class="std std-ref">Geography</span></a> contains longitudes, latitudes and altitudes of the nodes, as well as the water-related and glacial data</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt><strong>Climate</strong></dt><dd><p>The class <a class="reference internal" href="code_doc/core/Climate.html#climate-ref"><span class="std std-ref">Climate</span></a> contains temperatures and precipitation for each cell</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt><strong>Vegetation</strong></dt><dd><p>The class <a class="reference internal" href="code_doc/core/Vegetation.html#vegetation-ref"><span class="std std-ref">Vegetation</span></a> contains net primary production for each cell</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt><strong>Navigation</strong></dt><dd><p>The class <a class="reference internal" href="code_doc/core/Navigation.html#navigation-ref"><span class="std std-ref">Navigation</span></a> contains over-seas connections for some nodes.
This is used to allow agents to move to islands.</p>
</dd>
</dl>
</li>
</ul>
</dd>
</dl>
</section>
<section id="populations-and-population-management">
<span id="populationmanagement-ov-ref"></span><h2>Populations and Population Management<a class="headerlink" href="#populations-and-population-management" title="Permalink to this heading">¶</a></h2>
<p>In QHG4 agents small structures containing the individuals’ properties. They are managed in population objects.
Each population object has a parallelized loop to execute the actions of all its agents, and manages their birth, death and movement.</p>
<blockquote>
<div><ul class="simple">
<li><dl class="simple">
<dt><strong>PopLooper</strong></dt><dd><p>Manages any number of <code class="docutils literal notranslate"><span class="pre">SPopulation</span></code> objects and distributes commands from <code class="docutils literal notranslate"><span class="pre">Simulator</span></code> to all of them.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt><strong>SPopulation</strong></dt><dd><p>Base class for all population classes; only derived classes can be used as actual populations.
Populations can use one or more Action objects.</p>
</dd>
</dl>
</li>
</ul>
</div></blockquote>
</section>
<section id="actions">
<span id="actions-ov-ref"></span><h2>Actions<a class="headerlink" href="#actions" title="Permalink to this heading">¶</a></h2>
<p>The actions agents perform during a simulation step are represented by classes derived from the base class <code class="docutils literal notranslate"><span class="pre">Action</span></code>.
There are actions for movement, mating, fertility, mortality, genetics and more.</p>
</section>
<section id="events">
<span id="events-ov-ref"></span><h2>Events<a class="headerlink" href="#events" title="Permalink to this heading">¶</a></h2>
<p>In order to trigger specific actions, mainly reading and writing data, QHG4 uses so-called events.
Usually a list of times, eventy types (what to do) and arguments (what to do it to) are passed to QHG4 as parameters.
During execution, whenever the current simulation time matches a time on the event list, the actions for corresponding event(s) are executed.</p>
</section>
</section>
<div class="clearer"></div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<div>
<h3><a href="index.html">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">The QHG4 simulation framework: an Overview</a><ul>
<li><a class="reference internal" href="#simulation-framework">Simulation Framework</a></li>
<li><a class="reference internal" href="#environment">Environment</a></li>
<li><a class="reference internal" href="#populations-and-population-management">Populations and Population Management</a></li>
<li><a class="reference internal" href="#actions">Actions</a></li>
<li><a class="reference internal" href="#events">Events</a></li>
</ul>
</li>
</ul>
</div>
<div>
<h4>Previous topic</h4>
<p class="topless"><a href="index.html"
title="previous chapter">QHG4 documentation</a></p>
</div>
<div>
<h4>Next topic</h4>
<p class="topless"><a href="AgentManagement.html"
title="next chapter">Agents: Parallelisation and Management</a></p>
</div>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/qhg4_simulation_framework.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>document.getElementById('searchbox').style.display = "block"</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="AgentManagement.html" title="Agents: Parallelisation and Management"
>next</a> |</li>
<li class="right" >
<a href="index.html" title="QHG4 documentation"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">QHG4 4.1 documentation</a> »</li>
<li class="nav-item nav-item-this"><a href="">The QHG4 simulation framework: an Overview</a></li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2022, jodyxha.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 5.1.1.
</div>
</body>
</html>