File: addclause-lua.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 (20 lines) | stat: -rw-r--r-- 383 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#script (lua)

Fun = gringo.Fun

function main(prg)
    on_model = function (m)
        m.context:add_clause({{Fun("a"), false}, {Fun("b"), false}})
        m.context:add_nogood({{Fun("c"), true}, {Fun("d"), true}})
    end

    prg.conf.solve.models = 0
    prg:ground({{"base", {}}})
    prg:solve(nil, on_model)
    print "and again"
    prg:solve()
end

#end.

2 { a; b; c; d }.