You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using the following call to OSQP via JuMP in Julia:
@variable(m1, x[1:n] >= 0)
@objective(m1, Min, - dot(g,x));
@constraint(m1, sum(m[i]*x[i] for i in 1:n) == 1.0);
@constraint(m1, x'*A*x <= inb) # quadratic constraint
JuMP.optimize!(m1);
c = JuMP.value.(x)
It seems as it cannot handle the quadratic constraint, or am I mistaken? I have tested a bunch of alternative solvers and all works in this setting. But it would be awesome to use OSQP.
Help is much appreciated!
Here is the error message:
ERROR: Constraints of type MathOptInterface.ScalarQuadraticFunction{Float64}-in-MathOptInterface.LessThan{Float64} are not supported by the solver.
If you expected the solver to support your problem, you may have an error in your formulation. Otherwise, consider using a different solver.
The list of available solvers, along with the problem types they support, is available at https://jump.dev/JuMP.jl/stable/installation/#Supported-solvers.
Stacktrace:
error(s::String) at [error.jl](vscode-file://vscode-app/c:/Users/joah/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-sandbox/workbench/workbench.html)
_moi_add_constraint(model::MathOptInterface.Utilities.CachingOptimizer{…}, f::MathOptInterface.ScalarQuadraticFunction{…}, s::MathOptInterface.LessThan{…}) at [constraints.jl](vscode-file://vscode-app/c:/Users/joah/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-sandbox/workbench/workbench.html)
add_constraint(model::Model, con::ScalarConstraint{QuadExpr, MathOptInterface.LessThan{Float64}}, name::String) at [constraints.jl](vscode-file://vscode-app/c:/Users/joah/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-sandbox/workbench/workbench.html)
macro expansion at [@constraint.jl](vscode-file://vscode-app/c:/Users/joah/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-sandbox/workbench/workbench.html)
macro expansion at [macros.jl](vscode-file://vscode-app/c:/Users/joah/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-sandbox/workbench/workbench.html)
OC2(A::Matrix{Float64}, g::Vector{Float64}, m::Vector{Float64}, n::Int64, inb::Float64) at [JumpOSQPPortFact_ptae926.jl](vscode-file://vscode-app/c:/Users/joah/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-sandbox/workbench/workbench.html)
top-level scope at [JumpOSQPPortFact_ptae926.jl](vscode-file://vscode-app/c:/Users/joah/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-sandbox/workbench/workbench.html)
Some type information was truncated. Use show(err) to see complete types.
ERROR: Constraints of type MathOptInterface.ScalarQuadraticFunction{Float64}-in-MathOptInterface.LessThan{Float64} are not supported by the solver.
If you expected the solver to support your problem, you may have an error in your formulation. Otherwise, consider using a different solver.
The list of available solvers, along with the problem types they support, is available at https://jump.dev/JuMP.jl/stable/installation/#Supported-solvers.
Stacktrace:
error(s::String) at [error.jl](vscode-file://vscode-app/c:/Users/joah/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-sandbox/workbench/workbench.html)
_moi_add_constraint(model::MathOptInterface.Utilities.CachingOptimizer{…}, f::MathOptInterface.ScalarQuadraticFunction{…}, s::MathOptInterface.LessThan{…}) at [constraints.jl](vscode-file://vscode-app/c:/Users/joah/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-sandbox/workbench/workbench.html)
add_constraint(model::Model, con::ScalarConstraint{QuadExpr, MathOptInterface.LessThan{Float64}}, name::String) at [constraints.jl](vscode-file://vscode-app/c:/Users/joah/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-sandbox/workbench/workbench.html)
macro expansion at [@constraint.jl](vscode-file://vscode-app/c:/Users/joah/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-sandbox/workbench/workbench.html)
macro expansion at [macros.jl](vscode-file://vscode-app/c:/Users/joah/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-sandbox/workbench/workbench.html)
OC2(A::Matrix{Float64}, g::Vector{Float64}, m::Vector{Float64}, n::Int64, inb::Float64) at [JumpOSQPPortFact_ptae926.jl](vscode-file://vscode-app/c:/Users/joah/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-sandbox/workbench/workbench.html)
top-level scope at [JumpOSQPPortFact_ptae926.jl](vscode-file://vscode-app/c:/Users/joah/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-sandbox/workbench/workbench.html)
Some type information was truncated. Use show(err) to see complete types.
The text was updated successfully, but these errors were encountered:
OSQP does not currently support quadratic constraints, it is only a solver for linearly constrained quadratic programs, not quadratically constrained quadratic programs.
Hi,
I am using the following call to OSQP via JuMP in Julia:
It seems as it cannot handle the quadratic constraint, or am I mistaken? I have tested a bunch of alternative solvers and all works in this setting. But it would be awesome to use OSQP.
Help is much appreciated!
Here is the error message:
The text was updated successfully, but these errors were encountered: