I am trying to do some copositivity detection using a MILP with which I find an optimal solution as expected. However, solution_summary()
says that no solution exists. Here is an MWE:
using JuMP
using CPLEX
function mymain()
# params
n = 3
Q = [1 -1 0; -1 1 1; 0 1 0]
# model
model = JuMP.direct_model( CPLEX.Optimizer() )
@variable(model, x[i=1:n] >= 0)
@variable(model, y[i=1:n], Bin)
@variable(model, λ >= 0)
@objective(model, Max, λ)
@constraint( model, lambdaUB[i=1:n], sum( Q[i,:][j] * x[j] for j in 1:n) <= -λ + 100 * (1-y[i]) )
@constraint( model, xUB[i=1:n], x[i] <= y[i])
@constraint( model, lambdaLB, sum(y) >= 1)
# solve
optimize!(model)
# solution summary
println("termination status: ", termination_status(model))
println("xvals: ", value.(x))
println("yvals: ", value.(y))
println("λ: ", value.(λ))
solution_summary(model) # returns CPLEX Error 1217: No solution exists.
return
end
mymain()
with the output:
termination status: OPTIMAL
xvals: [0.0, 0.0, 0.0]
yvals: [1.0, 0.0, 0.0]
λ: 0.0
CPLEX Error 1217: No solution exists.
CPLEX Error 1217: No solution exists.
It took me some time to realize that the model works as expected given only the output from solution_summary()
. Is the output of the latter function an expected result?