Commit 50c5bc2e authored by ehebrard's avatar ehebrard
Browse files

bug

parent 18f5a90c
......@@ -79,6 +79,10 @@ public:
void get(vector<DistanceLiteral<T>> &Cl) const { expl->xplain(hint, Cl); }
ostream &display(ostream &os) const {
assert(expl != NULL);
// os << "b/c ";
expl->print_reason(os, hint);
return os;
......@@ -243,7 +247,7 @@ public:
return os;
}
protected:
// protected:
// stores the successive values, the explainer, and a hint used to index the
// literals on the explainer's side, or directly encode a hint to allow to
// reconstruct the reason
......
......@@ -32,7 +32,7 @@ public:
int x[2];
// int y;
bool isNone() const { return x[0] < 0; }
// bool isNone() const { return x[0] < 0; }
const bool operator==(const ChoicePoint &cp) {
return cp.x[0] == x[0] and cp.x[1] == x[1];
......@@ -482,6 +482,10 @@ template <class T> void Schedule<T>::addEdge(const event x, const event y) {
template <class T> void Schedule<T>::setUpperBound(const T b) {
addConstraint(variables[CMAX], b, Constant<T>::NoReason);
// assert(variables[CMAX]->literals.back().reason.expl != NULL);
// addMaximumLag(ORIGIN, HORIZON, b);
// variables[CMAX]->set(b);
// set(variables[CMAX], b);
......@@ -634,6 +638,17 @@ template <class T> ChoicePoint Schedule<T>::selectChoicePoint() {
template <class T> void Schedule<T>::search() {
double start_time = cpu_time();
for(auto v : variables) {
cout << *v ;
for(auto l : v->literals) {
cout << " " << l.value ;
assert(l.reason.expl != NULL);
}
cout << endl;
}
//
// cout << choicepoints[16].x[0] << " <> " << choicepoints[16].x[1] << endl;
//
......@@ -709,7 +724,7 @@ template <class T> void Schedule<T>::search() {
// exit(1);
// if (cp == Schedule<T>::none) {
if (cp.isNone()) {
if (cp == Schedule<T>::none) {
// exit(1);
......@@ -963,6 +978,7 @@ template <class T> void Schedule<T>::updateDistances() {
// #endif
assert(new_bound[i] != -INFTY);
assert(explanation[i].expl != NULL);
set(variables[i], new_bound[i], explanation[i]);
// queue.notifyChange(i);
......@@ -1002,6 +1018,9 @@ void Schedule<T>::set(DistanceVariable<T> *v, const T bound, const Explanation<T
if (bound >= v->get())
return;
assert(e.expl != NULL);
// if (NOT(v)->get() + bound < 0)
// fail(this, v->id);
assert(bound != -INFTY);
......@@ -1657,8 +1676,10 @@ void ConstraintQueue<T, N>::notifyChange(const int id) {
#ifdef TRACE
if (TRACE & PROPAGATION) {
cout << "new literal: " << *(schedule.variables[id])
<< " b/c "<< schedule.get_explanation(id)
cout << "new literal: (" << id << ") " << *(schedule.variables[id])
<< " b/c \n" ;
cout << schedule.get_explanation(id)
<< endl;
}
#endif
......
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