this repo has no description
1%
2% Main authors:
3% Guido Tack <tack@gecode.org>
4%
5% Copyright:
6% Guido Tack, 2007
7%
8% Last modified:
9% $Date: 2015-01-05 17:33:06 +1100 (Mon, 05 Jan 2015) $ by $Author: tack $
10% $Revision: 14337 $
11%
12% This file is part of Gecode, the generic constraint
13% development environment:
14% http://www.gecode.org
15%
16% Permission is hereby granted, free of charge, to any person obtaining
17% a copy of this software and associated documentation files (the
18% "Software"), to deal in the Software without restriction, including
19% without limitation the rights to use, copy, modify, merge, publish,
20% distribute, sublicense, and/or sell copies of the Software, and to
21% permit persons to whom the Software is furnished to do so, subject to
22% the following conditions:
23%
24% The above copyright notice and this permission notice shall be
25% included in all copies or substantial portions of the Software.
26%
27% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
28% EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
29% MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
30% NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
31% LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
32% OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
33% WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34%
35%
36
37
38/***
39 @groupdef gecode Additional declarations for Gecode
40
41 These annotations and predicates are available for the Gecode
42 solver. In order to use them in a model, include the file "gecode.mzn".
43*/
44
45/***
46 @groupdef gecode.annotations Additional Gecode search annotations
47*/
48
49/** @group gecode.annotations Select variable with smallest accumulated failure count */
50annotation afc_min;
51/** @group gecode.annotations Select variable with smallest accumulated failure count divided by domain size */
52annotation afc_size_min;
53/** @group gecode.annotations Select variable with largest accumulated failure count */
54annotation afc_max;
55/** @group gecode.annotations Select variable with largest accumulated failure count divided by domain size */
56annotation afc_size_max;
57/** @group gecode.annotations Select variable with smallest activity count */
58annotation activity_min;
59/** @group gecode.annotations Select variable with smallest activity count divided by domain size */
60annotation activity_size_min;
61/** @group gecode.annotations Select variable with largest activity count */
62annotation activity_max;
63/** @group gecode.annotations Select variable with largest activity count divided by domain size */
64annotation activity_size_max;
65/** @group gecode.annotations Select random variable */
66annotation random;
67
68/** @group gecode.annotations Specify default search strategy for integer variables to use variable selection
69 strategy \a varsel, and value choice strategy \a valsel. */
70annotation int_default_search(ann: varsel, ann: valsel);
71/** @group gecode.annotations Specify default search strategy for Boolean variables to use variable selection
72 strategy \a varsel, and value choice strategy \a valsel. */
73annotation bool_default_search(ann: varsel, ann: valsel);
74/** @group gecode.annotations Specify default search strategy for set variables to use variable selection
75 strategy \a varsel, and value choice strategy \a valsel. */
76annotation set_default_search(ann: varsel, ann: valsel);
77/** @group gecode.annotations Specify default search strategy for float variables to use variable selection
78 strategy \a varsel, and value choice strategy \a valsel. */
79annotation float_default_search(ann: varsel, ann: valsel);
80
81/** @group gecode.annotations
82 Simple large neighbourhood search strategy: upon restart, for each variable in \a x,
83 the probability of it being fixed to the previous solution is \a percentage (out of 100).
84*/
85annotation relax_and_reconstruct(array[int] of var int: x, int: percentage);
86
87/** @group gecode.annotations
88 Simple large neighbourhood search strategy: upon restart, for each variable in \a x,
89 the probability of it being fixed to the previous solution is \a percentage (out of 100).
90 Start from an initial solution \a y.
91*/
92annotation relax_and_reconstruct(array[int] of var int: x, int: percentage, array[int] of int: y);
93
94/***
95 @groupdef gecode.constraints Additional Gecode constraints
96*/
97
98/** @group gecode.constraints
99 Constrain \a z to be the intersection of all sets
100 in \a y that are selected by \a x: \(i \in \a z \leftrightarrow \forall j \in \a x: (i \in \a y[j]) \)
101*/
102predicate gecode_array_set_element_intersect(var set of int: x,
103 array[int] of var set of int: y, var set of int: z);
104
105/** @group gecode.constraints
106 Constrain \a z to be the disjoint union of all sets
107 in \a y that are selected by \a x: \(i \in \a z \leftrightarrow \exists j \in \a x: (i \in \a y[j]) \)
108 and \( i \in \a x \land j \in \a x \land i\neq j \rightarrow \a y[i] \cap \a y[j]=\emptyset \)
109*/
110predicate gecode_array_set_element_partition(var set of int: x,
111 array[int] of var set of int: y, var set of int: z);
112
113/** @group gecode.constraints
114 Constrain \a z to be a subset of \a u, and \a z to be the intersection of all sets
115 in \a y that are selected by \a x: \(i \in \a z \leftrightarrow \forall j \in \a x: (i \in \a y[j]) \)
116*/
117predicate gecode_array_set_element_intersect_in(var set of int: x,
118 array[int] of var set of int: y,
119 var set of int: z, set of int: u);
120
121predicate gecode_among_seq_int(array[int] of var int: x, set of int: S,
122 int: l, int: m, int: n);
123
124predicate gecode_among_seq_bool(array[int] of var bool: x, bool: b,
125 int: l, int: m, int: n);
126
127/** @group gecode.constraints
128 Every subsequence of \a x of length \a l has at least \a m and at most \a n occurrences
129 of the values in \a S
130*/
131predicate among_seq(array[int] of var int: x, set of int: S,
132 int: l, int: m, int: n) = gecode_among_seq_int(x,S,l,m,n);
133/** @group gecode.constraints
134 Every subsequence of \a x of length \a l has at least \a m and at most \a n occurrences
135 of the values in \a S
136*/
137predicate among_seq(array[int] of var bool: x, bool: b,
138 int: l, int: m, int: n) = gecode_among_seq_bool(x,b,l,m,n);
139
140predicate gecode_circuit_cost_array(array[int] of int: c,
141 array[int] of var int: x, array[int] of var int: y, var int: z);
142predicate gecode_circuit_cost(array[int] of int: c, array[int] of var int: x,
143 var int: z);
144
145/** @group gecode.constraints
146 Constrains the elements of \a x to define a circuit where \a x[\p i] = \p j means
147 that \p j is the successor of \p i. Additionally, constrain \a z to
148 be the cost of the circuit. Each edge cost is defined by array \a c. The variables
149 \a y[i] are constrained to be the edge cost of the node \a x[i].
150*/
151predicate circuit_cost_array(array[int] of int: c,
152 array[int] of var int: x, array[int] of var int: y, var int: z) =
153 gecode_circuit_cost_array(c,[x[i]-min(index_set(x)) | i in index_set(x)],
154 y,z);
155/** @group gecode.constraints
156 Constrains the elements of \a x to define a circuit where \a x[\p i] = \p j means
157 that \p j is the successor of \p i. Additionally, constrain \a z to
158 be the cost of the circuit. Each edge cost is defined by array \a c.
159*/
160predicate circuit_cost(array[int] of int: c, array[int] of var int: x,
161 var int: z) =
162 gecode_circuit_cost(c, [x[i]-min(index_set(x)) | i in index_set(x)], z);
163
164predicate gecode_schedule_unary(array[int] of var int: x, array[int] of int: p);
165predicate gecode_schedule_unary_optional(array[int] of var int: x,
166 array[int] of int: p, array[int] of var bool: m);
167
168predicate gecode_schedule_cumulative_optional(array[int] of var int: start,
169 array[int] of int: duration, array[int] of int: usage,
170 array[int] of var bool: m, int: capacity);