Previous Up Next

9.9  Labeling constraints

9.9.1  fd_labeling/2, fd_labeling/1, fd_labelingff/1

Templates

fd_labeling(+fd_variable_list, +fd_labeling_option_list)
fd_labeling(+fd_variable, +fd_labeling_option_list)
fd_labeling(+fd_variable_list)
fd_labeling(+fd_variable)
fd_labelingff(+fd_variable_list)
fd_labelingff(+fd_variable)

Description

fd_labeling(Vars, Options) assigns a value to each variable X of the list Vars according to the list of labeling options given by Options. Vars can be also a single FD variable. This predicate is re-executable on backtracking.

FD labeling options: Options is a list of labeling options. If this list contains contradictory options, the rightmost option is the one which applies. Possible options are:

fd_labeling(Vars) is equivalent to fd_labeling(Vars, []).

fd_labelingff(Vars) is equivalent to fd_labeling(Vars, [variable_method(ff)]).

Errors

Vars is a partial list or a list with an element E which is a variable  instantiation_error
Vars is neither a partial list nor a list  type_error(list, Vars)
an element E of the Vars list is neither a variable nor an integer nor an FD variable  type_error(fd_variable, E)
Options is a partial list or a list with an element E which is a variable  instantiation_error
Options is neither a partial list nor a list  type_error(list, Options)
an element E of the Options list is neither a variable nor a labeling option  domain_error(fd_labeling_option, E)

Portability

GNU Prolog predicates.


Copyright (C) 1999-2021 Daniel Diaz Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved. More about the copyright
Previous Up Next