Binary depending on the sign of another variable

65 Views Asked by At

I'm writing a mixed integer linear problem, where I have an indicator function in the objective function counting the instances of negative values of a decision variable. I thought of defining a binary variable that takes the value of 1 when the decision variable, say x, is negative and 0 otherwise. But I couldn't come up with a constraint that would ensure this relation. Do you have any suggestions?