File: onmodel-py.lp

package info (click to toggle)
gringo 4.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 8,260 kB
  • ctags: 10,755
  • sloc: cpp: 55,049; python: 629; yacc: 569; sh: 124; makefile: 23
file content (31 lines) | stat: -rw-r--r-- 997 bytes parent folder | download
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
#script (python)

import gringo

def main(prg):
    def on_model(m):
        print "shown"
        print "  positive:", ", ".join(map(str, m.atoms(gringo.Model.SHOWN)))
        print "  negative:", ", ".join(map(str, m.atoms(gringo.Model.SHOWN | gringo.Model.COMP)))
        print "csp"
        print "  positive:", ", ".join(map(str, m.atoms(gringo.Model.CSP)))
        print "  negative:", ", ".join(map(str, m.atoms(gringo.Model.CSP | gringo.Model.COMP)))
        print "atoms"
        print "  positive:", ", ".join(map(str, m.atoms(gringo.Model.ATOMS)))
        print "  negative:", ", ".join(map(str, m.atoms(gringo.Model.ATOMS | gringo.Model.COMP)))
        print "terms"
        print "  positive:", ", ".join(map(str, m.atoms(gringo.Model.TERMS)))
        print "  negative:", ", ".join(map(str, m.atoms(gringo.Model.TERMS | gringo.Model.COMP)))

    prg.ground([("base", [])])
    prg.solve(on_model = on_model)

#end.

{a}.
b :- a.
$x $= 1.
$y $= 2.
#show c : a.
#show b/0.
#show $x/0.