Closed kangshuo1 closed 6 months ago
Hi @kangshuo1, clog2 as a constraint on a random variable/expression is typically implemented by the solver. We can implement a simple (likely slower) version using PyVSC's ability to generate constraints procedurally. The thing to remember is that clog2 is answering the question "how many bits is required to represent N value combinations?".
I added a small test to implement the clog2 constraint here:
If you're finding that you need the clog2 constraint, please add an enhancement request for PyVSC to implement this.
-Matthew
Thanks for your reply, it's very helpful to me
Hello! I'm wondering if there is a way to construct a constraint that expresses a logarithmic relationship. Such as
@vsc.constraint def ab_c(self): self.a == vsc.clog2(self.b)
Can this function be implemented based on existing models? Looking forward to your reply