[ library(ldsb) | Reference Manual | Alphabetic Index ]

# ldsb_indomain_set(?X)

Instantiates an LDSB set variable to an element of its domain.

X
  Set variable or set

## Description

Simple predicate for instantiating a set LDSB variable to an element of its domain. If a set value is considered a binary number, where 1 is inclusion and 0 is exclusion, the value ordering is descending. For example:

    go :-
        intset(S, 1, 3),
        Xs = [](S),
        ldsb_initialise(Xs, []),
        ( ldsb_indomain_set(S), writeln(S), fail
        ; true).

would produce the following output:

    [1, 2, 3]
    [1, 2]
    [1, 3]
    [1]
    [2, 3]
    [2]
    [3]
    []

If X is already a ground set, then this predicate simply succeeds exactly once without leaving a choicepoint.

This predicate can be used with the search/6 predicate (see example).

### Resatisfiable

yes

## Examples

    go :-
            intsets(L, 3, 1, 10),
            ( foreach(S, L) do #(S, 3) ),
            ( fromto(L, [X|Xs], Xs, []) do
              ( foreach(Y, Xs), param(X) do
                  #(X /\ Y, 0) ) ),
            Xs =.. [[]|L],
            ldsb_initialise(Xs, [values_interchange]),
            ( search(Xs, 0, input_order, ldsb_indomain_set, complete, []),
              writeln(Xs),
              fail
            ; true ).

## See Also

ldsb_indomain / 1, ldsb_initialise / 2