Here is a mini-case of my mathematical model.
First, solve the initial model, and check if the solution meets the condition. If it does not, the new constraints will be added, and solve the new model.
But there are some problems in this process:
- Use Mosek as solver, when only add linear constraints (Con1), the new model can be solved, and the final optimal value is 0.5;
- Use Mosek as solver, when the adding constraints include SOCP constraints (Con2), Mosek won’t resolve the new model, it will just keep the solution of initial model (the optimal value of initial model is 1).
- Use other solvers, e.g. Gurobi, when the adding constraints include SOCP constraints, the new model can be solved, and the final optimal value is about 0.25.
In conclusion, Mosek can not resolve the new model, when the added new constraints include SOCP constraints.
using JuMP, MosekTools, Gurobi
model = Model(Gurobi.Optimizer)
#model = Model(Mosek.Optimizer)
@variable(model, x)
@variable(model, y)
@objective(model, Max, x)
@constraint(model, x <= 1)
@constraint(model, y <= 1)
optimize!(model)
println("objective value:", objective_value(model))
#check if we need to add new constraints
x_val = value.(x)
if x_val >=0.5
@constraint(model, x <= 0.5) #Con1
@constraint(model, [y; 4x] in SecondOrderCone()) #Con2
end
optimize!(model)
println("objective value:", objective_value(model))
Could someone give me some ideas on how this problem comes? And how to solve the problem?
Thanks!
P.S. the problem has also been posted on GitHub
https://github.com/jump-dev/MosekTools.jl/issues/70#issue-941248863