get "Segmentation fault" when use pyscipopt addConsOr

16 views Asked by At

I tried to use pyscipopt addConsOr but got Segmentation fault error. I want to add a constraint for two integers with x != y. If use

    x = model.addVar("x", "I")
    y = model.addVar("y", "I")
    model.addCons(x != y)

there is an error message,

NotImplementedError: Can only support constraints with '<=', '>=', or '=='.

If use addConsOr to implement x != y, there is "Segmentation fault" error.

   x = model.addVar("x", "I")
   y = model.addVar("y", "I")
   r = model.addVar("r", "B")
   model.addConsOr([x>=y+1, x<=y-1],r)

How can I fix the error? Is there any better way to add constraint for x != y ? Thanks.

0

There are 0 answers