[SCIP] add constraint x!=y for decision optimization using pyscipopt

Jing GONG jing.gong at gmail.com
Wed Jan 31 08:45:18 CET 2024


Hi,

I am a new user of pyscipopt and try to add a constraint for two integers
with * x!=y *for decision optimization.

As scip  seems to only  "support constraints with '<=', '>=', or '=='", I
could not use model.addCons(x!=y).

If use addConsOr likes

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

there is  "segmentation fault" error.

How can I add constraint for x!=y ?  Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.zib.de/pipermail/scip/attachments/20240131/f50d4529/attachment.html>


More information about the Scip mailing list