glaserL / viasp

A visualization tool for clingo
MIT License
3 stars 3 forks source link

Change minimal example #78

Closed glaserL closed 2 years ago

glaserL commented 2 years ago

Maybe as entry point

Should look sth like this:

import sys
import clingo

options = ["0"]

ctl = clingo.Control(options)

for path in sys.argv[1:]:
  ctl.load(path)
if not sys.argv[1:]:
  ctl.load("-")
ctl.ground([("base", [])])

with ctl.solve(yield_=True) as handle:
  for m in handle: print("Answer:\n{}".format(m))
  print(handle.get())
$ echo "{a(1..2)}." | python minimal_clingo_input_files.py
Answer:

Answer:
a(2)
Answer:
a(1)
Answer:
a(1) a(2)
SAT