forked from potassco/potassco.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
clingo.html
2292 lines (2028 loc) · 159 KB
/
clingo.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
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: built-in module clingo</title>
<meta charset="utf-8">
</head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong>clingo</strong></big></big> (version 5.3.0)</font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href="/">«Potassco</a></font></td></tr></table>
<p><tt>The clingo-5.3.0 module.<br>
<br>
This module provides functions and classes to work with ground terms and to<br>
control the instantiation process. In clingo builts, additional functions to<br>
control and inspect the solving process are available.<br>
<br>
Functions defined in a python script block are callable during the<br>
instantiation process using @-syntax. The default grounding/solving process can<br>
be customized if a main function is provided.<br>
<br>
Note that gringo's precomputed terms (terms without variables and interpreted<br>
functions), called symbols in the following, are wrapped in the <a href="#Symbol">Symbol</a> class.<br>
Furthermore, strings, numbers, and tuples can be passed wherever a symbol is<br>
expected - they are automatically converted into a <a href="#Symbol">Symbol</a> object. Functions<br>
called during the grounding process from the logic program must either return a<br>
symbol or a sequence of symbols. If a sequence is returned, the corresponding<br>
@-term is successively substituted by the values in the sequence.<br>
<br>
Static Objects:<br>
<br>
__version__ -- version of the clingo module (5.3.0)<br>
Infimum -- represents an #inf symbol<br>
Supremum -- represents a #sup symbol<br>
<br>
Functions:<br>
<br>
<a href="#-Function">Function</a>() -- create a function symbol<br>
<a href="#-Number">Number</a>() -- create a number symbol<br>
<a href="#-parse_program">parse_program</a>() -- parse a logic program<br>
<a href="#-parse_term">parse_term</a>() -- parse ground terms<br>
<a href="#-String">String</a>() -- create a string symbol<br>
<a href="#-Tuple">Tuple</a>() -- create a tuple symbol (shortcut)<br>
<br>
Classes:<br>
<br>
<a href="#ApplicationOptions">ApplicationOptions</a> -- add custom options to clingo<br>
<a href="#Assignment">Assignment</a> -- partial assignment of truth values to solver literals<br>
<a href="#Backend">Backend</a> -- extend the logic program<br>
<a href="#Configuration">Configuration</a> -- modify/inspect the solver configuration<br>
<a href="#Control">Control</a> -- controls the grounding/solving process<br>
<a href="#Flag">Flag</a> -- helper object to parse command line flags<br>
<a href="#HeuristicType">HeuristicType</a> -- enumeration of heuristic modificators<br>
<a href="#MessageCode">MessageCode</a> -- enumeration of message codes<br>
<a href="#Model">Model</a> -- provides access to a model during solve call<br>
<a href="#ModelType">ModelType</a> -- captures the type of a model<br>
<a href="#ProgramBuilder">ProgramBuilder</a> -- extend a non-ground logic program<br>
<a href="#PropagatorCheckMode">PropagatorCheckMode</a> -- enumeration of check modes<br>
<a href="#PropagateControl">PropagateControl</a> -- controls running search in a custom propagator<br>
<a href="#PropagateInit">PropagateInit</a> -- object to initialize custom propagators<br>
<a href="#SolveControl">SolveControl</a> -- controls running search in a model handler<br>
<a href="#SolveHandle">SolveHandle</a> -- handle for solve calls<br>
<a href="#SolveResult">SolveResult</a> -- result of a solve call<br>
<a href="#StatisticsArray">StatisticsArray</a> -- updatable statistics stored in an array<br>
<a href="#StatisticsMap">StatisticsMap</a> -- updatable statistics stored in a map<br>
<a href="#Symbol">Symbol</a> -- captures precomputed terms<br>
<a href="#SymbolicAtom">SymbolicAtom</a> -- captures information about a symbolic atom<br>
<a href="#SymbolicAtomIter">SymbolicAtomIter</a> -- iterate over symbolic atoms<br>
<a href="#SymbolicAtoms">SymbolicAtoms</a> -- inspection of symbolic atoms<br>
<a href="#SymbolType">SymbolType</a> -- enumeration of symbol types<br>
<a href="#TheoryAtom">TheoryAtom</a> -- captures theory atoms<br>
<a href="#TheoryAtomIter">TheoryAtomIter</a> -- iterate over theory atoms<br>
<a href="#TheoryElement">TheoryElement</a> -- captures theory elements<br>
<a href="#TheoryTerm">TheoryTerm</a> -- captures theory terms<br>
<a href="#TheoryTermType">TheoryTermType</a> -- the type of a theory term<br>
<a href="#TruthValue">TruthValue</a> -- enumeration of truth values<br>
<br>
Example:<br>
<br>
#script (python)<br>
import clingo<br>
def id(x):<br>
return x<br>
<br>
def seq(x, y):<br>
return [x, y]<br>
<br>
def main(prg):<br>
prg.ground([("base", [])])<br>
prg.solve()<br>
<br>
#end.<br>
<br>
p(@id(10)).<br>
q(@seq(1,2)).</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="clingo.ast.html">clingo.ast</a><br>
</td><td width="25%" valign=top></td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#22bb33">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#22bb33"><tt> </tt></td><td> </td>
<td width="100%"><dl>
<dt><font face="helvetica, arial">object
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="clingo.html#ApplicationOptions">ApplicationOptions</a>
</font></dt><dt><font face="helvetica, arial"><a href="clingo.html#Assignment">Assignment</a>
</font></dt><dt><font face="helvetica, arial"><a href="clingo.html#Backend">Backend</a>
</font></dt><dt><font face="helvetica, arial"><a href="clingo.html#Configuration">Configuration</a>
</font></dt><dt><font face="helvetica, arial"><a href="clingo.html#Control">Control</a>
</font></dt><dt><font face="helvetica, arial"><a href="clingo.html#Flag">Flag</a>
</font></dt><dt><font face="helvetica, arial"><a href="clingo.html#HeuristicType">HeuristicType</a>
</font></dt><dt><font face="helvetica, arial"><a href="clingo.html#MessageCode">MessageCode</a>
</font></dt><dt><font face="helvetica, arial"><a href="clingo.html#Model">Model</a>
</font></dt><dt><font face="helvetica, arial"><a href="clingo.html#ModelType">ModelType</a>
</font></dt><dt><font face="helvetica, arial"><a href="clingo.html#ProgramBuilder">ProgramBuilder</a>
</font></dt><dt><font face="helvetica, arial"><a href="clingo.html#PropagateControl">PropagateControl</a>
</font></dt><dt><font face="helvetica, arial"><a href="clingo.html#PropagateInit">PropagateInit</a>
</font></dt><dt><font face="helvetica, arial"><a href="clingo.html#PropagatorCheckMode">PropagatorCheckMode</a>
</font></dt><dt><font face="helvetica, arial"><a href="clingo.html#SolveControl">SolveControl</a>
</font></dt><dt><font face="helvetica, arial"><a href="clingo.html#SolveHandle">SolveHandle</a>
</font></dt><dt><font face="helvetica, arial"><a href="clingo.html#SolveResult">SolveResult</a>
</font></dt><dt><font face="helvetica, arial"><a href="clingo.html#StatisticsArray">StatisticsArray</a>
</font></dt><dt><font face="helvetica, arial"><a href="clingo.html#StatisticsMap">StatisticsMap</a>
</font></dt><dt><font face="helvetica, arial"><a href="clingo.html#Symbol">Symbol</a>
</font></dt><dt><font face="helvetica, arial"><a href="clingo.html#SymbolType">SymbolType</a>
</font></dt><dt><font face="helvetica, arial"><a href="clingo.html#SymbolicAtom">SymbolicAtom</a>
</font></dt><dt><font face="helvetica, arial"><a href="clingo.html#SymbolicAtomIter">SymbolicAtomIter</a>
</font></dt><dt><font face="helvetica, arial"><a href="clingo.html#SymbolicAtoms">SymbolicAtoms</a>
</font></dt><dt><font face="helvetica, arial"><a href="clingo.html#TheoryAtom">TheoryAtom</a>
</font></dt><dt><font face="helvetica, arial"><a href="clingo.html#TheoryAtomIter">TheoryAtomIter</a>
</font></dt><dt><font face="helvetica, arial"><a href="clingo.html#TheoryElement">TheoryElement</a>
</font></dt><dt><font face="helvetica, arial"><a href="clingo.html#TheoryTerm">TheoryTerm</a>
</font></dt><dt><font face="helvetica, arial"><a href="clingo.html#TheoryTermType">TheoryTermType</a>
</font></dt><dt><font face="helvetica, arial"><a href="clingo.html#TruthValue">TruthValue</a>
</font></dt></dl>
</dd>
</dl>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#88ff99">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="ApplicationOptions">class <strong>ApplicationOptions</strong></a>(object)</font></td></tr>
<tr bgcolor="#88ff99"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt>Object add custom options to a clingo based application.<br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="ApplicationOptions-add"><strong>add</strong></a>(...)</dt><dd><tt><a href="#ApplicationOptions-add_flag">add_flag</a>(self, group, option, description, parser, multi, argument) -> None<br>
<br>
Add an option that is processed with a custom parser.<br>
<br>
Note that the parser also has to take care of storing the semantic value of<br>
the option somewhere.<br>
<br>
Parameter option specifies the name(s) of the option. For example, "ping,p"<br>
adds the short option "-p" and its long form "--ping". It is also possible to<br>
associate an option with a help level by adding "@l" to the option<br>
specification. Options with a level greater than zero are only shown if the<br>
argument to help is greater or equal to l.<br>
<br>
An option parser is a function that takes a string as input and returns true or<br>
false depending on whether the option was parsed successively.<br>
<br>
Note that an error is raised if an option with the same name already exists.<br>
<br>
Arguments:<br>
options -- object to register the option with<br>
group -- options are grouped into sections as given by this string<br>
option -- specifies the command line option<br>
description -- the description of the option<br>
parser -- callback to parse the value of the option<br>
<br>
Keyword Arguments:<br>
multi -- whether the option can appear multiple times on the command-line<br>
(Default: False)<br>
argument -- optional string to change the value name in the generated help<br>
output</tt></dd></dl>
<dl><dt><a name="ApplicationOptions-add_flag"><strong>add_flag</strong></a>(...)</dt><dd><tt><a href="#ApplicationOptions-add_flag">add_flag</a>(self, group, option, description, target) -> None<br>
<br>
Add an option that is a simple flag.<br>
<br>
This function is similar to <a href="#ApplicationOptions-add">add</a>() but simpler because it only supports flags,<br>
which do not have values. Note that the target parameter must be of type <a href="#Flag">Flag</a>,<br>
which is set to true if the flag is passed on the command line.<br>
<br>
Arguments:<br>
group -- options are grouped into sections as given by this string<br>
option -- name on the command line<br>
description -- description of the option<br>
target -- <a href="#Flag">Flag</a> object</tt></dd></dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#88ff99">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="Assignment">class <strong>Assignment</strong></a>(object)</font></td></tr>
<tr bgcolor="#88ff99"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt>Object to inspect the (parital) assignment of an associated solver.<br>
<br>
Assigns truth values to solver literals. Each solver literal is either true,<br>
false, or undefined, represented by the python constants True, False, or None,<br>
respectively.<br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Assignment-decision"><strong>decision</strong></a>(...)</dt><dd><tt><a href="#Assignment-decision">decision</a>(self, level) -> int<br>
<br>
Return the decision literal of the given level.</tt></dd></dl>
<dl><dt><a name="Assignment-has_literal"><strong>has_literal</strong></a>(...)</dt><dd><tt><a href="#Assignment-has_literal">has_literal</a>(self, lit) -> bool<br>
<br>
Determine if the literal is valid in this solver.</tt></dd></dl>
<dl><dt><a name="Assignment-is_false"><strong>is_false</strong></a>(...)</dt><dd><tt><a href="#Assignment-is_false">is_false</a>(self, lit) -> bool<br>
<br>
Determine if the literal is false.</tt></dd></dl>
<dl><dt><a name="Assignment-is_fixed"><strong>is_fixed</strong></a>(...)</dt><dd><tt><a href="#Assignment-is_fixed">is_fixed</a>(self, lit) -> bool<br>
<br>
Determine if the literal is assigned on the top level.</tt></dd></dl>
<dl><dt><a name="Assignment-is_true"><strong>is_true</strong></a>(...)</dt><dd><tt><a href="#Assignment-is_true">is_true</a>(self, lit) -> bool<br>
<br>
Determine if the literal is true.</tt></dd></dl>
<dl><dt><a name="Assignment-level"><strong>level</strong></a>(...)</dt><dd><tt><a href="#Assignment-level">level</a>(self, lit) -> int<br>
<br>
The decision level of the given literal.<br>
<br>
Note that the returned value is only meaningful if the literal is assigned -<br>
i.e., <a href="#Assignment-value">value</a>(lit) is not None.</tt></dd></dl>
<dl><dt><a name="Assignment-value"><strong>value</strong></a>(...)</dt><dd><tt><a href="#Assignment-value">value</a>(self, lit) -> bool or None<br>
<br>
The truth value of the given literal or None if it has none.</tt></dd></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>decision_level</strong></dt>
<dd><tt>The current decision level.</tt></dd>
</dl>
<dl><dt><strong>has_conflict</strong></dt>
<dd><tt>True if the assignment is conflicting.</tt></dd>
</dl>
<dl><dt><strong>is_total</strong></dt>
<dd><tt>Wheather the assignment is total.</tt></dd>
</dl>
<dl><dt><strong>max_size</strong></dt>
<dd><tt>The maximum size of the assignment (if all literals are assigned).</tt></dd>
</dl>
<dl><dt><strong>size</strong></dt>
<dd><tt>The number of assigned literals.</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#88ff99">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="Backend">class <strong>Backend</strong></a>(object)</font></td></tr>
<tr bgcolor="#88ff99"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt><a href="#Backend">Backend</a> object providing a low level interface to extend a logic program.<br>
<br>
This class provides an interface that allows for adding statements in ASPIF<br>
format.<br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Backend-__enter__"><strong>__enter__</strong></a>(...)</dt><dd><tt><a href="#Backend-__enter__">__enter__</a>(self) -> <a href="#Backend">Backend</a><br>
<br>
Initialize the backend.<br>
<br>
Must be called before using the backend.</tt></dd></dl>
<dl><dt><a name="Backend-__exit__"><strong>__exit__</strong></a>(...)</dt><dd><tt><a href="#Backend-__exit__">__exit__</a>(self, type, value, traceback) -> bool<br>
<br>
Finalize the backend.<br>
<br>
Follows python __exit__ conventions. Does not suppress exceptions.</tt></dd></dl>
<dl><dt><a name="Backend-add_atom"><strong>add_atom</strong></a>(...)</dt><dd><tt><a href="#Backend-add_atom">add_atom</a>(self, symbol) -> Int<br>
<br>
Return a fresh program atom or the atom associated with the given symbol.<br>
<br>
If the given symbol does not exist in the atom base, it is added first. Such<br>
atoms will be used in susequents calls to ground for instantiation.<br>
<br>
Keyword Arguments:<br>
symbol -- optional symbol (Default: None)</tt></dd></dl>
<dl><dt><a name="Backend-add_external"><strong>add_external</strong></a>(...)</dt><dd><tt><a href="#Backend-add_atom">add_atom</a>(self, atom, value) -> Int<br>
<br>
Mark an atom as external optionally fixing its truth value.<br>
<br>
Can also be used to unmark an external atom.<br>
<br>
Arguments:<br>
atom -- the atom to mark as external<br>
<br>
Keyword Arguments:<br>
value -- optional truth value (Default: <a href="#TruthValue">TruthValue</a>._False)</tt></dd></dl>
<dl><dt><a name="Backend-add_minimize"><strong>add_minimize</strong></a>(...)</dt><dd><tt><a href="#Backend-add_minimize">add_minimize</a>(self, priority, literals) -> None<br>
Add a minimize constraint to the program.<br>
<br>
Arguments:<br>
priority -- integer for the priority<br>
literals -- list of pairs of program literals and weights</tt></dd></dl>
<dl><dt><a name="Backend-add_rule"><strong>add_rule</strong></a>(...)</dt><dd><tt><a href="#Backend-add_rule">add_rule</a>(self, head, body, choice) -> None<br>
<br>
Add a disjuntive or choice rule to the program.<br>
<br>
Arguments:<br>
head -- list of program atoms<br>
<br>
Keyword Arguments:<br>
body -- list of program literals (Default: [])<br>
choice -- whether to add a disjunctive or choice rule (Default: False)<br>
<br>
Integrity constraints and normal rules can be added by using an empty or<br>
singleton head list, respectively.</tt></dd></dl>
<dl><dt><a name="Backend-add_weight_rule"><strong>add_weight_rule</strong></a>(...)</dt><dd><tt><a href="#Backend-add_weight_rule">add_weight_rule</a>(self, head, lower, body, choice) -> None<br>
Add a disjuntive or choice rule with one weight constraint with a lower bound<br>
in the body to the program.<br>
<br>
Arguments:<br>
head -- list of program atoms<br>
lower -- integer for the lower bound<br>
body -- list of pairs of program literals and weights<br>
<br>
Keyword Arguments:<br>
choice -- whether to add a disjunctive or choice rule (Default: False)</tt></dd></dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#88ff99">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="Configuration">class <strong>Configuration</strong></a>(object)</font></td></tr>
<tr bgcolor="#88ff99"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt>Allows for changing the configuration of the underlying solver.<br>
<br>
Options are organized hierarchically. To change and inspect an option use:<br>
<br>
config.group.subgroup.option = "value"<br>
value = config.group.subgroup.option<br>
<br>
There are also arrays of option groups that can be accessed using integer<br>
indices:<br>
<br>
config.group.subgroup[0].option = "value1"<br>
config.group.subgroup[1].option = "value2"<br>
<br>
To list the subgroups of an option group, use the keys member. Array option<br>
groups, like solver, have a non-negative length and can be iterated.<br>
Furthermore, there are meta options having key "configuration". Assigning a<br>
meta option sets a number of related options. To get further information about<br>
an option or option group <opt>, use property __desc_<opt> to retrieve a<br>
description.<br>
<br>
Example:<br>
<br>
#script (python)<br>
import clingo<br>
<br>
def main(prg):<br>
prg.configuration.solve.models = 0<br>
prg.ground([("base", [])])<br>
prg.solve()<br>
<br>
#end.<br>
<br>
{a; c}.<br>
<br>
Expected Answer Sets:<br>
<br>
{ {}, {a}, {c}, {a,c} }<br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Configuration-__delattr__"><strong>__delattr__</strong></a>(...)</dt><dd><tt>x.<a href="#Configuration-__delattr__">__delattr__</a>('name') <==> del x.name</tt></dd></dl>
<dl><dt><a name="Configuration-__getattribute__"><strong>__getattribute__</strong></a>(...)</dt><dd><tt>x.<a href="#Configuration-__getattribute__">__getattribute__</a>('name') <==> x.name</tt></dd></dl>
<dl><dt><a name="Configuration-__getitem__"><strong>__getitem__</strong></a>(...)</dt><dd><tt>x.<a href="#Configuration-__getitem__">__getitem__</a>(y) <==> x[y]</tt></dd></dl>
<dl><dt><a name="Configuration-__len__"><strong>__len__</strong></a>(...)</dt><dd><tt>x.<a href="#Configuration-__len__">__len__</a>() <==> len(x)</tt></dd></dl>
<dl><dt><a name="Configuration-__setattr__"><strong>__setattr__</strong></a>(...)</dt><dd><tt>x.<a href="#Configuration-__setattr__">__setattr__</a>('name', value) <==> x.name = value</tt></dd></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>keys</strong></dt>
<dd><tt>The list of names of sub-option groups or options.<br>
<br>
The list is None if the current object is not an option group.</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#88ff99">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="Control">class <strong>Control</strong></a>(object)</font></td></tr>
<tr bgcolor="#88ff99"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt><a href="#Control">Control</a>(arguments) -> <a href="#Control">Control</a><br>
<br>
<a href="#Control">Control</a> object for the grounding/solving process.<br>
<br>
Keyword Arguments:<br>
arguments -- arguments to the grounder and solver (default: []).<br>
logger -- function to intercept messages normally printed to standard<br>
error (default: None)<br>
message_limit -- maximum number of messages passed to the logger (default: 20)<br>
<br>
Note that only gringo options (without --text) and clasp's search options are<br>
supported. Furthermore, a <a href="#Control">Control</a> object is blocked while a search call is<br>
active; you must not call any member function during search.<br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Control-__init__"><strong>__init__</strong></a>(...)</dt><dd><tt>x.<a href="#Control-__init__">__init__</a>(...) initializes x; see help(type(x)) for signature</tt></dd></dl>
<dl><dt><a name="Control-add"><strong>add</strong></a>(...)</dt><dd><tt><a href="#Control-add">add</a>(self, name, params, program) -> None<br>
<br>
Extend the logic program with the given non-ground logic program in string form.<br>
<br>
Arguments:<br>
name -- name of program block to add<br>
params -- parameters of program block<br>
program -- non-ground program as string<br>
<br>
Example:<br>
<br>
#script (python)<br>
import clingo<br>
<br>
def main(prg):<br>
prg.<a href="#Control-add">add</a>("p", ["t"], "q(t).")<br>
prg.<a href="#Control-ground">ground</a>([("p", [2])])<br>
prg.<a href="#Control-solve">solve</a>()<br>
<br>
#end.<br>
<br>
Expected Answer Set:<br>
q(2)</tt></dd></dl>
<dl><dt><a name="Control-assign_external"><strong>assign_external</strong></a>(...)</dt><dd><tt><a href="#Control-assign_external">assign_external</a>(self, external, truth) -> None<br>
<br>
Assign a truth value to an external atom (represented as a function symbol or<br>
program literal).<br>
<br>
It is possible to assign a Boolean or None. A Boolean fixes the external to the<br>
respective truth value; and None leaves its truth value open.<br>
<br>
The truth value of an external atom can be changed before each solve call. An<br>
atom is treated as external if it has been declared using an #external<br>
directive, and has not been forgotten by calling <a href="#Control-release_external">release_external</a>() or defined<br>
in a logic program with some rule. If the given atom is not external, then the<br>
function has no effect.<br>
<br>
For convenience, the truth assigned to atoms over negative program literals is<br>
inverted.<br>
<br>
Arguments:<br>
external -- symbol or program literal representing the external atom<br>
truth -- bool or None indicating the truth value<br>
<br>
To determine whether an atom a is external, inspect the symbolic_atoms using<br>
<a href="#SolveControl">SolveControl</a>.symbolic_atoms[a].is_external. See <a href="#Control-release_external">release_external</a>() for an<br>
example.</tt></dd></dl>
<dl><dt><a name="Control-backend"><strong>backend</strong></a>(...)</dt><dd><tt><a href="#Control-backend">backend</a>() -> <a href="#Backend">Backend</a><br>
<br>
Returns a <a href="#Backend">Backend</a> object providing a low level interface to extend a logic program.</tt></dd></dl>
<dl><dt><a name="Control-builder"><strong>builder</strong></a>(...)</dt><dd><tt><a href="#Control-builder">builder</a>(self) -> <a href="#ProgramBuilder">ProgramBuilder</a><br>
<br>
Return a builder to construct non-ground logic programs.<br>
<br>
Example:<br>
<br>
#script (python)<br>
<br>
import clingo<br>
<br>
def main(prg):<br>
s = "a."<br>
with prg.<a href="#Control-builder">builder</a>() as b:<br>
clingo.<a href="#-parse_program">parse_program</a>(s, lambda stm: b.<a href="#Control-add">add</a>(stm))<br>
prg.<a href="#Control-ground">ground</a>([("base", [])])<br>
prg.<a href="#Control-solve">solve</a>()<br>
<br>
#end.</tt></dd></dl>
<dl><dt><a name="Control-cleanup"><strong>cleanup</strong></a>(...)</dt><dd><tt><a href="#Control-cleanup">cleanup</a>(self) -> None<br>
<br>
Cleanup the domain used for grounding by incorporating information from the<br>
solver.<br>
<br>
This function cleans up the domain used for grounding. This is done by first<br>
simplifying the current program representation (falsifying released external<br>
atoms). Afterwards, the top-level implications are used to either remove atoms<br>
from the domain or mark them as facts.<br>
<br>
Note that any atoms falsified are completely removed from the logic program.<br>
Hence, a definition for such an atom in a successive step introduces a fresh atom.</tt></dd></dl>
<dl><dt><a name="Control-get_const"><strong>get_const</strong></a>(...)</dt><dd><tt><a href="#Control-get_const">get_const</a>(self, name) -> <a href="#Symbol">Symbol</a><br>
<br>
Return the symbol for a constant definition of form: #const name = symbol.</tt></dd></dl>
<dl><dt><a name="Control-ground"><strong>ground</strong></a>(...)</dt><dd><tt><a href="#Control-ground">ground</a>(self, parts, context) -> None<br>
<br>
Ground the given list of program parts specified by tuples of names and arguments.<br>
<br>
Keyword Arguments:<br>
parts -- list of tuples of program names and program arguments to ground<br>
context -- context object whose methods are called during grounding using<br>
the @-syntax (if omitted methods from the main module are used)<br>
<br>
Note that parts of a logic program without an explicit #program specification<br>
are by default put into a program called base without arguments.<br>
<br>
Example:<br>
<br>
#script (python)<br>
import clingo<br>
<br>
def main(prg):<br>
parts = []<br>
parts.append(("p", [1]))<br>
parts.append(("p", [2]))<br>
prg.<a href="#Control-ground">ground</a>(parts)<br>
prg.<a href="#Control-solve">solve</a>()<br>
<br>
#end.<br>
<br>
#program p(t).<br>
q(t).<br>
<br>
Expected Answer Set:<br>
q(1) q(2)</tt></dd></dl>
<dl><dt><a name="Control-interrupt"><strong>interrupt</strong></a>(...)</dt><dd><tt><a href="#Control-interrupt">interrupt</a>(self) -> None<br>
<br>
Interrupt the active solve call.<br>
<br>
This function is thread-safe and can be called from a signal handler. If no<br>
search is active the subsequent call to <a href="#Control-solve">solve</a>() is interrupted. The <a href="#SolveResult">SolveResult</a><br>
of the above solving methods can be used to query if the search was<br>
interrupted.</tt></dd></dl>
<dl><dt><a name="Control-load"><strong>load</strong></a>(...)</dt><dd><tt><a href="#Control-load">load</a>(self, path) -> None<br>
<br>
Extend the logic program with a (non-ground) logic program in a file.<br>
<br>
Arguments:<br>
path -- path to program</tt></dd></dl>
<dl><dt><a name="Control-register_observer"><strong>register_observer</strong></a>(...)</dt><dd><tt><a href="#Control-register_observer">register_observer</a>(self, observer, replace) -> None<br>
<br>
Registers the given observer to inspect the produced grounding.<br>
<br>
Arguments:<br>
observer -- the observer to register<br>
<br>
Keyword Arguments:<br>
replace -- if set to true, the output is just passed to the observer and no<br>
longer to the underlying solver<br>
(Default: False)<br>
<br>
An observer should be a class of the form below. Not all functions have to be<br>
implemented and can be omitted if not needed.<br>
<br>
class GroundProgramObserver:<br>
init_program(self, incremental) -> None<br>
Called once in the beginning.<br>
<br>
If the incremental flag is true, there can be multiple calls to<br>
<a href="#Control">Control</a>.<a href="#Control-solve">solve</a>().<br>
<br>
Arguments:<br>
incremental -- whether the program is incremental<br>
<br>
begin_step(self) -> None<br>
Marks the beginning of a block of directives passed to the solver.<br>
<br>
rule(self, choice, head, body) -> None<br>
Observe rules passed to the solver.<br>
<br>
Arguments:<br>
choice -- determines if the head is a choice or a disjunction<br>
head -- list of program atoms<br>
body -- list of program literals<br>
<br>
weight_rule(self, choice, head, lower_bound, body) -> None<br>
Observe weight rules passed to the solver.<br>
<br>
Arguments:<br>
choice -- determines if the head is a choice or a disjunction<br>
head -- list of program atoms<br>
lower_bound -- the lower bound of the weight rule<br>
body -- list of weighted literals (pairs of literal and weight)<br>
<br>
minimize(self, priority, literals) -> None<br>
Observe minimize constraints (or weak constraints) passed to the<br>
solver.<br>
<br>
Arguments:<br>
priority -- the priority of the constraint<br>
literals -- list of weighted literals whose sum to minimize<br>
(pairs of literal and weight)<br>
<br>
project(self, atoms) -> None<br>
Observe projection directives passed to the solver.<br>
<br>
Arguments:<br>
atoms -- the program atoms to project on<br>
<br>
output_atom(self, symbol, atom) -> None<br>
Observe shown atoms passed to the solver. Facts do not have an<br>
associated program atom. The value of the atom is set to zero.<br>
<br>
Arguments:<br>
symbol -- the symbolic representation of the atom<br>
atom -- the program atom (0 for facts)<br>
<br>
output_term(self, symbol, condition) -> None<br>
Observe shown terms passed to the solver.<br>
<br>
Arguments:<br>
symbol -- the symbolic representation of the term<br>
condition -- list of program literals<br>
<br>
output_csp(self, symbol, value, condition) -> None<br>
Observe shown csp variables passed to the solver.<br>
<br>
Arguments:<br>
symbol -- the symbolic representation of the variable<br>
value -- the integer value of the variable<br>
condition -- list of program literals<br>
<br>
external(self, atom, value) -> None<br>
Observe external statements passed to the solver.<br>
<br>
Arguments:<br>
atom -- the external atom in form of a literal<br>
value -- the <a href="#TruthValue">TruthValue</a> of the external statement<br>
<br>
assume(self, literals) -> None<br>
Observe assumption directives passed to the solver.<br>
<br>
Arguments:<br>
literals -- the program literals to assume (positive literals are true<br>
and negative literals false for the next solve call)<br>
<br>
heuristic(self, atom, type, bias, priority, condition) -> None<br>
Observe heuristic directives passed to the solver.<br>
<br>
Arguments:<br>
atom -- the target atom<br>
type -- the <a href="#HeuristicType">HeuristicType</a><br>
bias -- the heuristic bias<br>
priority -- the heuristic priority<br>
condition -- list of program literals<br>
<br>
acyc_edge(self, node_u, node_v, condition) -> None<br>
Observe edge directives passed to the solver.<br>
<br>
Arguments:<br>
node_u -- the start vertex of the edge (in form of an integer)<br>
node_v -- the end vertex of the edge (in form of an integer)<br>
condition -- list of program literals<br>
<br>
theory_term_number(self, term_id, number) -> None<br>
Observe numeric theory terms.<br>
<br>
Arguments:<br>
term_id -- the id of the term<br>
number -- the (integer) value of the term<br>
<br>
theory_term_string(self, term_id, name) -> None<br>
Observe string theory terms.<br>
<br>
Arguments:<br>
term_id -- the id of the term<br>
name -- the string value of the term<br>
<br>
theory_term_compound(self, term_id, name_id_or_type, arguments) -> None<br>
Observe compound theory terms.<br>
<br>
The name_id_or_type gives the type of the compound term:<br>
- if it is -1, then it is a tuple<br>
- if it is -2, then it is a set<br>
- if it is -3, then it is a list<br>
- otherwise, it is a function and name_id_or_type refers to the id of<br>
the name (in form of a string term)<br>
<br>
Arguments:<br>
term_id -- the id of the term<br>
name_id_or_type -- the name or type of the term<br>
arguments -- the arguments of the term<br>
<br>
theory_element(self, element_id, terms, condition) -> None<br>
Observe theory elements.<br>
<br>
Arguments:<br>
element_id -- the id of the element<br>
terms -- term tuple of the element<br>
condition -- list of program literals<br>
<br>
theory_atom(self, atom_id_or_zero, term_id, elements) -> None<br>
Observe theory atoms without guard.<br>
<br>
Arguments:<br>
atom_id_or_zero -- the id of the atom or zero for directives<br>
term_id -- the term associated with the atom<br>
elements -- the list of elements of the atom<br>
<br>
theory_atom_with_guard(self, atom_id_or_zero, term_id, elements,<br>
operator_id, right_hand_side_id) -> None<br>
Observe theory atoms with guard.<br>
<br>
Arguments:<br>
atom_id_or_zero -- the id of the atom or zero for directives<br>
term_id -- the term associated with the atom<br>
elements -- the elements of the atom<br>
operator_id -- the id of the operator (a string term)<br>
right_hand_side_id -- the id of the term on the right hand side of the atom<br>
<br>
end_step(self) -> None<br>
Marks the end of a block of directives passed to the solver.<br>
<br>
This function is called right before solving starts.</tt></dd></dl>
<dl><dt><a name="Control-register_propagator"><strong>register_propagator</strong></a>(...)</dt><dd><tt><a href="#Control-register_propagator">register_propagator</a>(self, propagator) -> None<br>
<br>
Registers the given propagator with all solvers.<br>
<br>
Arguments:<br>
propagator -- the propagator to register<br>
<br>
A propagator should be a class of the form below. Not all functions have to be<br>
implemented and can be omitted if not needed.<br>
<br>
class Propagator(object)<br>
init(self, init) -> None<br>
This function is called once before each solving step. It is used to<br>
map relevant program literals to solver literals, add watches for<br>
solver literals, and initialize the data structures used during<br>
propagation.<br>
<br>
Arguments:<br>
init -- <a href="#PropagateInit">PropagateInit</a> object<br>
<br>
Note that this is the last point to access theory atoms. Once the<br>
search has started, they are no longer accessible.<br>
<br>
propagate(self, control, changes) -> None<br>
Can be used to propagate solver literals given a partial assignment.<br>
<br>
Arguments:<br>
control -- <a href="#PropagateControl">PropagateControl</a> object<br>
changes -- list of watched solver literals assigned to true<br>
<br>
Usage:<br>
Called during propagation with a non-empty list of watched solver<br>
literals that have been assigned to true since the last call to either<br>
propagate, undo, (or the start of the search) - the change set. Only<br>
watched solver literals are contained in the change set. Each literal<br>
in the change set is true w.r.t. the current <a href="#Assignment">Assignment</a>.<br>
<a href="#PropagateControl">PropagateControl</a>.add_clause can be used to add clauses. If a clause is<br>
unit resulting, it can be propagated using<br>
<a href="#PropagateControl">PropagateControl</a>.propagate(). If either of the two methods returns<br>
False, the propagate function must return immediately.<br>
<br>
c = ...<br>
if not control.add_clause(c) or not control.propagate(c):<br>
return<br>
<br>
Note that this function can be called from different solving threads.<br>
Each thread has its own assignment and id, which can be obtained using<br>
<a href="#PropagateControl">PropagateControl</a>.id().<br>
<br>
undo(self, thread_id, assign, changes) -> None<br>
Called whenever a solver with the given id undos assignments to watched<br>
solver literals.<br>
<br>
Arguments:<br>
thread_id -- the solver thread id<br>
changes -- list of watched solver literals whose assignment is undone<br>
<br>
This function is meant to update assignment dependent state in a<br>
propagator.<br>
<br>
check(self, control) -> None<br>
This function is similar to propagate but is called without a change<br>
set on propagation fixpoints. When exactly this function is called,<br>
can be configured using the @ref <a href="#PropagateInit">PropagateInit</a>.check_mode property.<br>
<br>
Note that this function is called even if no watches have been added.<br>
<br>
Arguments:<br>
control -- <a href="#PropagateControl">PropagateControl</a> object<br>
<br>
This function is called even if no watches have been added.</tt></dd></dl>
<dl><dt><a name="Control-release_external"><strong>release_external</strong></a>(...)</dt><dd><tt><a href="#Control-release_external">release_external</a>(self, symbol) -> None<br>
<br>
Release an external atom represented by the given symbol or program literal.<br>
<br>
This function causes the corresponding atom to become permanently false if<br>
there is no definition for the atom in the program. Otherwise, the function has<br>
no effect.<br>
<br>
If the program literal is negative, the corresponding atom is released.<br>
<br>
Example:<br>
<br>
#script (python)<br>
from clingo import function<br>
<br>
def main(prg):<br>
prg.<a href="#Control-ground">ground</a>([("base", [])])<br>
prg.<a href="#Control-assign_external">assign_external</a>(<a href="#-Function">Function</a>("b"), True)<br>
prg.<a href="#Control-solve">solve</a>()<br>
prg.<a href="#Control-release_external">release_external</a>(<a href="#-Function">Function</a>("b"))<br>
prg.<a href="#Control-solve">solve</a>()<br>
<br>
#end.<br>
<br>
a.<br>
#external b.<br>
<br>
Expected Answer Sets:<br>
a b<br>
a</tt></dd></dl>
<dl><dt><a name="Control-solve"><strong>solve</strong></a>(...)</dt><dd><tt><a href="#Control-solve">solve</a>(self, assumptions, on_model, on_finish, yield_, async) -> <a href="#SolveHandle">SolveHandle</a>|<a href="#SolveResult">SolveResult</a><br>
<br>
Starts a search.<br>
<br>
Keyword Arguments:<br>
on_model -- Optional callback for intercepting models.<br>
A <a href="#Model">Model</a> object is passed to the callback.<br>
(Default: None)<br>
on_statistics -- Optional callback to update statistics.<br>
The step and accumulated statistics are passed as arguments.<br>
(Default: None)<br>
on_finish -- Optional callback called once search has finished.<br>
A <a href="#SolveResult">SolveResult</a> and a Boolean indicating whether the solve call<br>
has been canceled is passed to the callback.<br>
(Default: None)<br>
assumptions -- List of (atom, boolean) tuples or program literals that serve<br>
as assumptions for the solve call, e.g. - solving under<br>
assumptions [(<a href="#-Function">Function</a>("a"), True)] only admits answer sets<br>
that contain atom a.<br>
(Default: [])<br>
yield_ -- The resulting <a href="#SolveHandle">SolveHandle</a> is iterable yielding <a href="#Model">Model</a> objects.<br>
(Default: False)<br>
async -- The solve call and <a href="#SolveHandle">SolveHandle</a>.resume() are non-blocking.<br>
(Default: False)<br>
<br>
If neither yield_ nor async is set, the function returns a <a href="#SolveResult">SolveResult</a> right<br>
away.<br>
<br>
Note that in gringo or in clingo with lparse or text output enabled this<br>
function just grounds and returns a <a href="#SolveResult">SolveResult</a> where <a href="#SolveResult">SolveResult</a>.satisfiable<br>
is True.<br>
<br>
You might want to start clingo using the --outf=3 option to disable all output<br>
from clingo.<br>
<br>
Note that asynchronous solving is only available in clingo with thread support<br>
enabled. Furthermore, the on_model and on_finish callbacks are called from<br>
another thread. To ensure that the methods can be called, make sure to not use<br>
any functions that block the GIL indefinitely.<br>
<br>
This function as well as blocking functions on the <a href="#SolveHandle">SolveHandle</a> release the GIL<br>
but are not thread-safe.<br>
<br>
Example:<br>
<br>
#script (python)<br>
import clingo<br>
<br>
def main(prg):<br>
prg.<a href="#Control-add">add</a>("p", [], "{a;b;c}.")<br>
prg.<a href="#Control-ground">ground</a>([("p", [])])<br>
ret = prg.<a href="#Control-solve">solve</a>()<br>
print(ret)<br>
<br>
#end.<br>
<br>
Yielding Example:<br>
<br>
#script (python)<br>
import clingo<br>
<br>
def main(prg):<br>
prg.<a href="#Control-add">add</a>("p", [], "{a;b;c}.")<br>
prg.<a href="#Control-ground">ground</a>([("p", [])])<br>
with prg.<a href="#Control-solve">solve</a>(yield_=True) as handle:<br>
for m in handle: print m<br>
print(handle.get())<br>
<br>
#end.<br>
<br>
Asynchronous Example:<br>
<br>
#script (python)<br>
import clingo<br>
<br>
def on_model(model):<br>
print model<br>
<br>
def on_finish(res, canceled):<br>
print res, canceled<br>
<br>
def main(prg):<br>
prg.<a href="#Control-add">add</a>("p", [], "{a;b;c}.")<br>
prg.<a href="#Control-ground">ground</a>([("base", [])])<br>
with prg.<a href="#Control-solve">solve</a>(on_model=on_model, on_finish=on_finish, async=True) as handle:<br>
while not handle.wait(0):<br>
# do something asynchronously<br>
print(handle.get())<br>
<br>
#end.</tt></dd></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>configuration</strong></dt>
<dd><tt>Configuration object to change the configuration.</tt></dd>
</dl>
<dl><dt><strong>is_conflicting</strong></dt>
<dd><tt>Whether the internal program representation is conflicting.<br>
<br>
If this (read-only) property is true, solve calls return immediately with an<br>
unsatisfiable solve result. Note that conflicts first have to be detected,<br>
e.g. - initial unit propagation results in an empty clause, or later if an<br>
empty clause is resolved during solving. Hence, the property might be false<br>
even if the problem is unsatisfiable.</tt></dd>
</dl>
<dl><dt><strong>statistics</strong></dt>
<dd><tt>A dictionary containing solve statistics of the last solve call.<br>
<br>
Contains the statistics of the last solve() call. The statistics correspond to<br>
the --stats output of clingo. The detail of the statistics depends on what<br>
level is requested on the command line. Furthermore, you might want to start<br>
clingo using the --outf=3 option to disable all output from clingo.<br>
<br>
Note that this (read-only) property is only available in clingo.<br>
<br>
Example:<br>
import json<br>
json.dumps(prg.statistics, sort_keys=True, indent=4, separators=(',', ': '))</tt></dd>
</dl>
<dl><dt><strong>symbolic_atoms</strong></dt>
<dd><tt>SymbolicAtoms object to inspect the symbolic atoms.</tt></dd>
</dl>
<dl><dt><strong>theory_atoms</strong></dt>
<dd><tt>A TheoryAtomIter object, which can be used to iterate over the theory atoms.</tt></dd>
</dl>
<dl><dt><strong>use_enumeration_assumption</strong></dt>
<dd><tt>Boolean determining how learnt information from enumeration modes is treated.<br>
<br>
If the enumeration assumption is enabled, then all information learnt from<br>
clasp's various enumeration modes is removed after a solve call. This includes<br>
enumeration of cautious or brave consequences, enumeration of answer sets with<br>
or without projection, or finding optimal models; as well as clauses/nogoods<br>
added with Model.add_clause()/Model.add_nogood().<br>
<br>
Note that initially the enumeration assumption is enabled.</tt></dd>
</dl>
<hr>
Data and other attributes defined here:<br>
<dl><dt><strong>__new__</strong> = <built-in method __new__ of type object><dd><tt>T.<a href="#Control-__new__">__new__</a>(S, ...) -> a new object with type S, a subtype of T</tt></dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#88ff99">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="Flag">class <strong>Flag</strong></a>(object)</font></td></tr>
<tr bgcolor="#88ff99"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt>Helper object to parse flags.<br>
<br>
Keyword Arguments:<br>
value -- initial value of the flag<br> </tt></td></tr>
<tr><td> </td>