potassco / clingo

🤔 A grounder and solver for logic programs.
https://potassco.org/clingo
MIT License
601 stars 79 forks source link

Initial work to make clingo understand aspif #387

Closed rkaminsk closed 2 years ago

rkaminsk commented 2 years ago

Files in ASPIF format can be loaded from files passed on the command line or via the API functions to load/parse files. For this purpose, the API functions have been extended with an optional parameter receiving a Control object. This breaks backward compatibility of the C-API regarding those functions. C++ projects should work by simply recompiling and Python projects are most likely not affected.

This allows systems like clingcon and clingo-dl to read ASPIF input.

Restrictions

  1. Only one ASPIF file containing exactly one step can be loaded and the control object must not have been used for grounding yet.
  2. The ASPIF format does not store a mapping from symbolic to numeric atoms. A best effort is made to generate one from it's output statement.

Example

$ echo "a." | clingo --mode=gringo | clingo 0
clingo version 5.6.0
Reading from stdin
Solving...
Answer: 1
a
SATISFIABLE

Models       : 1
Calls        : 1
Time         : 0.001s (Solving: 0.00s 1st Model: 0.00s Unsat: 0.00s)
CPU Time     : 0.001s