411 REFERENCE · Wikibooks
GLPK/Modeling Logical Constraints
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
Logical constraints involving binaries can be modelled as follows
var x, binary;
var y, binary;
var z, binary;
# z = x or y
s.t. c1: x <= z;
s.t. c2: y <= z;
s.t. c3: x + y >= z;
# z = x and y
s.t. c1: x >= z;
s.t. c2: y >= z;
s.t. c3: x + y <= z + 1;
# s = x xor y
# c = x and y
s.t. c1: x + y = 2 * c + s;
# z = not x
s.t. c1: x = 1 - z;