Liking cljdoc? Tell your friends :D

vaelii.impl.asp.clasp

Subprocess wrapper around the clasp ASP solver.

Consumes ASPIF text on stdin, returns parsed results as Clojure maps. clasp exit codes encode the solve outcome (10=sat, 20=unsat, 30=optimum, bitmask combinations) and are NOT error codes — we rely on the JSON Result field from --outf=2 and only throw when clasp itself fails to run or produces no parseable output.

The four modes match the user-facing reason API in vaelii.impl.asp.reason: :label, :all-optima, :classify-true, :classify-supportable.

Every run carries --time-limit from config/asp-time-limit (0 lifts it): a solve that hits it comes back Result: UNKNOWN with TIME LIMIT: 1, read here as :interrupted.

Subprocess wrapper around the clasp ASP solver.

Consumes ASPIF text on stdin, returns parsed results as Clojure maps.
clasp exit codes encode the solve outcome (10=sat, 20=unsat, 30=optimum,
bitmask combinations) and are NOT error codes — we rely on the JSON
`Result` field from `--outf=2` and only throw when clasp itself fails
to run or produces no parseable output.

The four modes match the user-facing reason API in vaelii.impl.asp.reason:
:label, :all-optima, :classify-true, :classify-supportable.

Every run carries `--time-limit` from `config/asp-time-limit` (0 lifts it): a
solve that hits it comes back `Result: UNKNOWN` with `TIME LIMIT: 1`, read here
as `:interrupted`.
raw docstring

*clasp-binary*clj

Name (or absolute path) of the clasp executable. Bind to point solve at a non-default install or a test stub.

Name (or absolute path) of the clasp executable. Bind to point
`solve` at a non-default install or a test stub.
sourceraw docstring

available?clj

(available?)

True if the clasp binary can be executed in the current environment. Used by tests to skip cleanly when clasp isn't installed.

True if the clasp binary can be executed in the current environment.
Used by tests to skip cleanly when clasp isn't installed.
sourceraw docstring

solveclj

(solve aspif-text mode)

Run clasp on aspif-text in one of the supported modes.

Modes: :label — one minimum-cost witness (for labeling output) :all-optima — every minimum-cost witness (for inspection) :classify-true — atoms in every minimum-cost witness :classify-supportable — atoms in at least one minimum-cost witness

Returns: :status — :optimum | :sat | :unsat | :interrupted | :unknown :atoms — vector of atom-name strings :cost — optimum cost (nil if no minimize statement or unsat) :witnesses — vector of value vectors (only populated for :all-optima) :raw — full parsed JSON (for diagnostics)

:interrupted is the time limit (config/asp-time-limit) or a signal: whatever atoms ride beside it are a model found on the way, not the answer.

Run clasp on `aspif-text` in one of the supported modes.

Modes:
  :label                — one minimum-cost witness (for labeling output)
  :all-optima           — every minimum-cost witness (for inspection)
  :classify-true        — atoms in every minimum-cost witness
  :classify-supportable — atoms in at least one minimum-cost witness

Returns:
  :status    — :optimum | :sat | :unsat | :interrupted | :unknown
  :atoms     — vector of atom-name strings
  :cost      — optimum cost (nil if no minimize statement or unsat)
  :witnesses — vector of value vectors (only populated for :all-optima)
  :raw       — full parsed JSON (for diagnostics)

`:interrupted` is the time limit (`config/asp-time-limit`) or a signal: whatever
atoms ride beside it are a model found on the way, not the answer.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close