Main differences between GFD and IC

## 7.6 Main differences between GFD and IC

Although GFD was designed to be code compatible with IC in terms of syntax, there are still some unavoidable differences, because of differences between Gecode and IC. In addition, Gecode is implemented using very different implementation techniques from IC, and although such differences are mostly not visible in terms of syntax, there are still semantics and performance implications.

The main visible differences between GFD and IC are:

- Real interval arithmetic and variables are not supported in GFD.
- Domain variables always have finite integer bounds, and the maximum bounds are determined by Gecode. Like FD, default finite bounds are given to domain variables that do not have explicit bounds, and the default settings for these bounds are below the maxima that Gecode allows.
- Constraint propagation is performed within Gecode, and each propagation phase is atomic at the ECLiPSe level. Posting of constraints and propagation of their consequences are separate in Gecode. GFD uses a demon suspended goal to perform the propagation: after the posting of any constraint (and other changes to the problem that need propagation), this suspended goal is scheduled and woken. When the woken goal is executed, propagation is performed.
- All constraints can be called from the gfd module, and in addition, some constraints can be called from modules that specify the consistency level: gfd_gac (generalised arc consistency, also known as domain consistency), gfd_bc (bounds consistency), gfd_vc (value consistency (naive)). The gfd module versions use the default consistency defined for the constraint by Gecode. These consistency levels map directly to those defined in Gecode for the constraints.
- gfd:search/6 interfaces to Gecode’s search-engines, where the entire search is performed in Gecode, and the whole search appears atomic at the ECLiPSe level.
- The suspension lists supported by GFD are different from IC. Currently, only the ’any’ suspension list (for any changes to the variable’s domain) found in FD but not IC, is supported. Note that the GFD constraints are implemented in Gecode directly, and therefore do not use GFD’s suspension lists.
- Constraint and integer expressions are designed to be compatible with IC’s, and the arithmetic operators and logical connectives supported by Gecode are supported, and these largely overlaps those of IC’s. In addition, “functional” (where the last argument is a domain variable) and reified constraints can appear in expressions without the last argument, as in IC.

  The differences from IC are:

  - User defined constraints are not allowed in expressions.
  - The operators and connectives supported are those supported by Gecode, so most of the IC operators for real arithmetic are not supported.
  - Only inlined arithmetic (sub-)expressions are allowed between logical connectives.
  - GFD expressions are broken down into sub-expressions and constraints that are supported natively by Gecode, where the additional sub-expressions are replaced by a domain variable in the original expression. These domain variables are given the default bounds. IC does something similar, but what constitutes additional sub-expressions will differ between GFD and IC, and the variables substituted for the sub-expressions would be given infinite bounds in IC.
- GFD variables cannot be copied to non-logical storage, and an error is raised if a GFD variable occurs in a term that is being copied for such purpose (assert, non-logical variables, shelves, etc.). Note that this means that GFD is incompatible with Propia, as this library makes use of non-logical storage.