cl_constraints.h
3.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/*
* cl_constraints.h
*
* Created on: 19/11/2014
* Author: pedro
*/
#ifndef SRC_KERNELS_CL_CONSTRAINTS_H_
#define SRC_KERNELS_CL_CONSTRAINTS_H_
// Constraint types
typedef enum {
ALL_DIFFERENT,
AT_LEAST,
AT_MOST,
AT_MOST_ONE,
BOOL2INT,
BOOL_AND,
BOOL_CLAUSE,
BOOL_OR,
ELEMENT,
ELEMENT_INT_VAR,
ELEMENT_VAR,
EQ,
EQ_VAR,
EXACTLY,
EXACTLY_VAR,
LE,
LINEAR,
LINEAR_LT,
LINEAR_NE,
LINEAR_VAR,
LT,
MAX,
MAXIMIZE,
MIN,
MINIMIZE,
MINUS_EQ,
MINUS_NE,
NE,
SUM,
SUM_PROD,
SUM_VAR,
VAR_EQ_MINUS,
VAR_EQ_MINUS_ABS,
VAR_EQ_PLUS,
VAR_EQ_TIMES,
N_C_TYPES
} c_kind;
// constraint structure used in kernel
struct cl_constrs_ {
cl_uint v_idx; // index of the first variable constrained by this constraint in cs_vs_idx vector
cl_uint const_idx; // index of the first constant value (if more than one) constrained by this constraint in cs_const_idx vector
cl_uint reif_var_id; // ID of the disjunction variable
cl_uint kind; // constraint type
cl_uint c_id; // ID of this constraint
cl_int constant_val; // Constant value for multiple purposes, depending on the constraint type
cl_ushort n_c_vs; // number of constrained variables
cl_ushort n_c_consts; // number of constant values (if more than one) constrained by this constraint in cs_const_idx vector
cl_char reified; // True if this constraint is reified
cl_char boolean; // True if all the variables constrained by this constraint are boolean
};
typedef struct cl_constrs_ cl_constr;
// Host configuration
#ifndef __OPENCL_VERSION__
// only for syntax highlighting on cl_propagators
#ifndef CS_ALL_DIFFERENT
#define CS_ALL_DIFFERENT 1
#define CS_AT_LEAST 1
#define CS_AT_MOST 1
#define CS_AT_MOST_ONE 1
#define CS_BOOL2INT 1
#define CS_BOOL_AND 1
#define CS_BOOL_CLAUSE 1
#define CS_BOOL_OR 1
#define CS_ELEMENT 1
#define CS_ELEMENT_INT_VAR 1
#define CS_ELEMENT_VAR 1
#define CS_EQ 1
#define CS_EQ_VAR 1
#define CS_EXACTLY 1
#define CS_EXACTLY_VAR 1
#define CS_LE 1
#define CS_LINEAR 1
#define CS_LINEAR_LT 1
#define CS_LINEAR_NE 1
#define CS_LINEAR_VAR 1
#define CS_LT 1
#define CS_MAX 1
#define CS_MAXIMIZE 1
#define CS_MIN 1
#define CS_MINIMIZE 1
#define CS_MINUS_EQ 1
#define CS_MINUS_NE 1
#define CS_NE 1
#define CS_SUM 1
#define CS_SUM_PROD 1
#define CS_SUM_VAR 1
#define CS_VAR_EQ_MINUS 1
#define CS_VAR_EQ_MINUS_ABS 1
#define CS_VAR_EQ_PLUS 1
#define CS_VAR_EQ_TIMES 1
#define CS_R_ALL_DIFFERENT 1
#define CS_R_AT_LEAST 1
#define CS_R_AT_MOST 1
#define CS_R_AT_MOST_ONE 1
#define CS_R_BOOL2INT 1
#define CS_R_BOOL_AND 1
#define CS_R_BOOL_CLAUSE 1
#define CS_R_BOOL_OR 1
#define CS_R_ELEMENT 1
#define CS_R_ELEMENT_INT_VAR 1
#define CS_R_ELEMENT_VAR 1
#define CS_R_EQ 1
#define CS_R_EQ_VAR 1
#define CS_R_EXACTLY 1
#define CS_R_EXACTLY_VAR 1
#define CS_R_LE 1
#define CS_R_LINEAR 1
#define CS_R_LINEAR_LT 1
#define CS_R_LINEAR_NE 1
#define CS_R_LINEAR_VAR 1
#define CS_R_LT 1
#define CS_R_MAX 1
#define CS_R_MAXIMIZE 1
#define CS_R_MIN 1
#define CS_R_MINIMIZE 1
#define CS_R_MINUS_EQ 1
#define CS_R_MINUS_NE 1
#define CS_R_NE 1
#define CS_R_SUM 1
#define CS_R_SUM_PROD 1
#define CS_R_SUM_VAR 1
#define CS_R_VAR_EQ_MINUS 1
#define CS_R_VAR_EQ_MINUS_ABS 1
#define CS_R_VAR_EQ_PLUS 1
#define CS_R_VAR_EQ_TIMES 1
#endif
#endif
#endif /* SRC_CL_CONSTRAINTS_H_ */