Blame view

src/kernels/cl_propagators.c 15.7 KB
94b2b13d   Pedro Roque   PHACT source
1
2
3
4
/*
 * cl_propagators.c
 *
 *  Created on: 09/09/2019
4d26a735   Pedro Roque   Increased recogni...
5
 *      Author: pedro
94b2b13d   Pedro Roque   PHACT source
6
7
 */

94b2b13d   Pedro Roque   PHACT source
8
9
10
11
12
13
14
15
16

#ifndef __OPENCL_VERSION__
#include <stdbool.h>
#include <sys/types.h>

#include "cl_propagators.h"
#include "cl_aux_functions.h"
#include "../utils/cl_syntax.h"

4d26a735   Pedro Roque   Increased recogni...
17
18
19
20
21
22
#include "../constraints/all_different.h"
#include "../constraints/at_least.h"
#include "../constraints/at_most.h"
#include "../constraints/at_most_one.h"
#include "../constraints/bool2int.h"
#include "../constraints/bool_and.h"
94b2b13d   Pedro Roque   PHACT source
23
24
25
#include "../constraints/bool_clause.h"
#include "../constraints/bool_or.h"
#include "../constraints/element.h"
94b2b13d   Pedro Roque   PHACT source
26
27
#include "../constraints/element_int_var.h"
#include "../constraints/element_var.h"
4d26a735   Pedro Roque   Increased recogni...
28
29
30
31
32
33
#include "../constraints/eq.h"
#include "../constraints/eq_var.h"
#include "../constraints/ne.h"
#include "../constraints/exactly.h"
#include "../constraints/exactly_var.h"
#include "../constraints/le.h"
94b2b13d   Pedro Roque   PHACT source
34
#include "../constraints/linear.h"
4d26a735   Pedro Roque   Increased recogni...
35
36
#include "../constraints/linear_lt.h"
#include "../constraints/linear_ne.h"
94b2b13d   Pedro Roque   PHACT source
37
#include "../constraints/linear_var.h"
4d26a735   Pedro Roque   Increased recogni...
38
#include "../constraints/lt.h"
94b2b13d   Pedro Roque   PHACT source
39
40
#include "../constraints/max.h"
#include "../constraints/maximize.h"
4d26a735   Pedro Roque   Increased recogni...
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "../constraints/min.h"
#include "../constraints/minimize.h"
#include "../constraints/minus_eq.h"
#include "../constraints/minus_ne.h"
#include "../constraints/sum.h"
#include "../constraints/sum_prod.h"
#include "../constraints/sum_var.h"
#include "../constraints/var_eq_minus.h"
#include "../constraints/var_eq_minus_abs.h"
#include "../constraints/var_eq_plus.h"
#include "../constraints/var_eq_times.h"

#else
#include "../constraints/all_different.c"
94b2b13d   Pedro Roque   PHACT source
55
#include "../constraints/at_least.c"
94b2b13d   Pedro Roque   PHACT source
56
57
58
59
60
61
62
63
#include "../constraints/at_most.c"
#include "../constraints/at_most_one.c"
#include "../constraints/bool2int.c"
#include "../constraints/bool_and.c"
#include "../constraints/bool_clause.c"
#include "../constraints/bool_or.c"
#include "../constraints/element.c"
#include "../constraints/element_int_var.c"
94b2b13d   Pedro Roque   PHACT source
64
65
66
#include "../constraints/element_var.c"
#include "../constraints/eq.c"
#include "../constraints/eq_var.c"
4d26a735   Pedro Roque   Increased recogni...
67
68
69
70
71
72
#include "../constraints/ne.c"
#include "../constraints/exactly.c"
#include "../constraints/exactly_var.c"
#include "../constraints/le.c"
#include "../constraints/linear.c"
#include "../constraints/linear_lt.c"
94b2b13d   Pedro Roque   PHACT source
73
74
75
#include "../constraints/linear_ne.c"
#include "../constraints/linear_var.c"
#include "../constraints/lt.c"
94b2b13d   Pedro Roque   PHACT source
76
77
#include "../constraints/max.c"
#include "../constraints/maximize.c"
4d26a735   Pedro Roque   Increased recogni...
78
79
80
81
82
83
#include "../constraints/min.c"
#include "../constraints/minimize.c"
#include "../constraints/minus_eq.c"
#include "../constraints/minus_ne.c"
#include "../constraints/sum.c"
#include "../constraints/sum_prod.c"
94b2b13d   Pedro Roque   PHACT source
84
#include "../constraints/sum_var.c"
4d26a735   Pedro Roque   Increased recogni...
85
86
#include "../constraints/var_eq_minus.c"
#include "../constraints/var_eq_minus_abs.c"
94b2b13d   Pedro Roque   PHACT source
87
#include "../constraints/var_eq_plus.c"
4d26a735   Pedro Roque   Increased recogni...
88
#include "../constraints/var_eq_times.c"
94b2b13d   Pedro Roque   PHACT source
89
90
#endif

4d26a735   Pedro Roque   Increased recogni...
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#include "../config.h"
#include "../domains.h"
#include "cl_constraints.h"
#include "cl_variables.h"
#include "cl_ttl.h"

#if CL_D_TYPE == CL_BITMAP
#include "cl_bitmaps.h"
#elif CL_D_TYPE == CL_INTERVAL
#include  "cl_intervals.h"
#endif

/*
 * Propagate the domain of the variable with the ID prop_v_id through all the other variables on each constraint that constrain prop_v_id
94b2b13d   Pedro Roque   PHACT source
105
 * Return 1 if all propagations succeed or 0 if not
94b2b13d   Pedro Roque   PHACT source
106
107
108
109
110
111
112
113
 * vs - CSP variables
 * cs - CSP constraints
 * cs_per_v_idx - vector with all the constraints ID that constrain each variable, per variable ID order
 * vs_per_c_idx - vector with all constrained variables ID per constraint, per constraint ID order
 * c_consts - vector with all the constant values of a CSP
 * nodes_fail - counter for all the failed nodes
 * nodes_expl - counter for all the explored nodes
 * pruning - counter for all the propagations that prunned values
94b2b13d   Pedro Roque   PHACT source
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
 * props_ok - counter for all the succeeded propagations
 * vs_prop_ - all CSP variables with current step values
 * prop_v_id - variable ID to propagate
 * current_cs - constraint that should be propagated for the variable with prop_v_id ID
 * vs_id_to_prop_ - circular vector with the ids of the variables to propagate
 */
CUDA_FUNC void propagate(
CL_VS_MEM VARS* vs, CL_CS_MEM cl_constr* cs, CL_INTS_MEM int* cs_per_v_idx, CL_INTS_MEM int* vs_per_c_idx,
#if CS_AT_LEAST == 1 || CS_AT_MOST == 1 || CS_AT_MOST_ONE == 1 || CS_EXACTLY == 1 || CS_LINEAR == 1 || CS_LINEAR_LT == 1 || CS_LINEAR_NE == 1 || CS_LINEAR_VAR == 1 || CS_ELEMENT_INT_VAR == 1
		CL_INTS_MEM int* c_consts,
#endif
#if (CS_MAXIMIZE == 1 || CS_MINIMIZE == 1) && CL_WORK == CL_OPT
		__global unsigned int* val_to_opt_g,
#endif
#if CL_STATS == 1
		__global unsigned long* nodes_fail,
94b2b13d   Pedro Roque   PHACT source
130
131
132
133
134
		__global unsigned long* nodes_expl,
		__global unsigned long* pruning,
		__global unsigned long* props_ok,
#endif
		CL_MEMORY VARS_PROP* vs_prop_, unsigned int prop_v_id, CL_MEMORY unsigned short* vs_id_to_prop_ TTL_CTR
4d26a735   Pedro Roque   Increased recogni...
135
#if CL_N_DEVS > 1
94b2b13d   Pedro Roque   PHACT source
136
137
138
139
140
141
		, unsigned long* props_count
#endif
		CS_IGNORE_FUNC, bool* prop_ok, __global int* terms_mem) {

	CL_CS_MEM cl_constr* current_cs;
	int i;
4d26a735   Pedro Roque   Increased recogni...
142
143
144
145

	*prop_ok = 1;

#if CL_CHECK_ERRORS
94b2b13d   Pedro Roque   PHACT source
146
147
	int l;
	for (l = 0; l < CL_N_VS; l++) {
4d26a735   Pedro Roque   Increased recogni...
148
149
150

		bool empty;
#if CL_N_WORDS == 1
94b2b13d   Pedro Roque   PHACT source
151
152
		empty = (vs_prop_[l].prop_d == 0);
#else
4d26a735   Pedro Roque   Increased recogni...
153
		int m;
94b2b13d   Pedro Roque   PHACT source
154
155
		empty = 1;
		for (m = 0; m < CL_N_WORDS; m++) {
4d26a735   Pedro Roque   Increased recogni...
156
			CHECK_TTL(ttl_ctr, 115)
94b2b13d   Pedro Roque   PHACT source
157
			if (vs_prop_[l].prop_d[m] != 0) {
4d26a735   Pedro Roque   Increased recogni...
158
				empty = 0;
94b2b13d   Pedro Roque   PHACT source
159
				m = CL_N_WORDS;
4d26a735   Pedro Roque   Increased recogni...
160
			}
94b2b13d   Pedro Roque   PHACT source
161
		}
4d26a735   Pedro Roque   Increased recogni...
162
#endif
94b2b13d   Pedro Roque   PHACT source
163
		if ((*prop_ok == 1 && (empty || vs_prop_[l].n_vals == 0 || vs_prop_[l].n_vals > vs_prop_[l].max + 1)) || vs_prop_[l].min > vs_prop_[l].max || vs_prop_[l].max > CL_D_MAX) {
4d26a735   Pedro Roque   Increased recogni...
164
			printf((__constant char *)"\n###error 71\n");
94b2b13d   Pedro Roque   PHACT source
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
		}
	}
#endif

	// for statistics
#if CL_STATS == 1
	bool propagated;
	int last_prev_vs_to_prop;
#endif

#if CL_CHECK_ERRORS
	if (prop_v_id > CL_N_VS) {
		printf((__constant char *)"\n###error 48\n");
	}
#endif

	// iterates the constraints that constrain the variable to propagate
	for (i = 0; i < vs[prop_v_id].n_cs; i++) {
		CHECK_TTL(ttl_ctr, 28)
		current_cs = &cs[cs_per_v_idx[vs[prop_v_id].c_idx + convert_uint(i)]];
		unsigned int kind = current_cs->kind;
		CL_INTS_MEM int* vs_per_c_idx_ = &vs_per_c_idx[current_cs->v_idx];

#if CL_CHECK_ERRORS
	if (cs_per_v_idx[vs[prop_v_id].c_idx + convert_uint(i)] > CL_N_CS) {
		printf((__constant char *)"\n###error 49\n");
	}
	if (kind > 34) {
		printf((__constant char *)"\n###error 50\n");
	}
	if (current_cs->v_idx > CL_N_VS_CS) {
		printf((__constant char *)"\n###error 52\n");
	}
#endif

#if CS_AT_LEAST == 1 || CS_AT_MOST == 1 || CS_AT_MOST_ONE == 1 || CS_EXACTLY == 1 || CS_LINEAR == 1 || CS_LINEAR_LT == 1 || CS_LINEAR_NE == 1 || CS_LINEAR_VAR == 1 || CS_ELEMENT_INT_VAR == 1
		CL_INTS_MEM int* c_consts_ = &c_consts[current_cs->const_idx];

#if CL_CHECK_ERRORS
	if (current_cs->v_idx > CL_N_CS_VS) {
		printf((__constant char *)"\n###error 53\n");
	}
#endif
4d26a735   Pedro Roque   Increased recogni...
208
209
210
#endif

#if CL_N_DEVS > 1
94b2b13d   Pedro Roque   PHACT source
211
212
		(*props_count)++;
#endif
4d26a735   Pedro Roque   Increased recogni...
213
214
215
216
217
218
219
220
221

#if CL_STATS == 1
		last_prev_vs_to_prop = vs_id_to_prop_[1];
		propagated = false;
#endif

#if CL_CS_IGNORE
		if (cs_ignore[current_cs->c_id] == 0) {
#endif
94b2b13d   Pedro Roque   PHACT source
222
223
			switch (kind) {

4d26a735   Pedro Roque   Increased recogni...
224
225
#if CS_ALL_DIFFERENT == 1
			case ALL_DIFFERENT:
94b2b13d   Pedro Roque   PHACT source
226
227
				all_different_propagate(vs_per_c_idx_, vs_prop_, prop_v_id, current_cs, vs_id_to_prop_, prop_ok PROPAGATED_CALL TTL_CTR_V);
				break;
4d26a735   Pedro Roque   Increased recogni...
228
229
230
#endif

#if CS_AT_LEAST == 1
94b2b13d   Pedro Roque   PHACT source
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
			case AT_LEAST:
				at_least_propagate(vs_per_c_idx_, c_consts_, vs_prop_, current_cs, vs_id_to_prop_, prop_ok PROPAGATED_CALL CS_IGNORE_CALL TTL_CTR_V);
				break;
#endif

#if CS_AT_MOST == 1
			case AT_MOST:
				at_most_propagate(vs_per_c_idx_, c_consts_, vs_prop_, current_cs, vs_id_to_prop_, prop_ok PROPAGATED_CALL CS_IGNORE_CALL TTL_CTR_V);
				break;
#endif

#if CS_AT_MOST_ONE == 1
			case AT_MOST_ONE:
				at_most_one_propagate(vs_per_c_idx_, c_consts_, vs_prop_, prop_v_id, current_cs, vs_id_to_prop_, prop_ok PROPAGATED_CALL TTL_CTR_V);
				break;
#endif

#if CS_BOOL2INT == 1
			case BOOL2INT:
				bool2int_propagate(vs_per_c_idx_, vs_prop_, prop_v_id, current_cs, vs_id_to_prop_, prop_ok PROPAGATED_CALL CS_IGNORE_CALL TTL_CTR_V);
				break;
#endif

4d26a735   Pedro Roque   Increased recogni...
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
#if CS_BOOL_AND == 1
			case BOOL_AND:
				bool_and_propagate(vs_per_c_idx_, vs_prop_, current_cs, vs_id_to_prop_, prop_ok PROPAGATED_CALL CS_IGNORE_CALL TTL_CTR_V);
				break;
#endif

#if CS_BOOL_CLAUSE == 1
			case BOOL_CLAUSE:
				bool_clause_propagate(vs_per_c_idx_, vs_prop_, current_cs, vs_id_to_prop_, prop_ok PROPAGATED_CALL CS_IGNORE_CALL TTL_CTR_V);
				break;
#endif

#if CS_BOOL_OR == 1
			case BOOL_OR:
				bool_or_propagate(vs_per_c_idx_, vs_prop_, current_cs, vs_id_to_prop_, prop_ok PROPAGATED_CALL CS_IGNORE_CALL TTL_CTR_V);
				break;
#endif

#if CS_ELEMENT == 1
			case ELEMENT:
				element_propagate(vs_per_c_idx_, vs_prop_, prop_v_id, current_cs, vs_id_to_prop_, prop_ok PROPAGATED_CALL CS_IGNORE_CALL TTL_CTR_V);
				break;
#endif

#if CS_ELEMENT_INT_VAR == 1
			case ELEMENT_INT_VAR:
				element_int_var_propagate(vs_per_c_idx_, c_consts_, vs_prop_, prop_v_id, current_cs, vs_id_to_prop_, prop_ok, terms_mem PROPAGATED_CALL CS_IGNORE_CALL TTL_CTR_V);
				break;
#endif

#if CS_ELEMENT_VAR == 1
			case ELEMENT_VAR:
				element_var_propagate(vs_per_c_idx_, vs_prop_, prop_v_id, current_cs, vs_id_to_prop_, prop_ok PROPAGATED_CALL CS_IGNORE_CALL TTL_CTR_V);
				break;
#endif

#if CS_EQ == 1
			case EQ:
94b2b13d   Pedro Roque   PHACT source
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
				eq_propagate(vs_per_c_idx_, vs_prop_, current_cs, vs_id_to_prop_, prop_ok PROPAGATED_CALL CS_IGNORE_CALL TTL_CTR_V);
				break;
#endif

#if CS_EQ_VAR == 1
			case EQ_VAR:
				eq_var_propagate(vs_per_c_idx_, vs_prop_, current_cs, vs_id_to_prop_, prop_ok PROPAGATED_CALL CS_IGNORE_CALL TTL_CTR_V);
				break;
#endif

#if CS_EXACTLY == 1
			case EXACTLY:
				exactly_propagate(vs_per_c_idx_, c_consts_, vs_prop_, current_cs, vs_id_to_prop_, prop_ok PROPAGATED_CALL CS_IGNORE_CALL TTL_CTR_V);
				break;
#endif

#if CS_EXACTLY_VAR == 1
			case EXACTLY_VAR:
94b2b13d   Pedro Roque   PHACT source
310
311
312
313
314
315
316
317
318
319
320
321
				exactly_var_propagate(vs_per_c_idx_, vs_prop_, prop_v_id, current_cs, vs_id_to_prop_, prop_ok PROPAGATED_CALL CS_IGNORE_CALL TTL_CTR_V);
				break;
#endif

#if CS_LE == 1
			case LE:
				le_propagate(vs_per_c_idx_, vs_prop_, current_cs, vs_id_to_prop_, prop_ok PROPAGATED_CALL CS_IGNORE_CALL TTL_CTR_V);
				break;
#endif

#if CS_LINEAR == 1
			case LINEAR:
4d26a735   Pedro Roque   Increased recogni...
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
				linear_propagate(vs_per_c_idx_, c_consts_, vs_prop_, current_cs, vs_id_to_prop_, prop_ok, terms_mem PROPAGATED_CALL CS_IGNORE_CALL TTL_CTR_V);
				break;
#endif

#if CS_LINEAR_LT == 1
			case LINEAR_LT:
				linear_lt_propagate(vs_per_c_idx_, c_consts_, vs_prop_, current_cs, vs_id_to_prop_, prop_ok, terms_mem PROPAGATED_CALL CS_IGNORE_CALL TTL_CTR_V);
				break;
#endif

#if CS_LINEAR_NE == 1
			case LINEAR_NE:
				linear_ne_propagate(vs_per_c_idx_, c_consts_, vs_prop_, current_cs, vs_id_to_prop_, prop_ok, terms_mem PROPAGATED_CALL CS_IGNORE_CALL TTL_CTR_V);
				break;
#endif

#if CS_LINEAR_VAR == 1
			case LINEAR_VAR:
				linear_var_propagate(vs_per_c_idx_, c_consts_, vs_prop_, current_cs, vs_id_to_prop_, prop_ok, terms_mem PROPAGATED_CALL CS_IGNORE_CALL TTL_CTR_V);
				break;
#endif

#if CS_LT == 1
			case LT:
				lt_propagate(vs_per_c_idx_, vs_prop_, current_cs, vs_id_to_prop_, prop_ok PROPAGATED_CALL CS_IGNORE_CALL TTL_CTR_V);
				break;
#endif

#if CS_MAX == 1
			case MAX:
				max_propagate(vs_per_c_idx_, vs_prop_, prop_v_id, current_cs, vs_id_to_prop_, prop_ok PROPAGATED_CALL CS_IGNORE_CALL TTL_CTR_V);
				break;
#endif

#if CS_MAXIMIZE == 1 && CL_WORK == CL_OPT
			case MAXIMIZE:
				maximize_propagate(vs_prop_, current_cs, vs_id_to_prop_, val_to_opt_g, prop_ok PROPAGATED_CALL TTL_CTR_V);
				break;
94b2b13d   Pedro Roque   PHACT source
360
361
362
363
364
365
#endif

#if CS_MIN == 1
			case MIN:
				min_propagate(vs_per_c_idx_, vs_prop_, current_cs, vs_id_to_prop_, prop_ok PROPAGATED_CALL CS_IGNORE_CALL TTL_CTR_V);
				break;
4d26a735   Pedro Roque   Increased recogni...
366
367
368
369
370
371
372
373
374
375
376
377
#endif

#if CS_MINIMIZE == 1 && CL_WORK == CL_OPT
			case MINIMIZE:
				minimize_propagate(vs_prop_, current_cs, vs_id_to_prop_, val_to_opt_g, prop_ok PROPAGATED_CALL TTL_CTR_V);
				break;
#endif

#if CS_MINUS_EQ == 1
			case MINUS_EQ:
				minus_eq_propagate(vs_per_c_idx_, vs_prop_, prop_v_id, current_cs, vs_id_to_prop_, prop_ok PROPAGATED_CALL CS_IGNORE_CALL TTL_CTR_V);
				break;
94b2b13d   Pedro Roque   PHACT source
378
379
380
381
382
383
#endif

#if CS_MINUS_NE == 1
			case MINUS_NE:
				minus_ne_propagate(vs_per_c_idx_, vs_prop_, prop_v_id, current_cs, vs_id_to_prop_, prop_ok PROPAGATED_CALL CS_IGNORE_CALL TTL_CTR_V);
				break;
4d26a735   Pedro Roque   Increased recogni...
384
385
386
#endif

#if CS_NE == 1
94b2b13d   Pedro Roque   PHACT source
387
388
389
			case NE:
				ne_propagate(vs_per_c_idx_, vs_prop_, current_cs, vs_id_to_prop_, prop_ok PROPAGATED_CALL CS_IGNORE_CALL TTL_CTR_V);
				break;
4d26a735   Pedro Roque   Increased recogni...
390
391
392
#endif

#if CS_SUM == 1
94b2b13d   Pedro Roque   PHACT source
393
394
395
			case SUM:
				sum_propagate(vs_per_c_idx_, vs_prop_, current_cs, vs_id_to_prop_, prop_ok, terms_mem PROPAGATED_CALL CS_IGNORE_CALL TTL_CTR_V);
				break;
4d26a735   Pedro Roque   Increased recogni...
396
397
398
#endif

#if CS_SUM_PROD == 1
94b2b13d   Pedro Roque   PHACT source
399
400
401
			case SUM_PROD:
				sum_prod_propagate(vs_per_c_idx_, vs_prop_, current_cs, vs_id_to_prop_, prop_ok PROPAGATED_CALL CS_IGNORE_CALL TTL_CTR_V);
				break;
4d26a735   Pedro Roque   Increased recogni...
402
403
404
#endif

#if CS_SUM_VAR == 1
94b2b13d   Pedro Roque   PHACT source
405
406
407
			case SUM_VAR:
				sum_var_propagate(vs_per_c_idx_, vs_prop_, current_cs, vs_id_to_prop_, prop_ok, terms_mem PROPAGATED_CALL CS_IGNORE_CALL TTL_CTR_V);
				break;
4d26a735   Pedro Roque   Increased recogni...
408
409
410
#endif

#if CS_VAR_EQ_MINUS == 1
94b2b13d   Pedro Roque   PHACT source
411
412
413
			case VAR_EQ_MINUS:
				var_eq_minus_propagate(vs_per_c_idx_, vs_prop_, prop_v_id, current_cs, vs_id_to_prop_, prop_ok PROPAGATED_CALL CS_IGNORE_CALL TTL_CTR_V);
				break;
4d26a735   Pedro Roque   Increased recogni...
414
415
416
#endif

#if CS_VAR_EQ_MINUS_ABS == 1
94b2b13d   Pedro Roque   PHACT source
417
418
419
			case VAR_EQ_MINUS_ABS:
				var_eq_minus_abs_propagate(vs_per_c_idx_, vs_prop_, prop_v_id, current_cs, vs_id_to_prop_, prop_ok PROPAGATED_CALL TTL_CTR_V);
				break;
4d26a735   Pedro Roque   Increased recogni...
420
421
422
423
#endif

#if CS_VAR_EQ_PLUS == 1
			case VAR_EQ_PLUS:
94b2b13d   Pedro Roque   PHACT source
424
425
426
				var_eq_plus_propagate(vs_per_c_idx_, vs_prop_, prop_v_id, current_cs, vs_id_to_prop_, prop_ok PROPAGATED_CALL CS_IGNORE_CALL TTL_CTR_V);
				break;
#endif
4d26a735   Pedro Roque   Increased recogni...
427
428
429
430

#if CS_VAR_EQ_TIMES == 1
			case VAR_EQ_TIMES:
				var_eq_times_propagate(vs_per_c_idx_, vs_prop_, prop_v_id, current_cs, vs_id_to_prop_, prop_ok PROPAGATED_CALL CS_IGNORE_CALL TTL_CTR_V);
94b2b13d   Pedro Roque   PHACT source
431
432
433
				break;
#endif
			default:
4d26a735   Pedro Roque   Increased recogni...
434
435
436
437
				*prop_ok = 0;

#if CL_CHECK_ERRORS
				printf((__constant char *)"\n###error 65\n");
94b2b13d   Pedro Roque   PHACT source
438
439
440
#endif
				break;
			}
4d26a735   Pedro Roque   Increased recogni...
441
442
443
444

#if CL_STATS == 1
			if (propagated) {
				if (*prop_ok == 0) {
94b2b13d   Pedro Roque   PHACT source
445
446
447
					(*nodes_fail)++;
					(*nodes_expl)++;

4d26a735   Pedro Roque   Increased recogni...
448
449
450
				} else {
					(*props_ok)++;

94b2b13d   Pedro Roque   PHACT source
451
452
453
					if (last_prev_vs_to_prop != vs_id_to_prop_[1]) {
						(*pruning) += convert_ulong(abs(vs_id_to_prop_[1] - last_prev_vs_to_prop));
					}
4d26a735   Pedro Roque   Increased recogni...
454
455
456
				}
			}
#endif
94b2b13d   Pedro Roque   PHACT source
457
458
459

			if (*prop_ok == 0) {
				i = vs[prop_v_id].n_cs;
4d26a735   Pedro Roque   Increased recogni...
460
461
462
			}

			// check if there is any variable marked for being propagated, but not listed in the list of variables to propagate
94b2b13d   Pedro Roque   PHACT source
463
464
465
#if CL_CHECK_ERRORS
			int k;
			for (l = 0; l < CL_N_VS; l++) {
4d26a735   Pedro Roque   Increased recogni...
466
467
468
469
470
471
472
473
474

				bool empty;
#if CL_N_WORDS == 1
				empty = (vs_prop_[l].prop_d == 0);
#else
				int m;
				empty = 1;
				for (m = 0; m < CL_N_WORDS; m++) {
					CHECK_TTL(ttl_ctr, 115)
94b2b13d   Pedro Roque   PHACT source
475
476
477
					if (vs_prop_[l].prop_d[m] != 0) {
						empty = 0;
						m = CL_N_WORDS;
4d26a735   Pedro Roque   Increased recogni...
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
					}
				}
#endif
				if ((*prop_ok == 1 && (empty || vs_prop_[l].n_vals == 0 || vs_prop_[l].n_vals > vs_prop_[l].max + 1)) || vs_prop_[l].min > vs_prop_[l].max || vs_prop_[l].max > CL_D_MAX) {
					printf((__constant char *)"\n###error 70\n");
					printf((__constant char *)"constraint=%d, prop_ok=%d, empty=%d, vs_prop_[l].n_vals=%u, vs_prop_[l].min=%u, vs_prop_[l].max=%u\n",
							kind, *prop_ok, empty, vs_prop_[l].n_vals, vs_prop_[l].min, vs_prop_[l].max);

					*prop_ok = 0;
					i = vs[prop_v_id].n_cs;
				}

				if (vs_prop_[l].to_prop == 1) {

					if (vs_id_to_prop_[0] <= vs_id_to_prop_[1]) {
94b2b13d   Pedro Roque   PHACT source
493
494
495
496
497
498
499
500
501
502
503
						for (k = vs_id_to_prop_[0]; k < vs_id_to_prop_[1]; k++) {
							CHECK_TTL(ttl_ctr, 154)

							if (vs_id_to_prop_[k] == l) {
								break;
							}
						}

						if (k == vs_id_to_prop_[1]) {
							printf((__constant char *)"\n###error 66\n");
						}
4d26a735   Pedro Roque   Increased recogni...
504
					} else {
94b2b13d   Pedro Roque   PHACT source
505
506
507
508
509
						for (k = vs_id_to_prop_[0]; k < vs_id_to_prop_[CL_N_VS + 2]; k++) {
							CHECK_TTL(ttl_ctr, 155)

							if (k < CL_D_MAX + 2 && vs_id_to_prop_[k] == l) {
								break;
4d26a735   Pedro Roque   Increased recogni...
510
							}
94b2b13d   Pedro Roque   PHACT source
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
						}

						if (k == vs_id_to_prop_[CL_N_VS + 2]) {

							for (k = 2; k < vs_id_to_prop_[1]; k++) {
								CHECK_TTL(ttl_ctr, 156)

								if (vs_id_to_prop_[k] == l) {
									break;
								}
							}
						}
					}
				}
			}
#endif

#if CL_CS_IGNORE
		}
#endif
	}
}
4d26a735   Pedro Roque   Increased recogni...

94b2b13d   Pedro Roque   PHACT source

94b2b13d   Pedro Roque   PHACT source

4d26a735   Pedro Roque   Increased recogni...

94b2b13d   Pedro Roque   PHACT source

4d26a735   Pedro Roque   Increased recogni...

94b2b13d   Pedro Roque   PHACT source

94b2b13d   Pedro Roque   PHACT source

4d26a735   Pedro Roque   Increased recogni...

94b2b13d   Pedro Roque   PHACT source

4d26a735   Pedro Roque   Increased recogni...

94b2b13d   Pedro Roque   PHACT source

4d26a735   Pedro Roque   Increased recogni...

94b2b13d   Pedro Roque   PHACT source

4d26a735   Pedro Roque   Increased recogni...

94b2b13d   Pedro Roque   PHACT source