I have the graph coloring problem defined in Clingo as so:
node(sa;wa;nt;q;nsw;v;t).
color(r;g;b).
edge(sa,(wa;nt;q;nsw;v)).
edge(wa,nt). edge(nt,q). edge(q,nsw). edge(nsw,v).
edge(X,Y) :- edge(Y,X).
and I have the solution characterized like this:
{assign(N,C) : color(C)} = 1 :- node(N).
:- edge(X,Y), assign(X,C1), assign(Y,C2), C1 == C2.
#show assign/2.
I cannot understand what the = 1
in the generate portion of the code means. I know that it is "set cardinality", but I do not understand how, as the code must generate seven nodes in each answer. Additionally, the following generator (which generates all combos of nodes and colors choosing in a set of length 7) requires an = 7
:
{assign(N,C) : color(C), node(N)} = 7.
Here is a picture of the graph coloring problem I am solving: https://i.stack.imgur.com/5Sucr.jpg
and clingo: https://potassco.org/clingo/run/