Rules of thumb for linear vs boolean constraints

25 views
Skip to first unread message

jed...@seas.upenn.edu

unread,
Jan 25, 2022, 2:34:29 AM1/25/22
to or-tools-discuss
Are there any rules of thumb for guessing which will be be faster to solve (beyond timing it, which is obviously the most useful but I would like an estimate before I refactor a complex model).

Add( sum(literals) >= 1 )     vs     AddBoolOr ( literals )
Add( sum(literals) >= n )     vs     AddBoolAnd ( literals )
Add( sum(literals) == 0 )     vs     AddBoolAnd ( l.Not() for l in literals )
Add( sum(literals)  <  n )     vs     AddBoolOr( l.Not() for l in literals )

Plus when we reify these constraints with OnlyEnforceIf?

Thank you!

Laurent Perron

unread,
Jan 25, 2022, 2:51:14 AM1/25/22
to or-tools-discuss
I believe they are all presolved to the same canonical representation (the Boolean one).
Now for the model, the Boolean representation is much better than the sum().

Sum(literals) == 0 is obviously presolved to forall lit : lit == 0. 
For the reified version, I would use implications.
Laurent Perron | Operations Research | lpe...@google.com | (33) 1 42 68 53 00



--
You received this message because you are subscribed to the Google Groups "or-tools-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/or-tools-discuss/f362b5dd-f783-41ee-8e68-b54354c92b4an%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages