potassco / acclingo

Automatic algorithm configuration for clingo
BSD 3-Clause "New" or "Revised" License
1 stars 1 forks source link

acclingo

Automatic algorithm configuration for clingo

Licence

This program is free software: you can redistribute it and/or modify it under the terms of the 3-clause BSD license (please see the LICENSE file).

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

You should have received a copy of the 3-clause BSD license along with this program (see LICENSE file). If not, see https://opensource.org/licenses/BSD-3-Clause.

Overview

acclingo relies on SMAC3 to automatically optimize parameter configurations of clingo and clingo-based systems given a set of instances and a performance measure.

Installation

acclingo only requires SMAC3 to be installed, sources and documentation can be found here: https://github.com/automl/SMAC3.

Usage

No further installation is necessary and the main script can be executed via following commandline:

python scripts/acclingo --instance_dir <directory> <optional options>

The directory with the instances is the only required parameter, all other options are optional, see --help for more information. Per default, acclingo retrieves a parameter configuration optimizing runtime for solving grounded instances from the parameter space described here using instances that may be gzipped from <directory> . We provide static binaries for Linux 64 of runsolver 3.3.4 here.

Simple Example

This simple example assumes that you have clingo installed. In this example we optimize the solving time for the instances inside the test-domain directory. We give it a 10 second cutoff per instance and configuration pair and a total wall time of 180 seconds. Run the following command while in the main acclingo folder:

python scripts/acclingo --instance_dir test-domain/instances --cutoff 10 --ac_budget 180 --tae_args "{\"encoding\": \"test-domain/blocks-encoding.lp\"}"

When acclingo finishes running it will print out the best configuration it found. Keep in mind that this configuration might still be the base configuration given by the pcs file.

Advanced Example

We provide the following example enabling algorithm configuration for instances with optimization statements. Instead of runtime, we optimize a cost function taking into account runtime and quality of solution relative to a best known bound.

python scripts/acclingo --instance_dir <directory> --fn_suffix ".gz" --binary <solver>
--run_obj quality --cutoff <timeout> --ac_budget <timeout>
--tae_class acclingo/tae/clasp_opt_tae.py --tae_args "{\"best_known\": \"<csv file>\"}"  

Additional Options

The --tae_args can also be used to change the mode of clingo. By default it is set to "clasp". If the instances require an additional file(encoding) to run, you can also provide it with the --tae_args option using "encoding":

--tae_args "{\"mode\": \"clingo\", \"encoding\": \"path/to/encoding.lp\"}"