I'm trying to add a constraint global_cardinality
to my program and in the manual of SICStus Prolog is written:
global_cardinality(+Xs,+Vals)
global_cardinality(+Xs,+Vals,+Options)
where Xs = [X1,...,Xd] is a list of integers or domain variables, and Vals = [K1-V1,...,Kn-Vn] is a list of pairs where each key Ki is a unique integer and Vi is a domain variable or an integer. True if every element of Xs is equal to some key and for each pair Ki-Vi, exactly Vi elements of Xs are equal to Ki.
Now I can write:
global_cardinality([A,B,C], [1-2, 2-1]).
to say that the number 1
will be used twice. The number 2
will be used just once.
But I would like to say that the number 1
will be used: once, twice or three times
According to the manual I need a domain variable but what is the proper syntax for that?