FD variable information

7.5 | FD variable information

These predicate allow the user to get some information about FD variables. They are not constraints, they only return the current state of a variable.

7.5.1 | `fd_min/2`, `fd_max/2`, `fd_size/2`, `fd_dom/2`

Templates

  `fd_min(+fd_variable, ?integer)
  fd_max(+fd_variable, ?integer)
  fd_size(+fd_variable, ?integer)
  fd_dom(+fd_variable, ?integer_list)`

Description
`fd_min(X, N)` succeeds if `N` is the minimal value of the current domain of `X`.
`fd_max(X, N)` succeeds if `N` is the maximal value of the current domain of `X`.
`fd_size(X, N)` succeeds if `N` is the number of elements of the current domain of `X`.
`fd_dom(X, Values)` succeeds if `Values` is the list of values of the current domain of `X`.
Errors

`X` is a variable |  | `instantiation_error`
`X` is neither an FD variable nor an integer |  | `type_error(fd_variable, X)`
`N` is neither a variable nor an integer |  | `type_error(integer, N)`
an element `E` of the `Vars` list is neither a variable nor an FD variable nor an integer |  | `type_error(fd_variable, E)`
`Values` is neither a partial list nor a list |  | `type_error(list, Values)`

Portability
GNU Prolog predicate.

7.5.2 | `fd_has_extra_cstr/1`, `fd_has_vector/1`, `fd_use_vector/1`

Templates

  `fd_has_extra_cstr(+fd_variable)
  fd_has_vector(+fd_variable)
  fd_use_vector(+fd_variable)`

Description
`fd_has_extra_cstr(X)` succeeds if the `extra_cstr` of `X` is currently on (section 7.1).
`fd_has_vector(X)` succeeds if the current domain of `X` uses a sparse representation (section 7.1).
`fd_use_vector(X)` enforces a sparse representation for the domain of `X` (section 7.1).
Errors

`X` is a variable |  | `instantiation_error`
`X` is neither an FD variable nor an integer |  | `type_error(fd_variable, X)`

Portability
GNU Prolog predicates.

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