Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in PositiveTableConstraint::InitialPropagate #22

Closed
orwant opened this issue Aug 5, 2015 · 3 comments
Closed

Bug in PositiveTableConstraint::InitialPropagate #22

orwant opened this issue Aug 5, 2015 · 3 comments
Assignees
Milestone

Comments

@orwant
Copy link
Collaborator

orwant commented Aug 5, 2015

Originally reported on Google Code with ID 6

On some instances, there is an assertion failure when PositiveTableConstraint::InitialPropagate
calls IntervalUp64.

You pass position+1 as argument, but position can have any value between 0 and 63.
If it is 63, then you call IntervalUp64(64) which leads to the assertion failure.

If you run the program with NDEBUG, this leads to an infinite loop.

The trivial solution would be to add a check, but maybe there's something smarter that
can be done.

Reported by phil.vank on 2011-09-16 05:55:00

@orwant
Copy link
Collaborator Author

orwant commented Aug 5, 2015

From what I understand from the code you could write it like this, solving the problem
and making it faster :

virtual void InitialPropagate() {
  // Build active_ structure.
  for (int var_index = 0; var_index < arity_; ++var_index) {
    for (ConstIter<hash_map<int64, uint64*> > it(masks_[var_index]); !it.at_end();
++it) {
      if (!vars_[var_index]->Contains(it->first)) {
        for (int i = 0; i < length_; ++i) {
          active_tuples_[i] &= ~(active_tuples_[i] & it->second[i]);
        }
      }
    }
  }
  (...)
}

Reported by phil.vank on 2011-09-16 06:17:20

@orwant
Copy link
Collaborator Author

orwant commented Aug 5, 2015

I will have a look right away.
Thanks for the bug report.

Reported by laurent.perron on 2011-09-17 08:26:00

@orwant orwant self-assigned this Aug 5, 2015
@orwant
Copy link
Collaborator Author

orwant commented Aug 5, 2015

I have added you suggestion and cleaned up the code around.
Thanks!

Reported by laurent.perron on 2011-09-17 08:49:00

  • Status changed: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants