Skip to content

Commit 79753c1

Browse files
committed
Small updates to the doc. Add a simple example
1 parent 958863e commit 79753c1

10 files changed

+429
-4
lines changed

README.md

+12-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,18 @@ No further installation is necessary and the main script can be executed via fol
2525
python scripts/acclingo --instance_dir <directory> <optional options>
2626
```
2727
The directory with the instances is the only required parameter, all other options are optional, see `--help` for more information.
28-
Per default, `acclingo` retrieves a parameter configuration optimizing runtime for solving grounded instances from the parameter space described [here](pcs/params.pcs) using instances that may be gzipped from `<directory>` .
29-
We provide static binaries for Linux 64 of `clingo 5.1.0` and `runsolver 3.3.4` [here](binaries/).
30-
28+
Per default, `acclingo` retrieves a parameter configuration optimizing runtime for solving grounded instances from the parameter space described [here](pcs/all_params.pcs) using instances that may be gzipped from `<directory>` .
29+
We provide static binaries for Linux 64 of `runsolver 3.3.4` [here](binaries/).
30+
31+
# Simple Example
32+
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:
33+
34+
```
35+
python scripts/acclingo --instance_dir test-domain/instances --cutoff 10 --ac_budget 180 --tae_args "{\"encoding\": \"test-domain/blocks-encoding.lp\"}"
36+
```
37+
38+
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.
39+
3140
# Advanced Example
3241

3342
We provide the following example enabling algorithm configuration for instances with optimization statements.

acclingo/tae/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Asprin TAE
22

3-
This TAE is very similar to the basic clasp TAE. The only differences are that it only counts a solution as a succesful solution if the optimum was found and that it needs an asprin "binary" or a way to call asprin. The penalty for no solution or no optimal solution is the maximum available time multiplied by some penalty value . This penalty value can be given as a parameter:
3+
This TAE is very similar to the basic clasp TAE. The only differences are that it only counts a solution as a succesful solution if the optimum was found and that it needs an asprin "binary" or a way to call asprin. The penalty for no solution or no optimal solution is the maximum available time multiplied by some penalty value. This penalty value can be given as a parameter:
44

55
⋅⋅* Parameter to penalize no optimal solution = "penalty": float
66

pcs/README.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
## PCS files
2+
The pcs (parameter configuration space) files in this folder denote what parameters acclingo will try to optimize. They also denote what values each option can take.
3+
4+
#### Parameter files for clasp
5+
In the all_params.pcs file all solver parameters along with their possible values are given. If a parameter has a interval of possible values then this is represented in the pcs file aswell. The interval can be integer based, e.g. the integer interval [1,64] means that any number between 1 and 64 is a valid value for the parameter. The interval can also be composed of reals, e.g. the interval [1.0,2.0]. This means that this file has an infite number of combinations in the configuration space.
6+
7+
The all_params_disc.pcs file has the same parameters as the all_params.pcs file. However, any parameter where there was an interval has its possible values reduced to only a couple of options. For example, instead of the interval [1,64] we now have the possible options {1,2,10,30,50,64}
8+
9+
The limited_params.pcs file cuts down parameters of the all_params_disc.pcs file and only keeps the ones that pertain to *optimization*.

test-domain/blocks-encoding.lp

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
2+
time(0..horizon).
3+
4+
action(move(B,L)) :- block(B), loc(L), B != L.
5+
6+
7+
on(B,B2,0) :- init(on(B,B2)).
8+
9+
10+
{do(A,T) : action(A)} 1 :- time(T), T>0.
11+
1 {on(B,L,T) : loc(L)} 1 :- block(B), time(T), T>0.
12+
13+
clear(B,T) :- not on(B2,B,T) : block(B2), B2 != B; block(B), time(T).
14+
clear(table,T) :- time(T).
15+
16+
%precondition
17+
:- do(move(B,L),T), not clear(L,T-1).
18+
:- do(move(B,L),T), not clear(B,T-1).
19+
20+
%postcodition
21+
:- do(move(B,L),T), not on(B,L,T).
22+
%on(B,L,T) :- do(move(B,L),T).
23+
24+
%inertia
25+
:- on(B,L,T), not on(B,L,T-1), not do(move(B,L),T), block(B), time(T), T>0.
26+
27+
% cant have 2 blocks on 1 block
28+
:- on(B1,B,T), on(B2,B,T), B1 < B2, block(B).
29+
30+
% cant have 1 block on 2 blocks
31+
:- on(B,B1,T), on(B,B2,T), B1 < B2.
32+
33+
% block can't be on top of each other
34+
:- on(B1,B2,T), on(B2,B1,T).
35+
36+
% block can't be on itself
37+
:- on(B,B,T), time(T).
38+
39+
:- not on(B,L,horizon), goal(on(B,L)).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#const horizon=32.
2+
3+
block(1..20).
4+
loc(table).
5+
loc(B) :- block(B).
6+
7+
init(on(7,table)).
8+
init(on(8,table)).
9+
init(on(19,8)).
10+
init(on(16,19)).
11+
init(on(3,table)).
12+
init(on(2,table)).
13+
init(on(18,table)).
14+
init(on(11,table)).
15+
init(on(6,11)).
16+
init(on(15,table)).
17+
init(on(20,15)).
18+
init(on(5,table)).
19+
init(on(17,table)).
20+
init(on(1,17)).
21+
init(on(12,1)).
22+
init(on(4,table)).
23+
init(on(9,table)).
24+
init(on(13,table)).
25+
init(on(14,table)).
26+
init(on(10,14)).
27+
28+
goal(on(20,table)).
29+
goal(on(1,20)).
30+
goal(on(11,1)).
31+
goal(on(2,11)).
32+
33+
goal(on(12,table)).
34+
35+
goal(on(10,table)).
36+
goal(on(8,10)).
37+
38+
goal(on(7,table)).
39+
40+
goal(on(18,table)).
41+
goal(on(15,18)).
42+
43+
goal(on(14,table)).
44+
45+
goal(on(13,table)).
46+
goal(on(17,13)).
47+
goal(on(9,17)).
48+
goal(on(4,9)).
49+
50+
goal(on(16,table)).
51+
goal(on(3,16)).
52+
53+
goal(on(5,table)).
54+
goal(on(6,5)).
55+
56+
goal(on(19,table)).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#const horizon=32.
2+
3+
block(1..20).
4+
loc(table).
5+
loc(B) :- block(B).
6+
7+
init(on(2,table)).
8+
init(on(8,table)).
9+
init(on(13,8)).
10+
init(on(20,table)).
11+
init(on(18,20)).
12+
init(on(6,table)).
13+
init(on(10,table)).
14+
init(on(14,10)).
15+
init(on(12,table)).
16+
init(on(4,table)).
17+
init(on(17,4)).
18+
init(on(15,table)).
19+
init(on(5,table)).
20+
init(on(7,table)).
21+
init(on(1,7)).
22+
init(on(11,table)).
23+
init(on(16,11)).
24+
init(on(19,16)).
25+
init(on(9,19)).
26+
init(on(3,table)).
27+
28+
goal(on(3,table)).
29+
goal(on(5,3)).
30+
goal(on(13,5)).
31+
goal(on(2,13)).
32+
goal(on(7,2)).
33+
goal(on(14,7)).
34+
goal(on(9,14)).
35+
goal(on(19,9)).
36+
goal(on(17,19)).
37+
goal(on(20,17)).
38+
goal(on(11,20)).
39+
goal(on(16,11)).
40+
goal(on(4,16)).
41+
goal(on(10,4)).
42+
goal(on(15,10)).
43+
goal(on(8,15)).
44+
goal(on(6,8)).
45+
goal(on(18,6)).
46+
goal(on(1,18)).
47+
goal(on(12,1)).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#const horizon=32.
2+
3+
block(1..20).
4+
loc(table).
5+
loc(B) :- block(B).
6+
7+
init(on(4,table)).
8+
init(on(5,4)).
9+
init(on(1,5)).
10+
init(on(9,table)).
11+
init(on(16,table)).
12+
init(on(12,table)).
13+
init(on(7,table)).
14+
init(on(17,7)).
15+
init(on(15,table)).
16+
init(on(18,15)).
17+
init(on(3,table)).
18+
init(on(10,table)).
19+
init(on(19,table)).
20+
init(on(13,19)).
21+
init(on(6,table)).
22+
init(on(8,6)).
23+
init(on(2,table)).
24+
init(on(11,table)).
25+
init(on(14,table)).
26+
init(on(20,14)).
27+
28+
goal(on(18,table)).
29+
goal(on(13,18)).
30+
goal(on(6,13)).
31+
goal(on(9,6)).
32+
33+
goal(on(1,table)).
34+
goal(on(5,1)).
35+
goal(on(8,5)).
36+
goal(on(10,8)).
37+
goal(on(12,10)).
38+
39+
goal(on(19,table)).
40+
goal(on(14,19)).
41+
goal(on(11,14)).
42+
goal(on(17,11)).
43+
44+
goal(on(7,table)).
45+
goal(on(3,7)).
46+
goal(on(2,3)).
47+
48+
goal(on(15,table)).
49+
goal(on(20,15)).
50+
goal(on(16,20)).
51+
goal(on(4,16)).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#const horizon=48.
2+
3+
block(1..30).
4+
loc(table).
5+
loc(B) :- block(B).
6+
7+
init(on(23,table)).
8+
init(on(5,23)).
9+
init(on(12,table)).
10+
init(on(15,12)).
11+
init(on(17,table)).
12+
init(on(6,17)).
13+
init(on(21,6)).
14+
init(on(20,21)).
15+
init(on(10,table)).
16+
init(on(11,10)).
17+
init(on(9,11)).
18+
init(on(4,table)).
19+
init(on(29,table)).
20+
init(on(7,29)).
21+
init(on(22,table)).
22+
init(on(27,table)).
23+
init(on(28,27)).
24+
init(on(8,28)).
25+
init(on(16,8)).
26+
init(on(13,table)).
27+
init(on(25,table)).
28+
init(on(30,table)).
29+
init(on(3,30)).
30+
init(on(14,3)).
31+
init(on(1,table)).
32+
init(on(19,table)).
33+
init(on(24,19)).
34+
init(on(26,24)).
35+
init(on(2,table)).
36+
init(on(18,table)).
37+
38+
goal(on(16,table)).
39+
40+
goal(on(10,table)).
41+
goal(on(28,10)).
42+
goal(on(5,28)).
43+
goal(on(20,5)).
44+
45+
goal(on(7,table)).
46+
goal(on(1,7)).
47+
goal(on(14,1)).
48+
goal(on(13,14)).
49+
goal(on(4,13)).
50+
51+
goal(on(9,table)).
52+
goal(on(29,9)).
53+
54+
goal(on(23,table)).
55+
goal(on(15,23)).
56+
goal(on(18,15)).
57+
58+
goal(on(26,table)).
59+
goal(on(8,26)).
60+
61+
goal(on(30,table)).
62+
goal(on(21,30)).
63+
goal(on(12,21)).
64+
65+
goal(on(27,table)).
66+
67+
goal(on(22,table)).
68+
goal(on(24,22)).
69+
goal(on(3,24)).
70+
goal(on(25,3)).
71+
goal(on(19,25)).
72+
73+
goal(on(6,table)).
74+
goal(on(11,6)).
75+
goal(on(2,11)).
76+
goal(on(17,2)).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#const horizon=48.
2+
3+
block(1..30).
4+
loc(table).
5+
loc(B) :- block(B).
6+
7+
init(on(22,table)).
8+
init(on(11,table)).
9+
init(on(12,table)).
10+
init(on(28,12)).
11+
init(on(20,table)).
12+
init(on(15,table)).
13+
init(on(25,15)).
14+
init(on(9,25)).
15+
init(on(6,9)).
16+
init(on(13,table)).
17+
init(on(4,table)).
18+
init(on(16,table)).
19+
init(on(5,table)).
20+
init(on(21,table)).
21+
init(on(19,21)).
22+
init(on(2,table)).
23+
init(on(27,2)).
24+
init(on(7,table)).
25+
init(on(1,7)).
26+
init(on(3,1)).
27+
init(on(29,table)).
28+
init(on(30,table)).
29+
init(on(23,30)).
30+
init(on(10,23)).
31+
init(on(17,10)).
32+
init(on(8,table)).
33+
init(on(14,table)).
34+
init(on(26,table)).
35+
init(on(24,table)).
36+
init(on(18,table)).
37+
38+
goal(on(29,table)).
39+
goal(on(1,29)).
40+
goal(on(16,1)).
41+
goal(on(6,16)).
42+
goal(on(25,6)).
43+
goal(on(22,25)).
44+
goal(on(5,22)).
45+
goal(on(10,5)).
46+
goal(on(27,10)).
47+
goal(on(26,27)).
48+
goal(on(3,26)).
49+
goal(on(2,3)).
50+
goal(on(20,2)).
51+
goal(on(18,20)).
52+
goal(on(11,18)).
53+
goal(on(30,11)).
54+
goal(on(8,30)).
55+
goal(on(7,8)).
56+
goal(on(17,7)).
57+
goal(on(19,17)).
58+
goal(on(4,19)).
59+
goal(on(24,4)).
60+
goal(on(15,24)).
61+
goal(on(23,15)).
62+
goal(on(21,23)).
63+
goal(on(28,21)).
64+
goal(on(9,28)).
65+
goal(on(13,9)).
66+
goal(on(12,13)).
67+
goal(on(14,12)).

0 commit comments

Comments
 (0)