-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathstatistics_8c-example.html
414 lines (412 loc) · 54.5 KB
/
statistics_8c-example.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
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
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Clingo C API: statistics.c</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="clingo.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Clingo C API
</div>
<div id="projectbrief">C API for clingo providing high level functions to control grounding and solving.</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">statistics.c</div> </div>
</div><!--header-->
<div class="contents">
<p>The example shows how to inspect statistics.</p>
<h2><a class="anchor" id="autotoc_md14"></a>
Output</h2>
<div class="fragment"><div class="line">./statistics 0</div>
<div class="line">Model: a</div>
<div class="line">Model: b</div>
<div class="line">problem:</div>
<div class="line"> lp:</div>
<div class="line"> atoms:</div>
<div class="line"> 2</div>
<div class="line"> atoms_aux:</div>
<div class="line"> 0</div>
<div class="line"> ...</div>
<div class="line">solving:</div>
<div class="line"> ...</div>
<div class="line">summary:</div>
<div class="line"> ...</div>
<div class="line">accu:</div>
<div class="line"> times:</div>
<div class="line"> ...</div>
<div class="line"> models:</div>
<div class="line"> ...</div>
<div class="line"> solving:</div>
<div class="line"> ...</div>
</div><!-- fragment --><h2><a class="anchor" id="autotoc_md15"></a>
Code</h2>
<div class="fragment"><div class="line"><span class="preprocessor">#include <<a class="code" href="clingo_8h.html">clingo.h</a>></span></div>
<div class="line"><span class="preprocessor">#include <stdlib.h></span></div>
<div class="line"><span class="preprocessor">#include <stdio.h></span></div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">bool</span> print_model(<a class="code" href="group__Model.html#gaaf9a93819f023f3cb8aa80598c46556b">clingo_model_t</a> <span class="keyword">const</span> *model) {</div>
<div class="line"> <span class="keywordtype">bool</span> ret = <span class="keyword">true</span>;</div>
<div class="line"> <a class="code" href="group__Symbols.html#ga6c75c60fa57c3b97505265ff08f6f951">clingo_symbol_t</a> *atoms = NULL;</div>
<div class="line"> <span class="keywordtype">size_t</span> atoms_n;</div>
<div class="line"> <a class="code" href="group__Symbols.html#ga6c75c60fa57c3b97505265ff08f6f951">clingo_symbol_t</a> <span class="keyword">const</span> *it, *ie;</div>
<div class="line"> <span class="keywordtype">char</span> *str = NULL;</div>
<div class="line"> <span class="keywordtype">size_t</span> str_n = 0;</div>
<div class="line"> </div>
<div class="line"> <span class="comment">// determine the number of (shown) symbols in the model</span></div>
<div class="line"> <span class="keywordflow">if</span> (!<a name="a0"></a><a class="code" href="group__Model.html#ga5c6c30cef0e3a29a192577a1a739ca69">clingo_model_symbols_size</a>(model, <a name="a1"></a><a class="code" href="group__Model.html#gga72e8ba23a84af09dfd93739ebaa6ecf8a82a698ef41cd919cb370d22fc0b44826">clingo_show_type_shown</a>, &atoms_n)) { <span class="keywordflow">goto</span> error; }</div>
<div class="line"> </div>
<div class="line"> <span class="comment">// allocate required memory to hold all the symbols</span></div>
<div class="line"> <span class="keywordflow">if</span> (!(atoms = (<a class="code" href="group__Symbols.html#ga6c75c60fa57c3b97505265ff08f6f951">clingo_symbol_t</a>*)malloc(<span class="keyword">sizeof</span>(*atoms) * atoms_n))) {</div>
<div class="line"> <a name="a2"></a><a class="code" href="group__BasicTypes.html#ga5c2b2943475239e151eb783d30548b38">clingo_set_error</a>(<a name="a3"></a><a class="code" href="group__BasicTypes.html#ggaebdf91a4187db9abdd2c6ceb971cf13eaa14a0926eb3e653fcc13299b33d8d348">clingo_error_bad_alloc</a>, <span class="stringliteral">"could not allocate memory for atoms"</span>);</div>
<div class="line"> <span class="keywordflow">goto</span> error;</div>
<div class="line"> }</div>
<div class="line"> </div>
<div class="line"> <span class="comment">// retrieve the symbols in the model</span></div>
<div class="line"> <span class="keywordflow">if</span> (!<a name="a4"></a><a class="code" href="group__Model.html#ga05d849166d689a3d4ae8d40fba070d91">clingo_model_symbols</a>(model, <a class="code" href="group__Model.html#gga72e8ba23a84af09dfd93739ebaa6ecf8a82a698ef41cd919cb370d22fc0b44826">clingo_show_type_shown</a>, atoms, atoms_n)) { <span class="keywordflow">goto</span> error; }</div>
<div class="line"> </div>
<div class="line"> printf(<span class="stringliteral">"Model:"</span>);</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">for</span> (it = atoms, ie = atoms + atoms_n; it != ie; ++it) {</div>
<div class="line"> <span class="keywordtype">size_t</span> n;</div>
<div class="line"> <span class="keywordtype">char</span> *str_new;</div>
<div class="line"> </div>
<div class="line"> <span class="comment">// determine size of the string representation of the next symbol in the model</span></div>
<div class="line"> <span class="keywordflow">if</span> (!<a name="a5"></a><a class="code" href="group__Symbols.html#ga6963e11f6d22a5c04a0e50d1afe1f4f5">clingo_symbol_to_string_size</a>(*it, &n)) { <span class="keywordflow">goto</span> error; }</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">if</span> (str_n < n) {</div>
<div class="line"> <span class="comment">// allocate required memory to hold the symbol's string</span></div>
<div class="line"> <span class="keywordflow">if</span> (!(str_new = (<span class="keywordtype">char</span>*)realloc(str, <span class="keyword">sizeof</span>(*str) * n))) {</div>
<div class="line"> <a class="code" href="group__BasicTypes.html#ga5c2b2943475239e151eb783d30548b38">clingo_set_error</a>(<a class="code" href="group__BasicTypes.html#ggaebdf91a4187db9abdd2c6ceb971cf13eaa14a0926eb3e653fcc13299b33d8d348">clingo_error_bad_alloc</a>, <span class="stringliteral">"could not allocate memory for symbol's string"</span>);</div>
<div class="line"> <span class="keywordflow">goto</span> error;</div>
<div class="line"> }</div>
<div class="line"> </div>
<div class="line"> str = str_new;</div>
<div class="line"> str_n = n;</div>
<div class="line"> }</div>
<div class="line"> </div>
<div class="line"> <span class="comment">// retrieve the symbol's string</span></div>
<div class="line"> <span class="keywordflow">if</span> (!<a name="a6"></a><a class="code" href="group__Symbols.html#gac292526ba129269eec3c64510deec3b0">clingo_symbol_to_string</a>(*it, str, n)) { <span class="keywordflow">goto</span> error; }</div>
<div class="line"> </div>
<div class="line"> printf(<span class="stringliteral">" %s"</span>, str);</div>
<div class="line"> }</div>
<div class="line"> </div>
<div class="line"> printf(<span class="stringliteral">"\n"</span>);</div>
<div class="line"> <span class="keywordflow">goto</span> out;</div>
<div class="line"> </div>
<div class="line">error:</div>
<div class="line"> ret = <span class="keyword">false</span>;</div>
<div class="line"> </div>
<div class="line">out:</div>
<div class="line"> <span class="keywordflow">if</span> (atoms) { free(atoms); }</div>
<div class="line"> <span class="keywordflow">if</span> (str) { free(str); }</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">return</span> ret;</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">bool</span> event_handler(<a class="code" href="group__SolveHandle.html#ga1cf28216485089df700495e681fbdc29">clingo_solve_event_type_t</a> type, <span class="keywordtype">void</span> *event, <span class="keywordtype">void</span> *data, <span class="keywordtype">bool</span> *goon) {</div>
<div class="line"> (void)data;</div>
<div class="line"> (void)goon;</div>
<div class="line"> <span class="keywordflow">switch</span> (type) {</div>
<div class="line"> <span class="keywordflow">case</span> <a name="a7"></a><a class="code" href="group__SolveHandle.html#gga988c4d39df7949f444f1507896e97450a9070101cdf688b8f2ba6e2f968088746">clingo_solve_event_type_statistics</a>: {</div>
<div class="line"> <a class="code" href="group__Statistics.html#gaaba3981b0eb26dcf3e1b2043245e2516">clingo_statistics_t</a> *stats;</div>
<div class="line"> uint64_t root, values, summary, value;</div>
<div class="line"> uint16_t n = 10, random = 1;</div>
<div class="line"> <span class="keywordtype">double</span> sum = 0;</div>
<div class="line"> </div>
<div class="line"> <span class="comment">// obtain a pointer to the accumulated statistics</span></div>
<div class="line"> stats = ((<a class="code" href="group__Statistics.html#gaaba3981b0eb26dcf3e1b2043245e2516">clingo_statistics_t</a> **)event)[1];</div>
<div class="line"> </div>
<div class="line"> <span class="comment">// get the root key which refering to a special modifiable entry</span></div>
<div class="line"> <span class="keywordflow">if</span> (!<a name="a8"></a><a class="code" href="group__Statistics.html#ga5d121de3ba67f0197c411334cf960959">clingo_statistics_root</a>(stats, &root)) { <span class="keywordflow">return</span> <span class="keyword">false</span>; }</div>
<div class="line"> </div>
<div class="line"> <span class="comment">// set some pseudo-random values in an array</span></div>
<div class="line"> <span class="keywordflow">if</span> (!<a name="a9"></a><a class="code" href="group__Configuration.html#ga6f288e6ab974c9d408d14cc478eb4ef4">clingo_statistics_map_add_subkey</a>(stats, root, <span class="stringliteral">"values"</span>, <a name="a10"></a><a class="code" href="group__Statistics.html#gga7f0cda11d4209314dcdccb83275555faaf019ec1d66b02aed35f248adbca1ec78">clingo_statistics_type_array</a>, &values)) { <span class="keywordflow">return</span> <span class="keyword">false</span>; }</div>
<div class="line"> <span class="keywordflow">for</span> (uint16_t i = 0; i < n; ++i) {</div>
<div class="line"> random = (random << 3) ^ (random ^ ((random & 0xf800) >> 13)) ^ i;</div>
<div class="line"> <span class="keywordflow">if</span> (!<a name="a11"></a><a class="code" href="group__Configuration.html#gab9d6a9902c2526a3d1a2d43414c70453">clingo_statistics_array_push</a>(stats, values, <a name="a12"></a><a class="code" href="group__Statistics.html#gga7f0cda11d4209314dcdccb83275555faafb64d43d4fb5619ff9b23a10d4a9d6a2">clingo_statistics_type_value</a>, &value)) { <span class="keywordflow">return</span> <span class="keyword">false</span>; }</div>
<div class="line"> <span class="keywordflow">if</span> (!<a name="a13"></a><a class="code" href="group__Statistics.html#ga188d561ad33870b2db3441c0ce26a3ed">clingo_statistics_value_set</a>(stats, value, random)) { <span class="keywordflow">return</span> <span class="keyword">false</span>; }</div>
<div class="line"> sum += random;</div>
<div class="line"> }</div>
<div class="line"> </div>
<div class="line"> <span class="comment">// add the sum and average of the values in a map under key summary</span></div>
<div class="line"> <span class="keywordflow">if</span> (!<a class="code" href="group__Configuration.html#ga6f288e6ab974c9d408d14cc478eb4ef4">clingo_statistics_map_add_subkey</a>(stats, root, <span class="stringliteral">"summary"</span>, <a name="a14"></a><a class="code" href="group__Statistics.html#gga7f0cda11d4209314dcdccb83275555faaebbd4de02271d79efb38fd3a6a640178">clingo_statistics_type_map</a>, &summary)) { <span class="keywordflow">return</span> <span class="keyword">false</span>; }</div>
<div class="line"> <span class="keywordflow">if</span> (!<a class="code" href="group__Configuration.html#ga6f288e6ab974c9d408d14cc478eb4ef4">clingo_statistics_map_add_subkey</a>(stats, summary, <span class="stringliteral">"sum"</span>, <a class="code" href="group__Statistics.html#gga7f0cda11d4209314dcdccb83275555faafb64d43d4fb5619ff9b23a10d4a9d6a2">clingo_statistics_type_value</a>, &value)) { <span class="keywordflow">return</span> <span class="keyword">false</span>; }</div>
<div class="line"> <span class="keywordflow">if</span> (!<a class="code" href="group__Statistics.html#ga188d561ad33870b2db3441c0ce26a3ed">clingo_statistics_value_set</a>(stats, value, sum)) { <span class="keywordflow">return</span> <span class="keyword">false</span>; }</div>
<div class="line"> <span class="keywordflow">if</span> (!<a class="code" href="group__Configuration.html#ga6f288e6ab974c9d408d14cc478eb4ef4">clingo_statistics_map_add_subkey</a>(stats, summary, <span class="stringliteral">"avg"</span>, <a class="code" href="group__Statistics.html#gga7f0cda11d4209314dcdccb83275555faafb64d43d4fb5619ff9b23a10d4a9d6a2">clingo_statistics_type_value</a>, &value)) { <span class="keywordflow">return</span> <span class="keyword">false</span>; }</div>
<div class="line"> <span class="keywordflow">if</span> (!<a class="code" href="group__Statistics.html#ga188d561ad33870b2db3441c0ce26a3ed">clingo_statistics_value_set</a>(stats, value, (<span class="keywordtype">double</span>)sum/n)) { <span class="keywordflow">return</span> <span class="keyword">false</span>; }</div>
<div class="line"> <span class="keywordflow">break</span>;</div>
<div class="line"> }</div>
<div class="line"> }</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">bool</span> solve(<a class="code" href="group__Control.html#gaf008e9db9dbb37b0b7ef039bb9d582f0">clingo_control_t</a> *ctl, <a class="code" href="group__Control.html#gae917a23b0591d181004ec88c4e3291c1">clingo_solve_result_bitset_t</a> *result) {</div>
<div class="line"> <span class="keywordtype">bool</span> ret = <span class="keyword">true</span>;</div>
<div class="line"> <a class="code" href="group__SolveHandle.html#ga023c1084a4c01ea6e121a8310efba045">clingo_solve_handle_t</a> *handle;</div>
<div class="line"> <a class="code" href="group__Model.html#gaaf9a93819f023f3cb8aa80598c46556b">clingo_model_t</a> <span class="keyword">const</span> *model;</div>
<div class="line"> </div>
<div class="line"> <span class="comment">// get a solve handle</span></div>
<div class="line"> <span class="keywordflow">if</span> (!<a name="a15"></a><a class="code" href="group__Control.html#ga4b3b7388e75ace676481f6021c4dc66d">clingo_control_solve</a>(ctl, <a name="a16"></a><a class="code" href="group__SolveHandle.html#gga63eb87834deebecdf9c799d64a3c65a2a60a9c133be636e68a7d02680c8b9d47e">clingo_solve_mode_yield</a>, NULL, 0, event_handler, NULL, &handle)) { <span class="keywordflow">goto</span> error; }</div>
<div class="line"> <span class="comment">// loop over all models</span></div>
<div class="line"> <span class="keywordflow">while</span> (<span class="keyword">true</span>) {</div>
<div class="line"> <span class="keywordflow">if</span> (!<a name="a17"></a><a class="code" href="group__SolveHandle.html#ga73d71df7adeee92f1d515f52cdcbbac0">clingo_solve_handle_resume</a>(handle)) { <span class="keywordflow">goto</span> error; }</div>
<div class="line"> <span class="keywordflow">if</span> (!<a name="a18"></a><a class="code" href="group__SolveHandle.html#gaf9353c14149a2a16adf0474796871ae1">clingo_solve_handle_model</a>(handle, &model)) { <span class="keywordflow">goto</span> error; }</div>
<div class="line"> <span class="comment">// print the model</span></div>
<div class="line"> <span class="keywordflow">if</span> (model) { print_model(model); }</div>
<div class="line"> <span class="comment">// stop if there are no more models</span></div>
<div class="line"> <span class="keywordflow">else</span> { <span class="keywordflow">break</span>; }</div>
<div class="line"> }</div>
<div class="line"> <span class="comment">// get the solve results</span></div>
<div class="line"> <span class="keywordflow">if</span> (!<a name="a19"></a><a class="code" href="group__SolveHandle.html#gae4270b7d4d0174a479307438680007c5">clingo_solve_handle_get</a>(handle, result)) { <span class="keywordflow">goto</span> error; }</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">goto</span> out;</div>
<div class="line"> </div>
<div class="line">error:</div>
<div class="line"> ret = <span class="keyword">false</span>;</div>
<div class="line"> </div>
<div class="line">out:</div>
<div class="line"> <span class="comment">// free the solve handle</span></div>
<div class="line"> <span class="keywordflow">return</span> <a name="a20"></a><a class="code" href="group__SolveHandle.html#ga488b76e7240d625bd4066e68a33ab23e">clingo_solve_handle_close</a>(handle) && ret;</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> print_prefix(<span class="keywordtype">int</span> depth) {</div>
<div class="line"> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < depth; ++i) {</div>
<div class="line"> printf(<span class="stringliteral">" "</span>);</div>
<div class="line"> }</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="comment">// recursively print the statistics object</span></div>
<div class="line"><span class="keywordtype">bool</span> print_statistics(<span class="keyword">const</span> <a class="code" href="group__Statistics.html#gaaba3981b0eb26dcf3e1b2043245e2516">clingo_statistics_t</a> *stats, uint64_t key, <span class="keywordtype">int</span> depth) {</div>
<div class="line"> <span class="keywordtype">bool</span> ret = <span class="keyword">true</span>;</div>
<div class="line"> <a class="code" href="group__Statistics.html#ga3403c9356dad61654cdcf40985aa4de2">clingo_statistics_type_t</a> type;</div>
<div class="line"> </div>
<div class="line"> <span class="comment">// get the type of an entry and switch over its various values</span></div>
<div class="line"> <span class="keywordflow">if</span> (!<a name="a21"></a><a class="code" href="group__Statistics.html#gae642428c4ffada5044b2d62231cda8c8">clingo_statistics_type</a>(stats, key, &type)) { <span class="keywordflow">goto</span> error; }</div>
<div class="line"> <span class="keywordflow">switch</span> ((<span class="keyword">enum</span> <a class="code" href="group__Statistics.html#ga7f0cda11d4209314dcdccb83275555fa">clingo_statistics_type_e</a>)type) {</div>
<div class="line"> <span class="comment">// print values</span></div>
<div class="line"> <span class="keywordflow">case</span> <a class="code" href="group__Statistics.html#gga7f0cda11d4209314dcdccb83275555faafb64d43d4fb5619ff9b23a10d4a9d6a2">clingo_statistics_type_value</a>: {</div>
<div class="line"> <span class="keywordtype">double</span> value;</div>
<div class="line"> </div>
<div class="line"> <span class="comment">// print value (with prefix for readability)</span></div>
<div class="line"> print_prefix(depth);</div>
<div class="line"> <span class="keywordflow">if</span> (!<a name="a22"></a><a class="code" href="group__Statistics.html#gaa233d9d33c7299dcb8dbe8c3463e5fea">clingo_statistics_value_get</a>(stats, key, &value)) { <span class="keywordflow">goto</span> error; }</div>
<div class="line"> printf(<span class="stringliteral">"%g\n"</span>, value);</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">break</span>;</div>
<div class="line"> }</div>
<div class="line"> </div>
<div class="line"> <span class="comment">// print arrays</span></div>
<div class="line"> <span class="keywordflow">case</span> <a class="code" href="group__Statistics.html#gga7f0cda11d4209314dcdccb83275555faaf019ec1d66b02aed35f248adbca1ec78">clingo_statistics_type_array</a>: {</div>
<div class="line"> <span class="keywordtype">size_t</span> size;</div>
<div class="line"> </div>
<div class="line"> <span class="comment">// loop over array elements</span></div>
<div class="line"> <span class="keywordflow">if</span> (!<a name="a23"></a><a class="code" href="group__Configuration.html#gae0afc854112f942e9b455c2bdb79449d">clingo_statistics_array_size</a>(stats, key, &size)) { <span class="keywordflow">goto</span> error; }</div>
<div class="line"> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i < size; ++i) {</div>
<div class="line"> uint64_t subkey;</div>
<div class="line"> </div>
<div class="line"> <span class="comment">// print array offset (with prefix for readability)</span></div>
<div class="line"> <span class="keywordflow">if</span> (!<a name="a24"></a><a class="code" href="group__Configuration.html#ga4f10089e16a4b98d8b90a22914561464">clingo_statistics_array_at</a>(stats, key, i, &subkey)) { <span class="keywordflow">goto</span> error; }</div>
<div class="line"> print_prefix(depth);</div>
<div class="line"> printf(<span class="stringliteral">"%zu:\n"</span>, i);</div>
<div class="line"> </div>
<div class="line"> <span class="comment">// recursively print subentry</span></div>
<div class="line"> <span class="keywordflow">if</span> (!print_statistics(stats, subkey, depth+1)) { <span class="keywordflow">goto</span> error; }</div>
<div class="line"> }</div>
<div class="line"> <span class="keywordflow">break</span>;</div>
<div class="line"> }</div>
<div class="line"> </div>
<div class="line"> <span class="comment">// print maps</span></div>
<div class="line"> <span class="keywordflow">case</span> <a class="code" href="group__Statistics.html#gga7f0cda11d4209314dcdccb83275555faaebbd4de02271d79efb38fd3a6a640178">clingo_statistics_type_map</a>: {</div>
<div class="line"> <span class="keywordtype">size_t</span> size;</div>
<div class="line"> </div>
<div class="line"> <span class="comment">// loop over map elements</span></div>
<div class="line"> <span class="keywordflow">if</span> (!<a name="a25"></a><a class="code" href="group__Configuration.html#ga8ef174014d3e115958de871b9dedd1cf">clingo_statistics_map_size</a>(stats, key, &size)) { <span class="keywordflow">goto</span> error; }</div>
<div class="line"> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i < size; ++i) {</div>
<div class="line"> <span class="keywordtype">char</span> <span class="keyword">const</span> *name;</div>
<div class="line"> uint64_t subkey;</div>
<div class="line"> </div>
<div class="line"> <span class="comment">// get and print map name (with prefix for readability)</span></div>
<div class="line"> <span class="keywordflow">if</span> (!<a name="a26"></a><a class="code" href="group__Configuration.html#gaec37ff3f8f3c1cdfd490cf156b4fb3d5">clingo_statistics_map_subkey_name</a>(stats, key, i, &name)) { <span class="keywordflow">goto</span> error; }</div>
<div class="line"> <span class="keywordflow">if</span> (!<a name="a27"></a><a class="code" href="group__Configuration.html#ga6b5341b39c79668474794d71efa4ee99">clingo_statistics_map_at</a>(stats, key, name, &subkey)) { <span class="keywordflow">goto</span> error; }</div>
<div class="line"> print_prefix(depth);</div>
<div class="line"> printf(<span class="stringliteral">"%s:\n"</span>, name);</div>
<div class="line"> </div>
<div class="line"> <span class="comment">// recursively print subentry</span></div>
<div class="line"> <span class="keywordflow">if</span> (!print_statistics(stats, subkey, depth+1)) { <span class="keywordflow">goto</span> error; }</div>
<div class="line"> }</div>
<div class="line"> }</div>
<div class="line"> </div>
<div class="line"> <span class="comment">// this case won't occur if the statistics are traversed like this</span></div>
<div class="line"> <span class="keywordflow">case</span> <a name="a28"></a><a class="code" href="group__Statistics.html#gga7f0cda11d4209314dcdccb83275555faaf4631936f82edb3ca0f61ef6224cc694">clingo_statistics_type_empty</a>: { <span class="keywordflow">goto</span> out; }</div>
<div class="line"> }</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">goto</span> out;</div>
<div class="line">error:</div>
<div class="line"> ret = <span class="keyword">false</span>;</div>
<div class="line">out:</div>
<div class="line"> <span class="keywordflow">return</span> ret;</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> <span class="keyword">const</span> **argv) {</div>
<div class="line"> <span class="keywordtype">char</span> <span class="keyword">const</span> *error_message;</div>
<div class="line"> <span class="keywordtype">int</span> ret = 0;</div>
<div class="line"> <a class="code" href="group__Control.html#gae917a23b0591d181004ec88c4e3291c1">clingo_solve_result_bitset_t</a> solve_ret;</div>
<div class="line"> <a class="code" href="group__Control.html#gaf008e9db9dbb37b0b7ef039bb9d582f0">clingo_control_t</a> *ctl = NULL;</div>
<div class="line"> <a name="_a29"></a><a class="code" href="structclingo__part.html">clingo_part_t</a> parts[] = {{ <span class="stringliteral">"base"</span>, NULL, 0 }};</div>
<div class="line"> <a class="code" href="group__Configuration.html#gabf3ac9f48abde87a53cdba386f21bc2f">clingo_configuration_t</a> *conf;</div>
<div class="line"> <a class="code" href="group__BasicTypes.html#gac7aaf88deb591e91b94ff38aa1e3472e">clingo_id_t</a> conf_root, conf_sub;</div>
<div class="line"> <span class="keyword">const</span> <a class="code" href="group__Statistics.html#gaaba3981b0eb26dcf3e1b2043245e2516">clingo_statistics_t</a> *stats;</div>
<div class="line"> uint64_t stats_key;</div>
<div class="line"> </div>
<div class="line"> <span class="comment">// create a control object and pass command line arguments</span></div>
<div class="line"> <span class="keywordflow">if</span> (!<a name="a30"></a><a class="code" href="group__Control.html#ga7ec38c676e45447bab71278b51e090c6">clingo_control_new</a>(argv+1, argc-1, NULL, NULL, 20, &ctl)) { <span class="keywordflow">goto</span> error; }</div>
<div class="line"> </div>
<div class="line"> <span class="comment">// get the configuration object and its root key</span></div>
<div class="line"> <span class="keywordflow">if</span> (!<a name="a31"></a><a class="code" href="group__Control.html#ga508042ea216ddfd24f4278310cc25321">clingo_control_configuration</a>(ctl, &conf)) { <span class="keywordflow">goto</span> error; }</div>
<div class="line"> <span class="keywordflow">if</span> (!<a name="a32"></a><a class="code" href="group__Configuration.html#ga15b79555a881cd2cae998bfafe2100e8">clingo_configuration_root</a>(conf, &conf_root)) { <span class="keywordflow">goto</span> error; }</div>
<div class="line"> <span class="comment">// and set the statistics level to one to get more statistics</span></div>
<div class="line"> <span class="keywordflow">if</span> (!<a name="a33"></a><a class="code" href="group__Configuration.html#ga01927ab51ff6c2bdd8e8ce46c5c05f15">clingo_configuration_map_at</a>(conf, conf_root, <span class="stringliteral">"stats"</span>, &conf_sub)) { <span class="keywordflow">goto</span> error; }</div>
<div class="line"> <span class="keywordflow">if</span> (!<a name="a34"></a><a class="code" href="group__Configuration.html#gacf50be61b36e0f0aaa3b367ac1ad18c4">clingo_configuration_value_set</a>(conf, conf_sub, <span class="stringliteral">"1"</span>)) { <span class="keywordflow">goto</span> error; }</div>
<div class="line"> </div>
<div class="line"> <span class="comment">// add a logic program to the base part</span></div>
<div class="line"> <span class="keywordflow">if</span> (!<a name="a35"></a><a class="code" href="group__Control.html#gada7b7f54331abfedf60fac33d742c0dc">clingo_control_add</a>(ctl, <span class="stringliteral">"base"</span>, NULL, 0, <span class="stringliteral">"a :- not b. b :- not a."</span>)) { <span class="keywordflow">goto</span> error; }</div>
<div class="line"> </div>
<div class="line"> <span class="comment">// ground the base part</span></div>
<div class="line"> <span class="keywordflow">if</span> (!<a name="a36"></a><a class="code" href="group__Control.html#gaf85b77055668171e6a85f9d729719b57">clingo_control_ground</a>(ctl, parts, 1, NULL, NULL)) { <span class="keywordflow">goto</span> error; }</div>
<div class="line"> </div>
<div class="line"> <span class="comment">// solve</span></div>
<div class="line"> <span class="keywordflow">if</span> (!solve(ctl, &solve_ret)) { <span class="keywordflow">goto</span> error; }</div>
<div class="line"> </div>
<div class="line"> <span class="comment">// get the statistics object, get the root key, then print the statistics recursively</span></div>
<div class="line"> <span class="keywordflow">if</span> (!<a name="a37"></a><a class="code" href="group__Control.html#ga0b6c40337fd896ad88f265d33a3c8cfb">clingo_control_statistics</a>(ctl, &stats)) { <span class="keywordflow">goto</span> error; }</div>
<div class="line"> <span class="keywordflow">if</span> (!<a class="code" href="group__Statistics.html#ga5d121de3ba67f0197c411334cf960959">clingo_statistics_root</a>(stats, &stats_key)) { <span class="keywordflow">goto</span> error; }</div>
<div class="line"> <span class="keywordflow">if</span> (!print_statistics(stats, stats_key, 0)) { <span class="keywordflow">goto</span> error; }</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">goto</span> out;</div>
<div class="line"> </div>
<div class="line">error:</div>
<div class="line"> <span class="keywordflow">if</span> (!(error_message = <a name="a38"></a><a class="code" href="group__BasicTypes.html#ga8bc3d9c18f15023bef4f427e5bf69c9f">clingo_error_message</a>())) { error_message = <span class="stringliteral">"error"</span>; }</div>
<div class="line"> </div>
<div class="line"> printf(<span class="stringliteral">"%s\n"</span>, error_message);</div>
<div class="line"> ret = <a name="a39"></a><a class="code" href="group__BasicTypes.html#gab6fae458db566efb7d6684ffda376aa8">clingo_error_code</a>();</div>
<div class="line"> </div>
<div class="line">out:</div>
<div class="line"> <span class="keywordflow">if</span> (ctl) { <a name="a40"></a><a class="code" href="group__Control.html#ga849604bd7107e6948a0e08e1dc10178a">clingo_control_free</a>(ctl); }</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">return</span> ret;</div>
<div class="line">}</div>
<div class="line"> </div>
</div><!-- fragment --> </div><!-- contents -->
<div class="ttc" id="agroup__SolveHandle_html_gga988c4d39df7949f444f1507896e97450a9070101cdf688b8f2ba6e2f968088746"><div class="ttname"><a href="group__SolveHandle.html#gga988c4d39df7949f444f1507896e97450a9070101cdf688b8f2ba6e2f968088746">clingo_solve_event_type_statistics</a></div><div class="ttdeci">@ clingo_solve_event_type_statistics</div><div class="ttdoc">Issued when the statistics can be updated.</div><div class="ttdef"><b>Definition:</b> clingo.h:2297</div></div>
<div class="ttc" id="agroup__Configuration_html_ga6b5341b39c79668474794d71efa4ee99"><div class="ttname"><a href="group__Configuration.html#ga6b5341b39c79668474794d71efa4ee99">clingo_statistics_map_at</a></div><div class="ttdeci">CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_map_at(clingo_statistics_t const *statistics, uint64_t key, char const *name, uint64_t *subkey)</div><div class="ttdoc">Lookup a subkey under the given name.</div></div>
<div class="ttc" id="agroup__SolveHandle_html_gga63eb87834deebecdf9c799d64a3c65a2a60a9c133be636e68a7d02680c8b9d47e"><div class="ttname"><a href="group__SolveHandle.html#gga63eb87834deebecdf9c799d64a3c65a2a60a9c133be636e68a7d02680c8b9d47e">clingo_solve_mode_yield</a></div><div class="ttdeci">@ clingo_solve_mode_yield</div><div class="ttdoc">Yield models in calls to clingo_solve_handle_model.</div><div class="ttdef"><b>Definition:</b> clingo.h:2288</div></div>
<div class="ttc" id="agroup__Configuration_html_ga6f288e6ab974c9d408d14cc478eb4ef4"><div class="ttname"><a href="group__Configuration.html#ga6f288e6ab974c9d408d14cc478eb4ef4">clingo_statistics_map_add_subkey</a></div><div class="ttdeci">CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_map_add_subkey(clingo_statistics_t *statistics, uint64_t key, char const *name, clingo_statistics_type_t type, uint64_t *subkey)</div><div class="ttdoc">Add a subkey with the given name.</div></div>
<div class="ttc" id="agroup__Model_html_gga72e8ba23a84af09dfd93739ebaa6ecf8a82a698ef41cd919cb370d22fc0b44826"><div class="ttname"><a href="group__Model.html#gga72e8ba23a84af09dfd93739ebaa6ecf8a82a698ef41cd919cb370d22fc0b44826">clingo_show_type_shown</a></div><div class="ttdeci">@ clingo_show_type_shown</div><div class="ttdoc">Select shown atoms and terms.</div><div class="ttdef"><b>Definition:</b> clingo.h:2098</div></div>
<div class="ttc" id="agroup__Control_html_gaf008e9db9dbb37b0b7ef039bb9d582f0"><div class="ttname"><a href="group__Control.html#gaf008e9db9dbb37b0b7ef039bb9d582f0">clingo_control_t</a></div><div class="ttdeci">struct clingo_control clingo_control_t</div><div class="ttdoc">Control object holding grounding and solving state.</div><div class="ttdef"><b>Definition:</b> clingo.h:2693</div></div>
<div class="ttc" id="agroup__Control_html_ga7ec38c676e45447bab71278b51e090c6"><div class="ttname"><a href="group__Control.html#ga7ec38c676e45447bab71278b51e090c6">clingo_control_new</a></div><div class="ttdeci">CLINGO_VISIBILITY_DEFAULT bool clingo_control_new(char const *const *arguments, size_t arguments_size, clingo_logger_t logger, void *logger_data, unsigned message_limit, clingo_control_t **control)</div><div class="ttdoc">Create a new control object.</div></div>
<div class="ttc" id="agroup__Statistics_html_ga3403c9356dad61654cdcf40985aa4de2"><div class="ttname"><a href="group__Statistics.html#ga3403c9356dad61654cdcf40985aa4de2">clingo_statistics_type_t</a></div><div class="ttdeci">int clingo_statistics_type_t</div><div class="ttdoc">Corresponding type to clingo_statistics_type.</div><div class="ttdef"><b>Definition:</b> clingo.h:1925</div></div>
<div class="ttc" id="agroup__SolveHandle_html_ga1cf28216485089df700495e681fbdc29"><div class="ttname"><a href="group__SolveHandle.html#ga1cf28216485089df700495e681fbdc29">clingo_solve_event_type_t</a></div><div class="ttdeci">unsigned clingo_solve_event_type_t</div><div class="ttdoc">Corresponding type to clingo_solve_event_type_e.</div><div class="ttdef"><b>Definition:</b> clingo.h:2301</div></div>
<div class="ttc" id="agroup__Configuration_html_ga8ef174014d3e115958de871b9dedd1cf"><div class="ttname"><a href="group__Configuration.html#ga8ef174014d3e115958de871b9dedd1cf">clingo_statistics_map_size</a></div><div class="ttdeci">CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_map_size(clingo_statistics_t const *statistics, uint64_t key, size_t *size)</div><div class="ttdoc">Get the number of subkeys of a map entry.</div></div>
<div class="ttc" id="agroup__Statistics_html_gga7f0cda11d4209314dcdccb83275555faafb64d43d4fb5619ff9b23a10d4a9d6a2"><div class="ttname"><a href="group__Statistics.html#gga7f0cda11d4209314dcdccb83275555faafb64d43d4fb5619ff9b23a10d4a9d6a2">clingo_statistics_type_value</a></div><div class="ttdeci">@ clingo_statistics_type_value</div><div class="ttdoc">the entry is a (double) value</div><div class="ttdef"><b>Definition:</b> clingo.h:1920</div></div>
<div class="ttc" id="agroup__Control_html_ga849604bd7107e6948a0e08e1dc10178a"><div class="ttname"><a href="group__Control.html#ga849604bd7107e6948a0e08e1dc10178a">clingo_control_free</a></div><div class="ttdeci">CLINGO_VISIBILITY_DEFAULT void clingo_control_free(clingo_control_t *control)</div><div class="ttdoc">Free a control object created with clingo_control_new().</div></div>
<div class="ttc" id="agroup__Statistics_html_ga188d561ad33870b2db3441c0ce26a3ed"><div class="ttname"><a href="group__Statistics.html#ga188d561ad33870b2db3441c0ce26a3ed">clingo_statistics_value_set</a></div><div class="ttdeci">CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_value_set(clingo_statistics_t *statistics, uint64_t key, double value)</div><div class="ttdoc">Set the value of the given entry.</div></div>
<div class="ttc" id="agroup__Statistics_html_gga7f0cda11d4209314dcdccb83275555faaf019ec1d66b02aed35f248adbca1ec78"><div class="ttname"><a href="group__Statistics.html#gga7f0cda11d4209314dcdccb83275555faaf019ec1d66b02aed35f248adbca1ec78">clingo_statistics_type_array</a></div><div class="ttdeci">@ clingo_statistics_type_array</div><div class="ttdoc">the entry is an array</div><div class="ttdef"><b>Definition:</b> clingo.h:1921</div></div>
<div class="ttc" id="aclingo_8h_html"><div class="ttname"><a href="clingo_8h.html">clingo.h</a></div></div>
<div class="ttc" id="agroup__Configuration_html_gab9d6a9902c2526a3d1a2d43414c70453"><div class="ttname"><a href="group__Configuration.html#gab9d6a9902c2526a3d1a2d43414c70453">clingo_statistics_array_push</a></div><div class="ttdeci">CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_array_push(clingo_statistics_t *statistics, uint64_t key, clingo_statistics_type_t type, uint64_t *subkey)</div><div class="ttdoc">Create the subkey at the end of an array entry.</div></div>
<div class="ttc" id="astructclingo__part_html"><div class="ttname"><a href="structclingo__part.html">clingo_part</a></div><div class="ttdoc">Struct used to specify the program parts that have to be grounded.</div><div class="ttdef"><b>Definition:</b> clingo.h:2645</div></div>
<div class="ttc" id="agroup__Statistics_html_gaa233d9d33c7299dcb8dbe8c3463e5fea"><div class="ttname"><a href="group__Statistics.html#gaa233d9d33c7299dcb8dbe8c3463e5fea">clingo_statistics_value_get</a></div><div class="ttdeci">CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_value_get(clingo_statistics_t const *statistics, uint64_t key, double *value)</div><div class="ttdoc">Get the value of the given entry.</div></div>
<div class="ttc" id="agroup__SolveHandle_html_ga488b76e7240d625bd4066e68a33ab23e"><div class="ttname"><a href="group__SolveHandle.html#ga488b76e7240d625bd4066e68a33ab23e">clingo_solve_handle_close</a></div><div class="ttdeci">CLINGO_VISIBILITY_DEFAULT bool clingo_solve_handle_close(clingo_solve_handle_t *handle)</div><div class="ttdoc">Stops the running search and releases the handle.</div></div>
<div class="ttc" id="agroup__Symbols_html_gac292526ba129269eec3c64510deec3b0"><div class="ttname"><a href="group__Symbols.html#gac292526ba129269eec3c64510deec3b0">clingo_symbol_to_string</a></div><div class="ttdeci">CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_to_string(clingo_symbol_t symbol, char *string, size_t size)</div><div class="ttdoc">Get the string representation of a symbol.</div></div>
<div class="ttc" id="agroup__Control_html_gaf85b77055668171e6a85f9d729719b57"><div class="ttname"><a href="group__Control.html#gaf85b77055668171e6a85f9d729719b57">clingo_control_ground</a></div><div class="ttdeci">CLINGO_VISIBILITY_DEFAULT bool clingo_control_ground(clingo_control_t *control, clingo_part_t const *parts, size_t parts_size, clingo_ground_callback_t ground_callback, void *ground_callback_data)</div><div class="ttdoc">Ground the selected parts of the current (non-ground) logic program.</div></div>
<div class="ttc" id="agroup__Control_html_gada7b7f54331abfedf60fac33d742c0dc"><div class="ttname"><a href="group__Control.html#gada7b7f54331abfedf60fac33d742c0dc">clingo_control_add</a></div><div class="ttdeci">CLINGO_VISIBILITY_DEFAULT bool clingo_control_add(clingo_control_t *control, char const *name, char const *const *parameters, size_t parameters_size, char const *program)</div><div class="ttdoc">Extend the logic program with the given non-ground logic program in string form.</div></div>
<div class="ttc" id="agroup__SolveHandle_html_gae4270b7d4d0174a479307438680007c5"><div class="ttname"><a href="group__SolveHandle.html#gae4270b7d4d0174a479307438680007c5">clingo_solve_handle_get</a></div><div class="ttdeci">CLINGO_VISIBILITY_DEFAULT bool clingo_solve_handle_get(clingo_solve_handle_t *handle, clingo_solve_result_bitset_t *result)</div><div class="ttdoc">Get the next solve result.</div></div>
<div class="ttc" id="agroup__Control_html_ga4b3b7388e75ace676481f6021c4dc66d"><div class="ttname"><a href="group__Control.html#ga4b3b7388e75ace676481f6021c4dc66d">clingo_control_solve</a></div><div class="ttdeci">CLINGO_VISIBILITY_DEFAULT bool clingo_control_solve(clingo_control_t *control, clingo_solve_mode_bitset_t mode, clingo_literal_t const *assumptions, size_t assumptions_size, clingo_solve_event_callback_t notify, void *data, clingo_solve_handle_t **handle)</div><div class="ttdoc">Solve the currently grounded logic program enumerating its models.</div></div>
<div class="ttc" id="agroup__Model_html_gaaf9a93819f023f3cb8aa80598c46556b"><div class="ttname"><a href="group__Model.html#gaaf9a93819f023f3cb8aa80598c46556b">clingo_model_t</a></div><div class="ttdeci">struct clingo_model clingo_model_t</div><div class="ttdoc">Object representing a model.</div><div class="ttdef"><b>Definition:</b> clingo.h:2085</div></div>
<div class="ttc" id="agroup__SolveHandle_html_ga73d71df7adeee92f1d515f52cdcbbac0"><div class="ttname"><a href="group__SolveHandle.html#ga73d71df7adeee92f1d515f52cdcbbac0">clingo_solve_handle_resume</a></div><div class="ttdeci">CLINGO_VISIBILITY_DEFAULT bool clingo_solve_handle_resume(clingo_solve_handle_t *handle)</div><div class="ttdoc">Discards the last model and starts the search for the next one.</div></div>
<div class="ttc" id="agroup__Symbols_html_ga6963e11f6d22a5c04a0e50d1afe1f4f5"><div class="ttname"><a href="group__Symbols.html#ga6963e11f6d22a5c04a0e50d1afe1f4f5">clingo_symbol_to_string_size</a></div><div class="ttdeci">CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_to_string_size(clingo_symbol_t symbol, size_t *size)</div><div class="ttdoc">Get the size of the string representation of a symbol (including the terminating 0).</div></div>
<div class="ttc" id="agroup__Model_html_ga5c6c30cef0e3a29a192577a1a739ca69"><div class="ttname"><a href="group__Model.html#ga5c6c30cef0e3a29a192577a1a739ca69">clingo_model_symbols_size</a></div><div class="ttdeci">CLINGO_VISIBILITY_DEFAULT bool clingo_model_symbols_size(clingo_model_t const *model, clingo_show_type_bitset_t show, size_t *size)</div><div class="ttdoc">Get the number of symbols of the selected types in the model.</div></div>
<div class="ttc" id="agroup__Control_html_ga0b6c40337fd896ad88f265d33a3c8cfb"><div class="ttname"><a href="group__Control.html#ga0b6c40337fd896ad88f265d33a3c8cfb">clingo_control_statistics</a></div><div class="ttdeci">CLINGO_VISIBILITY_DEFAULT bool clingo_control_statistics(clingo_control_t const *control, clingo_statistics_t const **statistics)</div><div class="ttdoc">Get a statistics object to inspect solver statistics.</div></div>
<div class="ttc" id="agroup__Configuration_html_gaec37ff3f8f3c1cdfd490cf156b4fb3d5"><div class="ttname"><a href="group__Configuration.html#gaec37ff3f8f3c1cdfd490cf156b4fb3d5">clingo_statistics_map_subkey_name</a></div><div class="ttdeci">CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_map_subkey_name(clingo_statistics_t const *statistics, uint64_t key, size_t offset, char const **name)</div><div class="ttdoc">Get the name associated with the offset-th subkey.</div></div>
<div class="ttc" id="agroup__Statistics_html_ga7f0cda11d4209314dcdccb83275555fa"><div class="ttname"><a href="group__Statistics.html#ga7f0cda11d4209314dcdccb83275555fa">clingo_statistics_type_e</a></div><div class="ttdeci">clingo_statistics_type_e</div><div class="ttdoc">Enumeration for entries of the statistics.</div><div class="ttdef"><b>Definition:</b> clingo.h:1918</div></div>
<div class="ttc" id="agroup__SolveHandle_html_ga023c1084a4c01ea6e121a8310efba045"><div class="ttname"><a href="group__SolveHandle.html#ga023c1084a4c01ea6e121a8310efba045">clingo_solve_handle_t</a></div><div class="ttdeci">struct clingo_solve_handle clingo_solve_handle_t</div><div class="ttdoc">Search handle to a solve call.</div><div class="ttdef"><b>Definition:</b> clingo.h:2322</div></div>
<div class="ttc" id="agroup__Control_html_gae917a23b0591d181004ec88c4e3291c1"><div class="ttname"><a href="group__Control.html#gae917a23b0591d181004ec88c4e3291c1">clingo_solve_result_bitset_t</a></div><div class="ttdeci">unsigned clingo_solve_result_bitset_t</div><div class="ttdef"><b>Definition:</b> clingo.h:2248</div></div>
<div class="ttc" id="agroup__Statistics_html_gaaba3981b0eb26dcf3e1b2043245e2516"><div class="ttname"><a href="group__Statistics.html#gaaba3981b0eb26dcf3e1b2043245e2516">clingo_statistics_t</a></div><div class="ttdeci">struct clingo_statistic clingo_statistics_t</div><div class="ttdoc">Handle for the solver statistics.</div><div class="ttdef"><b>Definition:</b> clingo.h:1928</div></div>
<div class="ttc" id="agroup__SolveHandle_html_gaf9353c14149a2a16adf0474796871ae1"><div class="ttname"><a href="group__SolveHandle.html#gaf9353c14149a2a16adf0474796871ae1">clingo_solve_handle_model</a></div><div class="ttdeci">CLINGO_VISIBILITY_DEFAULT bool clingo_solve_handle_model(clingo_solve_handle_t *handle, clingo_model_t const **model)</div><div class="ttdoc">Get the next model (or zero if there are no more models).</div></div>
<div class="ttc" id="agroup__Configuration_html_ga15b79555a881cd2cae998bfafe2100e8"><div class="ttname"><a href="group__Configuration.html#ga15b79555a881cd2cae998bfafe2100e8">clingo_configuration_root</a></div><div class="ttdeci">CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_root(clingo_configuration_t const *configuration, clingo_id_t *key)</div><div class="ttdoc">Get the root key of the configuration.</div></div>
<div class="ttc" id="agroup__Configuration_html_ga4f10089e16a4b98d8b90a22914561464"><div class="ttname"><a href="group__Configuration.html#ga4f10089e16a4b98d8b90a22914561464">clingo_statistics_array_at</a></div><div class="ttdeci">CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_array_at(clingo_statistics_t const *statistics, uint64_t key, size_t offset, uint64_t *subkey)</div><div class="ttdoc">Get the subkey at the given offset of an array entry.</div></div>
<div class="ttc" id="agroup__BasicTypes_html_gab6fae458db566efb7d6684ffda376aa8"><div class="ttname"><a href="group__BasicTypes.html#gab6fae458db566efb7d6684ffda376aa8">clingo_error_code</a></div><div class="ttdeci">CLINGO_VISIBILITY_DEFAULT clingo_error_t clingo_error_code()</div><div class="ttdoc">Get the last error code set by a clingo API call.</div></div>
<div class="ttc" id="agroup__BasicTypes_html_ga8bc3d9c18f15023bef4f427e5bf69c9f"><div class="ttname"><a href="group__BasicTypes.html#ga8bc3d9c18f15023bef4f427e5bf69c9f">clingo_error_message</a></div><div class="ttdeci">CLINGO_VISIBILITY_DEFAULT const char * clingo_error_message()</div><div class="ttdoc">Get the last error message set if an API call fails.</div></div>
<div class="ttc" id="agroup__Control_html_ga508042ea216ddfd24f4278310cc25321"><div class="ttname"><a href="group__Control.html#ga508042ea216ddfd24f4278310cc25321">clingo_control_configuration</a></div><div class="ttdeci">CLINGO_VISIBILITY_DEFAULT bool clingo_control_configuration(clingo_control_t *control, clingo_configuration_t **configuration)</div><div class="ttdoc">Get a configuration object to change the solver configuration.</div></div>
<div class="ttc" id="agroup__Symbols_html_ga6c75c60fa57c3b97505265ff08f6f951"><div class="ttname"><a href="group__Symbols.html#ga6c75c60fa57c3b97505265ff08f6f951">clingo_symbol_t</a></div><div class="ttdeci">uint64_t clingo_symbol_t</div><div class="ttdoc">Represents a symbol.</div><div class="ttdef"><b>Definition:</b> clingo.h:330</div></div>
<div class="ttc" id="agroup__Statistics_html_gga7f0cda11d4209314dcdccb83275555faaebbd4de02271d79efb38fd3a6a640178"><div class="ttname"><a href="group__Statistics.html#gga7f0cda11d4209314dcdccb83275555faaebbd4de02271d79efb38fd3a6a640178">clingo_statistics_type_map</a></div><div class="ttdeci">@ clingo_statistics_type_map</div><div class="ttdoc">the entry is a map</div><div class="ttdef"><b>Definition:</b> clingo.h:1922</div></div>
<div class="ttc" id="agroup__Statistics_html_ga5d121de3ba67f0197c411334cf960959"><div class="ttname"><a href="group__Statistics.html#ga5d121de3ba67f0197c411334cf960959">clingo_statistics_root</a></div><div class="ttdeci">CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_root(clingo_statistics_t const *statistics, uint64_t *key)</div><div class="ttdoc">Get the root key of the statistics.</div></div>
<div class="ttc" id="agroup__Statistics_html_gga7f0cda11d4209314dcdccb83275555faaf4631936f82edb3ca0f61ef6224cc694"><div class="ttname"><a href="group__Statistics.html#gga7f0cda11d4209314dcdccb83275555faaf4631936f82edb3ca0f61ef6224cc694">clingo_statistics_type_empty</a></div><div class="ttdeci">@ clingo_statistics_type_empty</div><div class="ttdoc">the entry is invalid (has neither of the types below)</div><div class="ttdef"><b>Definition:</b> clingo.h:1919</div></div>
<div class="ttc" id="agroup__BasicTypes_html_gac7aaf88deb591e91b94ff38aa1e3472e"><div class="ttname"><a href="group__BasicTypes.html#gac7aaf88deb591e91b94ff38aa1e3472e">clingo_id_t</a></div><div class="ttdeci">uint32_t clingo_id_t</div><div class="ttdoc">Unsigned integer type used in various places.</div><div class="ttdef"><b>Definition:</b> clingo.h:125</div></div>
<div class="ttc" id="agroup__Configuration_html_ga01927ab51ff6c2bdd8e8ce46c5c05f15"><div class="ttname"><a href="group__Configuration.html#ga01927ab51ff6c2bdd8e8ce46c5c05f15">clingo_configuration_map_at</a></div><div class="ttdeci">CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_map_at(clingo_configuration_t const *configuration, clingo_id_t key, char const *name, clingo_id_t *subkey)</div><div class="ttdoc">Lookup a subkey under the given name.</div></div>
<div class="ttc" id="agroup__Configuration_html_gacf50be61b36e0f0aaa3b367ac1ad18c4"><div class="ttname"><a href="group__Configuration.html#gacf50be61b36e0f0aaa3b367ac1ad18c4">clingo_configuration_value_set</a></div><div class="ttdeci">CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_value_set(clingo_configuration_t *configuration, clingo_id_t key, char const *value)</div><div class="ttdoc">Set the value of an entry.</div></div>
<div class="ttc" id="agroup__Statistics_html_gae642428c4ffada5044b2d62231cda8c8"><div class="ttname"><a href="group__Statistics.html#gae642428c4ffada5044b2d62231cda8c8">clingo_statistics_type</a></div><div class="ttdeci">CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_type(clingo_statistics_t const *statistics, uint64_t key, clingo_statistics_type_t *type)</div><div class="ttdoc">Get the type of a key.</div></div>
<div class="ttc" id="agroup__Configuration_html_gabf3ac9f48abde87a53cdba386f21bc2f"><div class="ttname"><a href="group__Configuration.html#gabf3ac9f48abde87a53cdba386f21bc2f">clingo_configuration_t</a></div><div class="ttdeci">struct clingo_configuration clingo_configuration_t</div><div class="ttdoc">Handle for to the solver configuration.</div><div class="ttdef"><b>Definition:</b> clingo.h:1744</div></div>
<div class="ttc" id="agroup__BasicTypes_html_ggaebdf91a4187db9abdd2c6ceb971cf13eaa14a0926eb3e653fcc13299b33d8d348"><div class="ttname"><a href="group__BasicTypes.html#ggaebdf91a4187db9abdd2c6ceb971cf13eaa14a0926eb3e653fcc13299b33d8d348">clingo_error_bad_alloc</a></div><div class="ttdeci">@ clingo_error_bad_alloc</div><div class="ttdoc">memory could not be allocated</div><div class="ttdef"><b>Definition:</b> clingo.h:145</div></div>
<div class="ttc" id="agroup__Configuration_html_gae0afc854112f942e9b455c2bdb79449d"><div class="ttname"><a href="group__Configuration.html#gae0afc854112f942e9b455c2bdb79449d">clingo_statistics_array_size</a></div><div class="ttdeci">CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_array_size(clingo_statistics_t const *statistics, uint64_t key, size_t *size)</div><div class="ttdoc">Get the size of an array entry.</div></div>
<div class="ttc" id="agroup__BasicTypes_html_ga5c2b2943475239e151eb783d30548b38"><div class="ttname"><a href="group__BasicTypes.html#ga5c2b2943475239e151eb783d30548b38">clingo_set_error</a></div><div class="ttdeci">CLINGO_VISIBILITY_DEFAULT void clingo_set_error(clingo_error_t code, char const *message)</div><div class="ttdoc">Set a custom error code and message in the active thread.</div></div>
<div class="ttc" id="agroup__Model_html_ga05d849166d689a3d4ae8d40fba070d91"><div class="ttname"><a href="group__Model.html#ga05d849166d689a3d4ae8d40fba070d91">clingo_model_symbols</a></div><div class="ttdeci">CLINGO_VISIBILITY_DEFAULT bool clingo_model_symbols(clingo_model_t const *model, clingo_show_type_bitset_t show, clingo_symbol_t *symbols, size_t size)</div><div class="ttdoc">Get the symbols of the selected types in the model.</div></div>
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Sep 16 2022 19:52:36 for Clingo C API by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.17
</small></address>
</body>
</html>