Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

PostProcess Answer Sets

Project Description

This program accepts clingo 4.x and clasp 3.x log files and an ASP script to postprocess the answer sets the log contains. The result is a rewritten log file.

Each answer is assigned a sequence number starting from 1 and it’s atoms are wrapped in the special predicate _as(Term, SequenceNum). The answer sets are replaced with atoms read from a special predicate _pp(Term, SequenceNum).

E.g. adding the atom “a.” to the first answer set in the log could be done with the following ASP script:

% Add "a." to first answer set / model
_pp(a, 1).
% Pass everything else through
_pp(Term, SeqNum) :- _as(Term, SeqNum).

Note that the sequence number does not necessarily correspond to <num> in the “Answer: <num>” line in the input log file; for example when multiple solve calls were used.

Installing

Run:

pip install --user ppas

Usage

ppas <script> <infile> <outfile> [--clingo-bin=<path>, --quiet]
ppas -h | --help
ppas --version

      Options:
      --clingo-bin=<path>       Path to clingo binary.
      --quiet                   Disable stdout messages.
      -h --help                 Show this screen.
      --version                 Show version.

Examples

Examples are available in the examples/ directory. E.g.:

ppas.py examples/tsp/script.asp examples/tsp/log.txt tsp-processed.txt

License

MIT. See LICENSE.txt

Release History

Release History

This version
History Node

0.1.0

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
ppas-0.1.0.tar.gz (3.3 kB) Copy SHA256 Checksum SHA256 Source Sep 4, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting