Commit 0390c40a authored by ehebrard's avatar ehebrard
Browse files

better constant

parent fb8d02bc
COPTIMIZE= -O3 -fno-omit-frame-pointer -flto
COMPILFLAGS= -D_UNIX -D_BIT64 -std=c++1z -Wno-sign-compare
COMPILFLAGS= -std=c++1z -Wno-sign-compare
BOOSTDIR = /Users/boost/boost_1_73_0/boost
......
......@@ -15,8 +15,9 @@ namespace schedcl {
#define ORIGIN 0
#define HORIZON 1
#define CMAX 0
#define LOWERBOUND 1
#define ZERO 0
#define CMAX 1
#define LOWERBOUND 2
#define SUCCESSOR 0
#define PREDECESSOR 1
......
......@@ -21,7 +21,7 @@
#define SEARCH 1
#define PROPAGATION 2
#define UPDATES 4
// #define TRACE 1
// #define TRACE 7
// #define debug_flag (num_literals >= 15762)
// #define DEBUGCMP
......@@ -333,11 +333,12 @@ template <class T> Schedule<T>::Schedule() : queue(*this) {
// variables.push_back(new DistanceVariable<T>(*this, ORIGIN, HORIZON, 0));
newEvent(); // ORIGIN
newEvent(); // HORIZON
addMaximumLag(ORIGIN, ORIGIN, 0);
addMaximumLag(ORIGIN, HORIZON, INFTY);
addMaximumLag(HORIZON, ORIGIN, 0);
addMaximumLag(ORIGIN, ORIGIN, 0);
mapsto.push_back(2);
variables.push_back(variables.back());
// addMaximumLag(ORIGIN, ORIGIN, 0);
// mapsto.push_back(2);
// variables.push_back(variables.back());
}
template <typename T> ChoicePoint Schedule<T>::none = {-1, -1};
......@@ -404,7 +405,7 @@ template <class T> void Schedule<T>::initialise() {
// }
// cout << *variables[0] << endl;
for (int i{0}; i < variables.size(); i += 2) {
for (int i{CMAX}; i < variables.size(); i += 2) {
// cout << *variables[i] << endl;
assert(variables[i]->from == variables[i + 1]->to);
assert(variables[i]->to == variables[i + 1]->from);
......@@ -414,7 +415,7 @@ template <class T> void Schedule<T>::initialise() {
// assert(x != y);
template <class T> int Schedule<T>::getUB() const { return *variables[0]; }
template <class T> int Schedule<T>::getUB() const { return *variables[CMAX]; }
template <class T> int Schedule<T>::numVar() const { return variables.size(); }
......@@ -432,7 +433,7 @@ const DistanceVariable<T> *Schedule<T>::getVariable(event x, event y) const {
auto v{varmap.find(key)};
if (v == varmap.end()) {
if(representant[x] == representant[y] and representant[x] != 0)
return variables[2];
return variables[ZERO];
key = {representant[x], representant[y]};
v = varmap.find(key);
......@@ -454,7 +455,7 @@ DistanceVariable<T> *Schedule<T>::getVariable(event x, event y) {
if(representant[x] == representant[y] and representant[x] != 0)
return variables[2];
return variables[ZERO];
key = {representant[x], representant[y]};
v = varmap.find(key);
......@@ -963,14 +964,14 @@ template <class T> void Schedule<T>::search() {
}
#endif
for (auto i{0}; i < variables.size(); i += 2) {
if (variables[i]->get() > 0 and variables[i + 1]->get() > 0) {
cout << *variables[i] << " / " << *variables[i + 1]
<< " is not ground!\n";
exit(1);
}
assert(variables[i]->get() + variables[i + 1]->get() >= 0);
}
// for (auto i{CMAX}; i < variables.size(); i += 2) {
// if (variables[i]->get() > 0 and variables[i + 1]->get() > 0) {
// cout << *variables[i] << " / " << *variables[i + 1]
// << " is not ground!\n";
// exit(1);
// }
// assert(variables[i]->get() + variables[i + 1]->get() >= 0);
// }
ReversibleObject::env->restore(init_level);
......
......@@ -395,7 +395,11 @@ void CumulativeTimeTabling<T, C>::propagate() {
tasks_that_start_before.push_back(i);
}
} else if (distance[END(i)][e]->get() < offset) {
} else {
// cout << i << " " << END(i) << " " << e << endl;
if (distance[END(i)][e]->get() < offset) {
tasks_that_end_after.push_back(i);
#ifdef DEBUG_CONSTRAINT
......@@ -404,6 +408,7 @@ void CumulativeTimeTabling<T, C>::propagate() {
<< endl;
}
#endif
}
}
// #ifdef DEBUG_CONSTRAINT
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment