Commit 83ce2cc9 authored by Paul Ogris's avatar Paul Ogris
Browse files

Add test data

Using Graph Coloring and Combined Configuration from ASP Competition
2015, slightly altered.
parent dda4b114
vertex(V):-type(V,_).
vertex(V):-size(V,_).
vertex(V):-edge(V,_).
vertex(V):-edge(_,V).
color(MaxC) :- nrofcolors(MaxC).
color(C-1) :- color(C), 1 < C.
1 { vertex_color(V,C):color(C) } 1 :- vertex(V).
usedcolor(C):- vertex_color(V,C).
binnum(K) :- nrofbins(K).
binnum(B-1) :- binnum(B), 1 < B.
binpacking_color(C):-color(C).
1 { vertex_bin(V,B) : binnum(B) } 1 :- vertex(V).
bin(C,B,V):-vertex_color(V,C),vertex_bin(V,B).
:-color(C),nrofbins(K),maxbinsize(MaxS), binnum(B), MaxS < #sum{S,V:bin(C,B,V),size(V,S)}.
usedbin(B) :- bin(C,B,V).
:-path1(V1), path2(V2), vertex_color(V1,C), vertex_color(V2,C).
area(A) :- edge_matching(A,B).
borderelement(B) :- edge_matching(A,B).
1 { edge_matching_selected(A,B) : edge_matching(A,B) } 1 :- borderelement(B).
:- area(A),maxborder(MaxB), #count { A,B : edge_matching_selected(A,B) } > MaxB.
edge_matching_color(A,C) :- edge_matching_selected(A,B), vertex_color(B,C).
:- area(A), #count{ A,C : edge_matching_color(A,C) } > 1.
e(X,Y):-edge(X,Y).
e(X,Y):-edge(Y,X).
between(V1,V2) :- vertex(V1), vertex(V2), vertex(V), V1 < V, V < V2.
pred(V1,V2) :- vertex(V1), vertex(V2), V1 < V2, not between(V1,V2).
next(V2) :- pred(V1,V2).
first(C,V1) :- color(C), vertex(V1), not next(V1).
first(C,V2) :- color(C), pred(V1,V2), not vertex_color(V1,C), first(C,V1).
reachable_color(C,V1) :- color(C), vertex(V1), first(C,V1).
reachable_color(C,V2) :- reachable_color(C,V1), e(V1,V2), vertex_color(V1,C).
:- vertex_color(V,C), not reachable_color(C,V).
colours(C1,C2) :- colour(C1), colour(C2), C1 < C2.
notnext(C1,C3) :- colours(C1,C2), colours(C2,C3).
next(C1,C2) :- colours(C1,C2), not notnext(C1,C2).
later(C2) :- next(C1,C2).
index(C1,1) :- colour(C1), not later(C1).
index(C2,I+1) :- next(C1,C2), index(C1,I).
chosenColour(N,C) :- node(N), index(C,I), I <= N, not notChosenColour(N,C).
notChosenColour(N,C) :- chosenColour(N,CC), index(C,I), I <= N, C != CC.
notChosenColour(N,C) :- chosenColour(NN,C), link(NN,N), NN < N.
colored(N) :- chosenColour(N,C).
:- node(N), not colored(N).
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment