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

Idea: Optimize operations on bools #97

Open
pvdz opened this issue Jun 29, 2016 · 0 comments
Open

Idea: Optimize operations on bools #97

pvdz opened this issue Jun 29, 2016 · 0 comments

Comments

@pvdz
Copy link
Contributor

pvdz commented Jun 29, 2016

When inspecting the configuration of a large case (20k+ constraints) the vars are often boolean bound (or at otherwise have an upper bound of about 5). We have a lot of code intended to be generic, but maybe it would pay off to handle boolean cases explicitly.

We already have "small" domains, represented as bitwise flags, this already helps considerably. We could simply compare domain === ONE and act accordingly. For example, the eq([0, 1], [1, 1]) could be handled with a table. Now this is a bad example because eq on small domains is dealt with through binary AND-ing. But the point is that not all propagators can get away with bitwise shortcuts. For them a simply solution table for booleans could make a lot of difference.

  • It also may not if it turns out the small domains already save most of this
  • Any boolean bound domain should be a number, which can be compared to constants (EMPTY ZERO ONE BOOL) which is much faster than what arrays used to do. Simple lookup tables can lead to O(1) solutions for propagation steps, for insofar they aren't already.
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

1 participant