prolog - Is it possible to set variable's domain as an enumeration of names in clpfd? -
i can specify variable's domain in way:
myvar in 1..10 or
myvar in {1,10,15} but have variable specify this:
activity_1__room in {room_1, room_2} % i.e. atoms not integers is possible it? of course, possible encode names integers necessary?
you can't use atoms. domains in clpfd range on integers.
but suppose want "myvar should take 1 of values of list l", i.e. set not known priori. can coded as:
?- list_to_fdset(l, set), myvar in_set set.
Comments
Post a Comment