Access infeasible optimization results ( GLPK with semicontinuous variable )

Hi all,

I have a question regarding accessing infeasible optimization results.

For example, the following optimization does not have a feasible solution. However, despite the infeasibility, it is still able to give the value of x and y.

model = Model()
set_optimizer(model, GLPK.Optimizer)
@variable(model, x >= 6.0)
@variable(model, y >= 6.0)
@objective(model, Max, 2* x + y )
@constraint(model, x+y <= 11.0)
@constraint(model, x  >= 1.0)
optimize!(model)
value.(x)

When there is a semicontinuous variable, it returns the following errors when I was trying to get the variable value.

image (14)

model = Model()
set_optimizer(model, GLPK.Optimizer)
@variable(model, x in MOI.Semicontinuous(6.0, 12.0))
@variable(model, y >= 6.0)
@objective(model, Max, 2* x + y )
@constraint(model, x  >= 1.0)
@constraint(model, x+y <= 11.0)
optimize!(model)
value.(y)

Can someone help me to understand why I am able to get “comprised” results when there is no feasible solution? However, when I use semicontinuous variables, I cannot get the value of those variables?

Thank you very much in advance.

Read Solutions · JuMP

You need to check the solution statuses.

1 Like

It depends on the solvers, but some revert to minimizing the constraint violation when they detect that the problem is infeasible. In this case, the point that you retrieve may be a minimizer of the constraint violation.

2 Likes

To be clear, you should never rely on a solver returning an infeasible point, or that the infeasible point represents some minimal constraint violation.

The correct way to handle this is to use the status reporting mechanisms.

if termination_status(model) == MOI.INFEASIBLE
    if primal_status(model) == MOI.NO_SOLUTION
        # No solution is available. Calling `value(x)` may thrown an error or return arbitrary values.
    elseif primal_status(model) == MOI.INFEASIBLE_POINT
        # We know only that the point is infeasible. There are no guarantees of quality.
    end
end
1 Like

Thank you very much for your explanation. Despite the infeasibility, it sometimes is helpful to be able to get points where minimize the constraint violation. However, when I use semicontinuous variables, it seems that I cannot get the values.

Hi, oscar,

Thank you very much for your reply!

I understand that we should not rely on infeasible results, however, it sometimes really helpful to be able to obtain minimal constraint violation points. It really helps me to further analyze the problem.

Is there any way I can obtain the “minimal constraint violation point” when I have semicontinuous variables?

Thank you very much,

Best regards,

Is there any way I can obtain the “minimal constraint violation point” when I have semicontinuous variables?

Formulate a new optimization problem, where you add slack variables to the constraints and minimize their sum.

2 Likes