Blame view

src/constraints/fake_all_different.c 594 Bytes
94b2b13d   Pedro Roque   PHACT source
1
2
3
4
/*
 * fake_all_different.c
 *
 *  Created on: 21/01/2017
4d26a735   Pedro Roque   Increased recogni...
5
 *      Author: pedro
94b2b13d   Pedro Roque   PHACT source
6
7
8
 */

#include "fake_all_different.h"
4d26a735   Pedro Roque   Increased recogni...
9
10
#include "ne.h"

94b2b13d   Pedro Roque   PHACT source
11
12
13
14
15
16
17
/*
 * Simulates the all-different constraint by using ne binary constraints
 * X_ids - array with the IDs of the variables that are constrained by this constraint
 * n_vs - number of ID variables in vs_id
 * reif_v_id - ID of the reification variable or -1 if none
 */
void c_fake_all_different(unsigned int* X_ids, unsigned int n_vs) {
4d26a735   Pedro Roque   Increased recogni...
18
	unsigned int i, j;
94b2b13d   Pedro Roque   PHACT source
19
20
21
22

	for (i = 0; i < n_vs; i++) {
		for (j = i + 1; j < n_vs; j++) {
			c_ne(X_ids[i], X_ids[j]);
4d26a735   Pedro Roque   Increased recogni...
23
		}
94b2b13d   Pedro Roque   PHACT source
24
25
	}
}