Hi, I have just tried to use OSQP solver in Julia for a LP and noted that it frequently violates variable bounds and constraints. I know that this solver is intended for QP, but on this link it suggests that it can be used for LP as well: https://www.juliaopt.org/JuMP.jl/stable/installation/
I have given my code, and output.
Please could you advise how to ensure that variable bounds and constraints are not violated?
using JuMP, OSQP, LinearAlgebra
function Optimizer(Cost,Demand,Production)
model = Model(OSQP.Optimizer)
@variable(model, 0<= x[b = 1:5])
@objective(model,Min,sum(Cost[i]*x[i] for i=1:5))
@constraint(model, Production*x .>= Demand)
optimize!(model)
return JuMP.value.(x), println("Answer = ",JuMP.value.(x))
end
Cost = [99.74, 91.22, 98.71, 103.75,97.15]'
Production= [4 4 4 4 4 4 4 104; 5 5 5 5 5 5 105 0; 2.5 2.5 2.5 2.5 102.5 0 0 0; 5 5 5 5 5 105 0 0; 4 4 4 4 4 104 0 0]'
Demand= [5000, 7000, 7000, 6000, 8000, 7000, 2000, 1000]
Results = Optimizer(Cost,Demand,Production)
Answer = [9.264372775061187, 1388.0376416427164, 9.73315660695938, -0.07465346435688373, -0.00297960504755646]