Skip to content

Incremental IDLV

iannigb edited this page Oct 6, 2021 · 24 revisions

I2DLV

I2DLV is intended as the incremental version of the intelligent grounder I-DLV: as its standard version, I2DLV is an Answer Set Programming (ASP) instantiator that natively supports the ASP-Core-2 standard language. The I2DLV instantiation mechanism allows repeated "shots" in which previous instantiations are reused and updated according to the so-called "overgrounding technique".

How to Cite I2DLV

Francesco Calimeri, Giovambattista Ianni, Francesco Pacenza, Simona Perri, Jessica Zangari: Incremental Answer Set Programming with Overgrounding. TPLP 2019: 957-973

Giovambattista Ianni and Francesco Pacenza and Jessica Zangari: Incremental maintenance of overgrounded logic programs with tailored simplifications. TPLP 2020: 719-734

ICLP 2020 Submission - Additional Material

Please, refer to this page for the additional material related to ICLP 2020 paper.

Download

You can download a beta release of I2DLV here.

Usage

It is possible to use the I2DLV system in different ways:

  • Run the system without any command-line options. The system will wait for user input. The default incremental grounding policy is the one described in the TPLP2019 paper.

     ./i2dlv
    
  • Forces output to be printed in textual format (see all the available options below).

     ./i2dlv -t
    
  • Run the system enabling simplification and desimplification steps as described in the ICLP2020 submission. The system will wait for user input.

     ./i2dlv --isd 
    
  • Run the system with an associate XML file containing a set of instructions that has to be executed. The output will be printed in textual format.

     ./i2dlv -t < file.xml
    

XML Command Scripts

I2DLV is intended to be executed as a process which is kept alive in memory. Users can communicate with the process by simply piping XML commands specifying the desired tasks. A permanent in-memory instantiation can be created, updated and piped to a given ASP solver.

Currently, the following XML commands are available:

Load Command

The tag load can be used to form an XML element that requests to load input programs or data; the admitted attribute is:

  • path a file path pointing to the data to be loaded, in ASP-CORE-2 format.

Example of load tag

<load path="./recursion.0.asp"/>

Ground Command

The tag ground can be used to form an XML statement that instructs I2DLV to ground/update the current logic program and, possibly, send the current instantiation to a solver; the admitted attributes are:

  • run_mode, which can be set to the following 3 values:
    • print: the current ground program is updated and the result is printed on stdout (default);
    • updateonly: the current ground program is updated in memory and no output is provided;
    • solve: the current ground program is updated in memory and, then, piped to a solver. By default, the ground program is sent to the wasp solver (it is assumed that wasp is reachable in the default user PATH). The solver output will be printed on stdout.
      • solve_with: the default solver and its command-line options can be overriden when this value is specified.

Example of ground tag

  • I2DLV updates the ground program and prints the result on stdout:

     <ground/>
    
  • I2DLV produces the ground program without printing the result

     <ground run_mode="updateonly"/>
    
  • I2DLV produces the ground and pipes the result to a solver (wasp in this example).
    Note that --mode=wasp and --printonlyoptimum are options of the dlv2 system.

     <ground run_mode="solve" solve_with="./dlv2 --mode=wasp --printonlyoptimum"/>
    

Reset Command

The tag reset can be used to form an XML element that requests to reset all data loaded so far. No attribute is admitted.

Example of reset tag

<reset/>

Exit command

The tag exit can be used to form an XML element that requests to close the process. No attribute is admitted.

Example of exit tag

<exit/>

Command-line Options

Grounding Options

  • --isd, --incremental-simpl-desimpl enable simplification and desimplification steps during grounding.

Output Options

  • -t, --textual prints in textual mode (same behaviour of --output=1), instead of the default numeric.

  • --filter filters the specified predicates with the specified arity. Example: --filter=p1/2,p2/3.

  • --print-rewriting prints in STDERR the rewritten program as preprocessed by IDLV.

Statistics Options

  • --time the system prints the grounding time of each rule.

  • --istats the system displays incremental grounding statistics.

General Options

  • --help the system prints this guide and exit.

  • --stdin the system reads input from standard input (default).

  • --mode set the execution mode:

    • 0 = Console: the user provides commands via standard input.

    • 1 = Server: the user provides commands via a connection over the IP and port numbers at which the system is reachable.

      By default --mode is set to 0.

  • --port set the port number in server mode (by default, it is set to 4790).

Full Working Examples

A zip archive with a full working example can be download here. File included in the zip archive are listed in the following.

  • test folder containing:
    • recursion/recursion.*.asp: ASP files given in input to I2DLV.
    • disjunction/disjunction.*.asp: ASP files given in input to I-DLV Incremental.
    • template.xml: it is an XML file containing all the instructions that have to be executed by I2DLV.
  • solver folder containing:
    • dlv2: binaries of systems that integrate an ASP solver.

Example 1 - Disjunction test case

<load path="test/disjunction/disjunction.0.asp"/>
<load path="test/disjunction/disjunction.1.asp"/>
<ground run_mode="solve" solve_with="./solver/dlv2 --mode=wasp --silent -n0"/>
<load path="test/disjunction/disjunction.2.asp"/>
<ground run_mode="solve" solve_with="./solver/dlv2 --mode=wasp --silent -n0"/>
<load path="test/disjunction/disjunction.3.asp"/>
<ground run_mode="solve" solve_with="./solver/dlv2 --mode=wasp --silent -n0"/>
<load path="test/disjunction/disjunction.4.asp"/>
<ground run_mode="solve" solve_with="./solver/dlv2 --mode=wasp --silent -n0"/>
<reset/>
<exit/>

Example 2 - Recursion test case

<load path="test/recursion/recursion.0.asp"/>
<ground run_mode="updateonly"/>
<load path="test/recursion/recursion.1.asp"/>
<ground run_mode="solve" solve_with="./solver/dlv2 --mode=wasp --silent"/>
<load path="test/recursion/recursion.2.asp"/>
<ground run_mode="solve" solve_with="./solver/clingo5.4 --mode=clasp --verbose=0"/>
<reset/>
<exit/>

How to run the examples

./idlv-incremental/i2dlv < test/disjunction/template.xml
./idlv-incremental/i2dlv < test/recursion/template.xml

Benchmarks

For more details about benchmarks performed with I2DLV check the GitHub wiki page I2DLV

The benchmarks Pacman-10, Pacman-20 and Pacman-30 differ in the extension of the predicate distance, which is limited to a grid of respectively 10x10, 20x20 and 30x30 tiles. Results of the benchmark Pacman-30 are those presented in our paper.

Content Caching

Time performance

I2DLV I2DLV+SOLVER

Input program size

PROGRAM SIZE

Detailed mmedia.csv file can be downloaded here.

Pacman size 10

Time performance

I2DLV I2DLV+SOLVER

Input program size

PROGRAM SIZE

Detailed pacman10.csv file can be downloaded here.

Pacman size 20

Time performance

I2DLV I2DLV+SOLVER

Input program size

PROGRAM SIZE

Detailed pacman20.csv file can be downloaded here.

Pacman size 30

Time performance

I2DLV I2DLV+SOLVER

Input program size

PROGRAM SIZE

Detailed pacman30.csv file can be downloaded here.

N-queens choice points

I2DLV+SOLVER WITH SIMPLIFICATIONS I2DLV+SOLVER WITHOUT SIMPLIFICATIONS

Additional Material

Encondings

The encodings used in the plots are available online - Download encodings

CSV data

All the data used in the plots can be found at the following links.

Core Team

  • Francesco Calimeri
  • Giovambattista Ianni
  • Francesco Pacenza
  • Simona Perri
  • Jessica Zangari