mathematical optimization - Linear constraint with a floor function in Gurobi -
i building milp constraint system. following constraint need build.
floor(a-b) <= 2c - 1
here, , b real-valued. c integer variable. need floor function able assign appropriate values variables. how add constraint in gurobi? appreciated.
assume bounded constant maxa , similarilily let b <= maxb. then, use inequalities
(1): < b + c*maxa
(2): b <= + (1-c)*maxb.
let a>=b, (1) implies c=1, , (2) trivially satisfied, independent on c. otherwise, assume less b , (2) implies c=0 , (1) becomes trivial. (you should skip (2), if want assure a>=b implies c=1, , not care c otherwise.)
Comments
Post a Comment