4.2.4. Additional declarations for Gecode¶
These annotations and predicates are available for the Gecode solver. In order to use them in a model, include the file “gecode.mzn”.
4.2.4.1. Additional Gecode search annotations¶
Parameters¶
annotation activity_max
Select variable with largest activity count
annotation activity_min
Select variable with smallest activity count
annotation activity_size_max
Select variable with largest activity count divided by domain size
annotation activity_size_min
Select variable with smallest activity count divided by domain size
annotation afc_max
Select variable with largest accumulated failure count
annotation afc_min
Select variable with smallest accumulated failure count
annotation afc_size_max
Select variable with largest accumulated failure count divided by domain size
annotation afc_size_min
Select variable with smallest accumulated failure count divided by domain size
annotation random
Select random variable
Functions and Predicates¶
annotation bool_default_search(ann: varsel, ann: valsel)
Specify default search strategy for Boolean variables to use variable selection strategy varsel , and value choice strategy valsel .
annotation float_default_search(ann: varsel, ann: valsel)
Specify default search strategy for float variables to use variable selection strategy varsel , and value choice strategy valsel .
annotation int_default_search(ann: varsel, ann: valsel)
Specify default search strategy for integer variables to use variable selection strategy varsel , and value choice strategy valsel .
annotation relax_and_reconstruct(array [int] of var int: x,
int: percentage)
Simple large neighbourhood search strategy: upon restart, for each variable in x , the probability of it being fixed to the previous solution is percentage (out of 100).
annotation relax_and_reconstruct(array [int] of var int: x,
int: percentage,
array [int] of int: y)
Simple large neighbourhood search strategy: upon restart, for each variable in x , the probability of it being fixed to the previous solution is percentage (out of 100). Start from an initial solution y .
annotation set_default_search(ann: varsel, ann: valsel)
Specify default search strategy for set variables to use variable selection strategy varsel , and value choice strategy valsel .
4.2.4.2. Additional Gecode constraints¶
predicate among_seq(array [int] of var int: x,
set of int: S,
int: l,
int: m,
int: n)
Every subsequence of x of length l has at least m and at most n occurrences of the values in S
predicate among_seq(array [int] of var bool: x,
bool: b,
int: l,
int: m,
int: n)
Every subsequence of x of length l has at least m and at most n occurrences of the values in S
predicate circuit_cost(array [int] of int: c,
array [int] of var int: x,
var int: z)
Constrains the elements of x to define a circuit where x [ i ] = j means that j is the successor of i . Additionally, constrain z to be the cost of the circuit. Each edge cost is defined by array c .
predicate circuit_cost_array(array [int] of int: c,
array [int] of var int: x,
array [int] of var int: y,
var int: z)
Constrains the elements of x to define a circuit where x [ i ] = j means that j is the successor of i . Additionally, constrain z to be the cost of the circuit. Each edge cost is defined by array c . The variables y [i] are constrained to be the edge cost of the node x [i].
predicate gecode_array_set_element_intersect(var set of int: x,
array [int] of var set of int: y,
var set of int: z)
Constrain z to be the intersection of all sets in y that are selected by x : \(i \in {\bf z} \leftrightarrow \forall j \in {\bf x}: (i \in {\bf y}[j])\)
predicate gecode_array_set_element_intersect_in(var set of int: x,
array [int] of var set of int: y,
var set of int: z,
set of int: u)
Constrain z to be a subset of u , and z to be the intersection of all sets in y that are selected by x : \(i \in {\bf z} \leftrightarrow \forall j \in {\bf x}: (i \in {\bf y}[j])\)
predicate gecode_array_set_element_partition(var set of int: x,
array [int] of var set of int: y,
var set of int: z)
Constrain z to be the disjoint union of all sets in y that are selected by x : \(i \in {\bf z} \leftrightarrow \exists j \in {\bf x}: (i \in {\bf y}[j])\) and \(i \in {\bf x} \land j \in {\bf x} \land i\neq j \rightarrow {\bf y}[i] \cap {\bf y}[j]=\emptyset\)