I’m implementing something from a paper that assumes I have an LP of the following form:
So for each constraint i in my specific model I need to figure out what the vectors u_i, g_i and element b_i are.
I’m able to get the coefficients and RHS of my constraints by normalized_coefficients() and normalized_rhs(), but it seems like the normalized constraints do not convert the inequalities into a single direction: sometimes the constraints are \ge, sometimes \le.
So is there a function that takes in the constraint reference, and returns the inequality direction? So that way I know whether I need to negate the coefficients to find u_i, g_i and b_i.
@constraint(model, c1, 2x + 3 ≤ 5) # Less than or equal to @constraint(model, c2, 4x - 2 ≥ 3) # Greater than or equal to @constraint(model, c3, 5x + 1 == 7) # Equality
Function to get the constraint direction
function get_constraint_direction(con)
set_type = JuMP.constraint_object(con).set
if set_type isa MOI.LessThan
return “≤”
elseif set_type isa MOI.GreaterThan
return “≥”
elseif set_type isa MOI.EqualTo
return “=”
else
return “Unknown Constraint Type”
end
end