-
Notifications
You must be signed in to change notification settings - Fork 0
/
E2-CSP.h
52 lines (40 loc) · 1 KB
/
E2-CSP.h
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
#include <map>
#include <sstream>
#include <string>
#include <vector>
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <algorithm>
#include <ctime>
using namespace std;
const string rInfo[] = { "=", "!=", "<=", "<", ">=", ">", "Sum = value", "??", "Sum = var", "Sum < value" };
class CSP {
public:
int nbVars;
int nbConstraints;
vector<vector<int> > vars;
vector<vector<int> > constraints;
map<int, vector<vector<int> >> varConstraints;
int totalNodes;
int branchesIgnorees;
clock_t start;
double duration;
bool sortOrder(int x, int y);
bool isIn(map<int, int> &affectation, vector<int> &v);
int isValid(map<int, int> &affectation);
vector<vector<int> >& domainReduction(vector<vector<int> > &doms, int x, int value);
void computeVarConstraints();
map<int, int>* solve();
map<int, int>* solve2();
void displayDebug();
void displayStats();
};
class Node {
public:
map<int, int>* assigned;
vector<vector<int> > domains;
Node(vector<vector<int> > p);
Node(Node* n);
~Node();
};