'Add a max-constraint to a gurobi minimize in Java

i am trying to implement a maximize constraint to a gurobi minimize problem in java. I am having a MIP with nodes an armlenghts of geometrical objects which i am minimizing by now. What i want to implement is min z(x,y) = max{0, distance(x,y)-1,5), because distance values below 1,5mm are compensable with the screwholes where my modules are screwed together. by now what is implemented is z(x,y) = distance(x,y) (it´s a pretty complex mathematical function and the code has 1000 rows already, if needed i could provide you more information)

Does anybody know how i can implement this max constraint in a minimize problem? thanks in advance



Solution 1:[1]

The max general constraint should do what you want; here is the Java documentation for the max general constraint.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Greg Glockner