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

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -