See how your ASP program grows
ASP Studio runs clingo on your .lp files and shows the answer sets. For recursive programs it also steps through the derivation one round at a time, and highlights the rules that fired right in your editor.
Free, MIT licensed, works on macOS, Windows and Linux. You do not need to install anything to try it: the playground runs in your browser.
The animator on a recursive program. It starts at the facts: press play, or step with the arrow keys. Each round shows the new atoms and the rule that derived them.
What it does
The parts of clingo you usually have to read from the terminal
The extension covers the loop of writing a rule, running it and working out why the output looks the way it does.
Answer sets
Each answer set is grouped by predicate. With #minimize or #maximize only the optimal models are kept, and the cost is on the card.
Animator
Follow the fixpoint of a positive program. Every round lists the atoms that are new, the rule behind each one and the variable bindings it used.
Highlighting in the editor
While you step, the rules that fired are marked in your file with a note such as round 2: +3 atoms. Click a rule in the panel to jump to its line.
Graph view
Atoms with two arguments, like edge(a,b), become arrows. Pick an answer set, hide a predicate, and drag nodes where you want them.
Errors in the right place
clingo's messages become squiggles and entries in the Problems panel. If the program spans several files, each message points at the file it came from.
Works on a fresh machine
If clingo is installed, ASP Studio uses it. If not, a bundled WebAssembly build of clingo 5.8 runs instead. One command can install the native one for you.
Notebooks and Python
The same panel in Jupyter
Load the extension once, then start any cell with %%asp. The output is the visualizer you saw above, with the same tabs, including the Grounding tab.
From plain Python, asp_studio.solve() gives you the answer sets and the error positions. It does not raise on a broken program. From a terminal, asp-studio program.lp writes a standalone HTML report.
%load_ext asp_studio %%asp --tab animator parent(anna,bob). parent(bob,carl). ancestor(X,Y) :- parent(X,Y). ancestor(X,Z) :- parent(X,Y), ancestor(Y,Z).
Install
Pick the one you need
The extension and the Python package share the same visualizer. You can use either on its own.
VS Code extension
- Download
asp-studio-0.2.7.vsixfrom the latest release. - Run
code --install-extension asp-studio-0.2.7.vsix, or use Extensions, then the…menu, then Install from VSIX. - Open a
.lpfile and click the graph icon in the editor title bar.
VS Code 1.85 or newer.
Python package
pip install "asp-studio[notebook]"
Python 3.9 or newer. The notebook extra adds IPython for the %%asp magic. Without it you still get solve() and the command line.
Good to know
Where it stops
- The animator only follows positive programs. Rules with
not, choice rules, constraints and ranges like1..nare rejected, and the message names the line. Answer sets, the graph and error reporting still work for those programs. - The built-in WebAssembly clingo is single threaded and slower than a native one. Use ASP: Set Up Environment if you solve bigger instances.
- Jupyter shows iframe output only in trusted notebooks.
- This project is not affiliated with the Potassco team. clingo and clingo-wasm keep their own licenses, listed in the repository.