Finite domain solver runtime

Author(s): Emilio Jesús Gallego Arias, Rémy Haemmerlé.

This module provides Finite Domain (FD) constraints and enumerating predicates for FD variables. See clpfd_doc for more details about the Ciao FD solver.

This module provides two kinds of contraints: basic constraints (such as domain/3, all_different/1, ...) that deal with FD variables or lists of FD variables, and meta-contraints (such as #=/2, #=</2, ...) that deal with arithmetic expressions over FD variables, called in the following FD expressions. Meta-constraints of this module behave as describes in package clpfd, except that their arguments are interpreted at run time.


Documentation on exports

PREDICATE

Usage:in(Var,Range)

Constrains Var to take its value in the domain described by Range.

  • The following properties should hold at call time:
    (clpfd_rt:fdvar/1)Var is a variable or an integer.
    (clpfd_rt:fd_range_expr/1)Range is a range expression.

REGTYPE

Usage:fdvar(X)

X is a variable or an integer.

    REGTYPE
    A term denoting a range expression:
    fd_range_expr(I) :-
            integer(I).
    fd_range_expr(..(Min,Max)) :-
            integer(Min),
            integer(Max).
    fd_range_expr(A\/B) :-
            fd_range_expr(A),
            fd_range_expr(B).
    
    an integer stands for a singleton range, Min..Max for the closed interval from Min to Max, and A\/B for the union of ranges A and B. Range expressions are used by the in/2 predciate.

    Usage:fd_range_expr(Expr)

    Expr is a range expression.

      REGTYPE
      A term denoting an arithmetic expression over FD variables:
      fd_expr(Var) :-
              var(Var).
      fd_expr(I*Exp) :-
              int(I),
              fd_expr(Exp).
      fd_expr(Exp*I) :-
              int(I),
              fd_expr(Exp).
      fd_expr(Exp1+Exp2) :-
              fd_expr(Exp1),
              fd_expr(Exp2).
      fd_expr(Exp1-Exp2) :-
              fd_expr(Exp1),
              fd_expr(Exp2).
      fd_expr(-Exp) :-
              fd_expr(Exp).
      
      FD expressions are used by meta-constraints.

      Usage:fd_expr(Expr)

      Expr is an FD expression.

        PREDICATE
        Meta-constraint "equal".

        Usage:#=(A,B)

        Constrains the interpretation of A to be equal to the interpretation of B.

        • The following properties should hold at call time:
          (clpfd_rt:fd_expr/1)A is an FD expression.
          (clpfd_rt:fd_expr/1)B is an FD expression.

        PREDICATE
        Meta-constraint "not equal".

        Usage:#\=(A,B)

        Constrains the interpretation of A to be different from the interpretation of B

        • The following properties should hold at call time:
          (clpfd_rt:fd_expr/1)A is an FD expression.
          (clpfd_rt:fd_expr/1)B is an FD expression.

        PREDICATE
        Meta-constraint "smaller than".

        Usage:#<(A,B)

        Constrains the interpretation of A to be smaller than the interpretation of B.

        • The following properties should hold at call time:
          (clpfd_rt:fd_expr/1)A is an FD expression.
          (clpfd_rt:fd_expr/1)B is an FD expression.

        PREDICATE
        Meta-constraint "smaller or equal".

        Usage:#=<(A,B)

        Constrains A to be smaller or equal to B.

        • The following properties should hold at call time:
          (clpfd_rt:fd_expr/1)A is an FD expression.
          (clpfd_rt:fd_expr/1)B is an FD expression.

        PREDICATE
        Meta-constraint "greater than".

        Usage:#>(A,B)

        Constrains the interpretation of A to be greater than the interpretation of B.

        • The following properties should hold at call time:
          (clpfd_rt:fd_expr/1)A is an FD expression.
          (clpfd_rt:fd_expr/1)B is an FD expression.

        PREDICATE
        Meta-constraint "greater or equal".

        Usage:#>=(A,B)

        Constrains the interpretation of A to be greater or equal than the interpretation of B.

        • The following properties should hold at call time:
          (clpfd_rt:fd_expr/1)A is an FD expression.
          (clpfd_rt:fd_expr/1)B is an FD expression.

        PREDICATE

        Usage:domain(Vars,Min,Max)

        Constrains each element of Vars to take its value between Min and Max (included). This predicate is generally used to set the initial domain of an interval

        • The following properties should hold at call time:
          (basic_props:list/2)Vars is a list of fdvars.
          (basic_props:int/1)Min is an integer.
          (basic_props:int/1)Max is an integer.

        PREDICATE

        Usage:in(Var,Range)

        Constrains Var to take its value in the domain described by Range.

        • The following properties should hold at call time:
          (clpfd_rt:fdvar/1)Var is a variable or an integer.
          (clpfd_rt:fd_range_expr/1)Range is a range expression.

        PREDICATE

        Usage:all_different(Vars)

        Constrains all elements in Vars to take distinct values. This is equivalent to posting an inequality constraint for each pair of variables. This constraint is triggered when a variable becomes ground, removing its value from the domain of the other variables.

        • The following properties should hold at call time:
          (basic_props:list/2)Vars is a list of fdvars.

        PREDICATE

        Usage:labeling(Options,Vars)

        Assigns a value to each variable in Vars according to the labeling options given by Options. This predicate is re-executable on backtracking.

        The different options are :

        • []: the leftmost variables is selected first. Its values are enumerating from the smallest to the greatest.

        • [ff]: the variable with the smallest number of elements in its domain is selected first. Its values are then enumerated from the smallest to the greatest.

        • [step]: the variable with the smallest number of elements in its domain is selected first. The minimal value of the domainis assigned, on bactracking the value is pruned form the domain and a new variable is selected.

        • The following properties should hold at call time:
          (basic_props:list/2)Vars is a list of fdvars.

        PREDICATE
        No further documentation available for this predicate.

        PREDICATE
        No further documentation available for this predicate.

        PREDICATE

        Usage:labeling(Options,Vars)

        Assigns a value to each variable in Vars according to the labeling options given by Options. This predicate is re-executable on backtracking.

        The different options are :

        • []: the leftmost variables is selected first. Its values are enumerating from the smallest to the greatest.

        • [ff]: the variable with the smallest number of elements in its domain is selected first. Its values are then enumerated from the smallest to the greatest.

        • [step]: the variable with the smallest number of elements in its domain is selected first. The minimal value of the domainis assigned, on bactracking the value is pruned form the domain and a new variable is selected.

        • The following properties should hold at call time:
          (basic_props:list/2)Vars is a list of fdvars.

        PREDICATE
        No further documentation available for this predicate. Meta-predicate with arguments: minimize(goal,?).

        PREDICATE
        No further documentation available for this predicate. Meta-predicate with arguments: minimize(goal,?).

        PREDICATE
        No further documentation available for this predicate.

        Documentation on multifiles

        PREDICATE
        No further documentation available for this predicate. The predicate is multifile.

        PREDICATE
        No further documentation available for this predicate. The predicate is multifile.