An FD arithmetic expression is a Prolog term built from integers, variables (Prolog or FD variables), and functors (or operators) that represent arithmetic functions. The following table details the components of an FD arithmetic expression:
FD expressions are not restricted to be linear. However non-linear constraints usually yield less constraint propagation than linear constraints.
+, -, *, /, //, rem and ** are predefined infix operators. + and - are predefined prefix operators (section 8.14.10).
Errors
Templates
Description
FdExpr1 #= FdExpr2 constrains FdExpr1 to be equal to FdExpr2.
FdExpr1 #\= FdExpr2 constrains FdExpr1 to be different from FdExpr2.
FdExpr1 #< FdExpr2 constrains FdExpr1 to be less than FdExpr2.
FdExpr1 #=< FdExpr2 constrains FdExpr1 to be less than or equal to FdExpr2.
FdExpr1 #> FdExpr2 constrains FdExpr1 to be greater than FdExpr2.
FdExpr1 #>= FdExpr2 constrains FdExpr1 to be greater than or equal to FdExpr2.
FdExpr1 and FdExpr2 are arithmetic FD expressions (section 9.6.1).
#=, #\=, #<, #=<, #> and #>= are predefined infix operators (section 8.14.10).
These predicates post arithmetic constraints that are managed by the solver using a partial arc-consistency algorithm to reduce the domain of involved variables. In this scheme only the bounds of the domain of variables are updated. This leads to less propagation than full arc-consistency techniques (section 9.6.3) but is generally more efficient for arithmetic. These arithmetic constraints can be reified (section 9.7).
Errors
Refer to the syntax of arithmetic FD expressions for possible errors (section 9.6.1).
Portability
GNU Prolog predicates.
Templates
Description
FdExpr1 #=# FdExpr2 constrains FdExpr1 to be equal to FdExpr2.
FdExpr1 #\=# FdExpr2 constrains FdExpr1 to be different from FdExpr2.
FdExpr1 #<# FdExpr2 constrains FdExpr1 to be less than FdExpr2.
FdExpr1 #=<# FdExpr2 constrains FdExpr1 to be less than or equal to FdExpr2.
FdExpr1 #># FdExpr2 constrains FdExpr1 to be greater than FdExpr2.
FdExpr1 #>=# FdExpr2 constrains FdExpr1 to be greater than or equal to FdExpr2.
FdExpr1 and FdExpr2 are arithmetic FD expressions (section 9.6.1).
#=#, #\=#, #<#, #=<#, #># and #>=# are predefined infix operators (section 8.14.10).
These predicates post arithmetic constraints that are managed by the solver using a full arc-consistency algorithm to reduce the domain of involved variables. In this scheme the full domain of variables is updated. This leads to more propagation than partial arc-consistency techniques (section 9.6.1) but is generally less efficient for arithmetic. These arithmetic constraints can be reified (section 9.7.1).
Errors
Refer to the syntax of arithmetic FD expressions for possible errors (section 9.6.1).
Portability
GNU Prolog predicates.
Templates
Description
fd_prime(X) constraints X to be a prime number between 0..vector_max. This constraint enforces a sparse representation for the domain of X (section 9.1).
fd_not_prime(X) constraints X to be a non prime number between 0..vector_max. This constraint enforces a sparse representation for the domain of X (section 9.1).
Errors
Portability
GNU Prolog predicates.