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

log operator #369

Open
ott2 opened this issue Jul 6, 2017 · 3 comments
Open

log operator #369

ott2 opened this issue Jul 6, 2017 · 3 comments

Comments

@ott2
Copy link
Collaborator

ott2 commented Jul 6, 2017

To express graph connectivity of n-vertex graphs using adjacency matrices, we need to compute \log_2 n as one of the dimensions of an auxiliary matrix. Usually n is given as part of the instance, but we need something like

letting s be log2(n)
find A : matrix indexed by [0..s] of ...

or

letting s be such that (2**s <= n) /\ (2**(s+1) > n)
find A : matrix indexed by [0..s] of ...

to compute the size of the dimension at declaration time.

@ott2
Copy link
Collaborator Author

ott2 commented Jul 6, 2017

Workaround due to Pete Nightingale:

letting s be sum([1 | i : int(0..64), 2**i <= n])

@ozgurakgun
Copy link
Collaborator

Are you after log2 only? I assume this does not need to work on decision variables?

@ott2
Copy link
Collaborator Author

ott2 commented Jun 14, 2019

I was just wanting a built-in log2() operator for letting statements. If we add a log operator for decision variables, then Conjure would have to support things like

find x : int such that 2**x = 16
find y : int such that log2(y) = 4

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

No branches or pull requests

2 participants