Giter VIP home page Giter VIP logo

ppas's Introduction

ppas - PostProcess Answer Sets

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

ppas's People

Contributors

vukk avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.