Giter Site home page Giter Site logo

osqp.jl's People

Contributors

blegat avatar bstellato avatar gbanjac avatar goretkin avatar imciner2 avatar kerrysnyder avatar kristofferc avatar lostella avatar matbesancon avatar migarstka avatar mlubin avatar odow avatar rdeits avatar tkoolen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

osqp.jl's Issues

Segfault when calling dimensions on Model before setup

julia> using OSQP

julia> m = OSQP.Model()
OSQP.Model(Ptr{OSQP.Workspace} @0x0000000000000000)

julia> OSQP.dimensions(m)

signal (11): Segmentation fault: 11
while loading no file, in expression starting on line 0
dimensions at /Users/twan/code/julia/RigidBodyDynamics/v0.6/OSQP/src/interface.jl:514
unknown function (ip: 0x11ce28e7f)
do_call at /Users/osx/buildbot/slave/package_osx64/build/src/interpreter.c:75
eval at /Users/osx/buildbot/slave/package_osx64/build/src/interpreter.c:242
jl_interpret_toplevel_expr at /Users/osx/buildbot/slave/package_osx64/build/src/interpreter.c:34
jl_toplevel_eval_flex at /Users/osx/buildbot/slave/package_osx64/build/src/toplevel.c:577
jl_toplevel_eval_in at /Users/osx/buildbot/slave/package_osx64/build/src/builtins.c:496
eval at /Applications/Julia-0.6.app/Contents/Resources/julia/lib/julia/sys.dylib (unknown line)
jlcall_eval_18039 at /Applications/Julia-0.6.app/Contents/Resources/julia/lib/julia/sys.dylib (unknown line)
eval_user_input at /Applications/Julia-0.6.app/Contents/Resources/julia/lib/julia/sys.dylib (unknown line)
jlcall_eval_user_input_20366 at /Applications/Julia-0.6.app/Contents/Resources/julia/lib/julia/sys.dylib (unknown line)
macro expansion at ./REPL.jl:97 [inlined]
#1 at ./event.jl:73
unknown function (ip: 0x11cdf344f)
jl_apply at /Users/osx/buildbot/slave/package_osx64/build/src/./julia.h:1424 [inlined]
start_task at /Users/osx/buildbot/slave/package_osx64/build/src/task.c:267
Allocations: 5426407 (Pool: 5424867; Big: 1540); GC: 10
Segmentation fault: 11
tk-sloth:OSQP twan$ 

Arm-Linux support

I'd like to run OSQP.jl on a raspberry pi 4. I've confirmed that the osqp c libraries compile correctly on arm-linux, but this julia wrapper doesn't seem to support arm-linux because there are no corresponding c libraries hosted on the https://dl.bintray.com/bstellato/generic/OSQP/ repository. Would it be possible to add the arm-linux binaries to your hosting website? I can provide the .a and .so files if necessary. Thanks!

incorrect statuses in infeasibility case

In the case of dual infeasibility, the primal is the infeasibility certificate. The dual is reported as a certificate, but it cannot be:
https://github.com/oxfordcontrol/OSQP.jl/blob/8dd46b5a7c8955ae41cf8464295825801946e939/src/MOI_wrapper.jl#L555-L561

Same thing applies in the case of primal infeasibility:
https://github.com/oxfordcontrol/OSQP.jl/blob/8dd46b5a7c8955ae41cf8464295825801946e939/src/MOI_wrapper.jl#L537-L543

We could return either NO_SOLUTION or INFEASIBLE_POINT in this case, depending on what OSQP says about these solutions.

Inconsistent solves

Hello, I have having an interesting problem with the solver right now on an MPC problem with linear dynamics. I am running individual experiments with differing P matrices (using the notation in the OSQP documentation), and it appears that the solver sometimes fails once, and then if I run the exact same experiment again, it solves correctly. When it fails, the result.info object is something like
result.info = OSQP.Info(1, :Solved, 1, -1, NaN, 0.0, 0.0, 0.000932652, 3.6558e-5, 0.0, 9.4218e-5, 0.00013077599999999998, 0, 6.95217905699025e-310).

As can be seen, the info.obj_val is NaN, and there have been times when I run the exact same experiment again, and the solver works perfectly. I also occasionally get the :Non_convex flag, but not nearly as often. I am performing the old L * tranpose(L) trick to ensure that the P matrix is indeed positive semidefinite, and it is not quite yet clear to me why this happens sometimes and works other times when running the exact same experiment. Let me know what information I can provide so we can troubleshoot.

Thanks!

Should P be upper triangular

I am solving a problem using both the C interface and OSQP.jl.

In the C interface I only pass in the upper triangular portion of P as required.

The only way I can get my C solution and OSQP.jl solution to match is if I only pass in the upper triangular part of P into OSQP.jl.

This is contradictory to how some of the tests in the test directory are written (specifically primal_infeasibility.jl where an arbitrary symmetric matrix is passed in as opposed to just the upper triangular portion.

What is the correct way to pass P into OSQP.jl? If only the upper triangular part needs to be passed it would be good to call this out in the documentation.

memory management

This wrapper is vulnerable to the same sort of memory corruption that we just fixed in ECOS.jl and SCS.jl (not your fault for copying them).

For example:

  • Ccsc keeps pointers to arrays that could be freed at any time.
  • pointer([Pcsc]) here is bad. The array [Pscs] can be garbage collected at any moment after the pointer call.

In general, you have to make sure that you maintain a reference to the Julia object for at least as long as the Ptr is used.

Error when install.

My conputer run Mac OS 10.14.5.
I cann't install OSQP when run
julia> Pkg.build("OSQP")
the output is:
Building OSQP → ~/.juliapro/JuliaPro_v1.1.1.1/packages/OSQP/FaA6U/deps/build.log
┌ Error: Error building OSQP:
│ % Total % Received % Xferd Average Speed Time Time Time Current
│ Dload Upload Total Spent Left Speed
100 64 100 64 0 0 34 0 0:00:01 0:00:01 --:--:-- 34
│ % Total % Received % Xferd Average Speed Time Time Time Current
│ Dload Upload Total Spent Left Speed
100 64 100 64 0 0 2 0 0:00:32 0:00:21 0:00:11 14
│ % Total % Received % Xferd Average Speed Time Time Time Current
│ Dload Upload Total Spent Left Speed
100 64 100 64 0 0 68 0 --:--:-- --:--:-- --:--:-- 68
│ % Total % Received % Xferd Average Speed Time Time Time Current
│ Dload Upload Total Spent Left Speed
100 64 100 64 0 0 27 0 0:00:02 0:00:02 --:--:-- 27
│ ┌ Warning: platform_key() is deprecated, use platform_key_abi() from now on
│ │ caller = ip:0x0
│ └ @ Core :-1
│ ┌ Warning: Could not extract the platform key of https://dl.bintray.com/bstellato/generic/OSQP/0.5.0/osqp-0.5.0-mac64.tar.gz; continuing...
│ └ @ BinaryProvider /Users/vagrant/worker/juliapro-release-osx1011-0_6/build/tmp_julia/Julia-1.1.app/Contents/Resources/julia/share/julia/stdlib/v1.1/BinaryProvider/src/Prefix.jl:185
│ ERROR: LoadError: HTTP.ExceptionRequest.StatusError(401, HTTP.Messages.Response:
│ """
│ HTTP/1.1 401 Unauthorized
│ Server: nginx
│ Date: Mon, 22 Jul 2019 12:30:00 GMT
│ Content-Length: 0
│ Connection: keep-alive

│ """)
│ Stacktrace:
│ [1] #request#1 at /Users/vagrant/worker/juliapro-release-osx1011-0_6/build/tmp_julia/Julia-1.1.app/Contents/Resources/julia/share/julia/stdlib/v1.1/HTTP/src/ExceptionRequest.jl:22 [inlined]
│ [2] (::getfield(HTTP, Symbol("#kw##request")))(::NamedTuple{(:iofunction,),Tuple{getfield(CredentialsHandler, Symbol("##1#3")){String}}}, ::typeof(HTTP.request), ::Type{HTTP.ExceptionRequest.ExceptionLayer{HTTP.ConnectionRequest.ConnectionPoolLayer{HTTP.StreamRequest.StreamLayer}}}, ::HTTP.URIs.URI, ::HTTP.Messages.Request, ::Nothing) at ./none:0
│ [3] (::getfield(Base, Symbol("###48#49#50")){ExponentialBackOff,getfield(HTTP.RetryRequest, Symbol("##2#3")){Bool,HTTP.Messages.Request},typeof(HTTP.request)})(::Base.Iterators.Pairs{Symbol,getfield(CredentialsHandler, Symbol("##1#3")){String},Tuple{Symbol},NamedTuple{(:iofunction,),Tuple{getfield(CredentialsHandler, Symbol("##1#3")){String}}}}, ::Function, ::Type, ::Vararg{Any,N} where N) at ./error.jl:231
│ [4] ##48#51 at ./none:0 [inlined]
│ [5] #request#1 at /Users/vagrant/worker/juliapro-release-osx1011-0_6/build/tmp_julia/Julia-1.1.app/Contents/Resources/julia/share/julia/stdlib/v1.1/HTTP/src/RetryRequest.jl:44 [inlined]
│ [6] (::getfield(HTTP, Symbol("#kw##request")))(::NamedTuple{(:iofunction,),Tuple{getfield(CredentialsHandler, Symbol("##1#3")){String}}}, ::typeof(HTTP.request), ::Type{HTTP.RetryRequest.RetryLayer{HTTP.ExceptionRequest.ExceptionLayer{HTTP.ConnectionRequest.ConnectionPoolLayer{HTTP.StreamRequest.StreamLayer}}}}, ::HTTP.URIs.URI, ::HTTP.Messages.Request, ::Nothing) at ./none:0
│ [7] #request#1(::VersionNumber, ::String, ::Nothing, ::Function, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Type{HTTP.MessageRequest.MessageLayer{HTTP.RetryRequest.RetryLayer{HTTP.ExceptionRequest.ExceptionLayer{HTTP.ConnectionRequest.ConnectionPoolLayer{HTTP.StreamRequest.StreamLayer}}}}}, ::String, ::HTTP.URIs.URI, ::Array{Pair{SubString{String},SubString{String}},1}, ::Nothing) at /Users/vagrant/worker/juliapro-release-osx1011-0_6/build/tmp_julia/Julia-1.1.app/Contents/Resources/julia/share/julia/stdlib/v1.1/HTTP/src/MessageRequest.jl:47
│ [8] (::getfield(HTTP, Symbol("#kw##request")))(::NamedTuple{(:iofunction,),Tuple{getfield(CredentialsHandler, Symbol("##1#3")){String}}}, ::typeof(HTTP.request), ::Type{HTTP.MessageRequest.MessageLayer{HTTP.RetryRequest.RetryLayer{HTTP.ExceptionRequest.ExceptionLayer{HTTP.ConnectionRequest.ConnectionPoolLayer{HTTP.StreamRequest.StreamLayer}}}}}, ::String, ::HTTP.URIs.URI, ::Array{Pair{SubString{String},SubString{String}},1}, ::Nothing) at ./none:0
│ [9] #request#1(::Int64, ::Bool, ::Base.Iterators.Pairs{Symbol,getfield(CredentialsHandler, Symbol("##1#3")){String},Tuple{Symbol},NamedTuple{(:iofunction,),Tuple{getfield(CredentialsHandler, Symbol("##1#3")){String}}}}, ::Function, ::Type{HTTP.RedirectRequest.RedirectLayer{HTTP.MessageRequest.MessageLayer{HTTP.RetryRequest.RetryLayer{HTTP.ExceptionRequest.ExceptionLayer{HTTP.ConnectionRequest.ConnectionPoolLayer{HTTP.StreamRequest.StreamLayer}}}}}}, ::String, ::HTTP.URIs.URI, ::Array{Pair{SubString{String},SubString{String}},1}, ::Nothing) at /Users/vagrant/worker/juliapro-release-osx1011-0_6/build/tmp_julia/Julia-1.1.app/Contents/Resources/julia/share/julia/stdlib/v1.1/HTTP/src/RedirectRequest.jl:24
│ [10] (::getfield(HTTP, Symbol("#kw##request")))(::NamedTuple{(:iofunction,),Tuple{getfield(CredentialsHandler, Symbol("##1#3")){String}}}, ::typeof(HTTP.request), ::Type{HTTP.RedirectRequest.RedirectLayer{HTTP.MessageRequest.MessageLayer{HTTP.RetryRequest.RetryLayer{HTTP.ExceptionRequest.ExceptionLayer{HTTP.ConnectionRequest.ConnectionPoolLayer{HTTP.StreamRequest.StreamLayer}}}}}}, ::String, ::HTTP.URIs.URI, ::Array{Pair{SubString{String},SubString{String}},1}, ::Nothing) at ./none:0
│ [11] #request#5(::Base.Iterators.Pairs{Symbol,getfield(CredentialsHandler, Symbol("##1#3")){String},Tuple{Symbol},NamedTuple{(:iofunction,),Tuple{getfield(CredentialsHandler, Symbol("##1#3")){String}}}}, ::Function, ::String, ::HTTP.URIs.URI, ::Array{Pair{SubString{String},SubString{String}},1}, ::Nothing) at /Users/vagrant/worker/juliapro-release-osx1011-0_6/build/tmp_julia/Julia-1.1.app/Contents/Resources/julia/share/julia/stdlib/v1.1/HTTP/src/HTTP.jl:300
│ [12] #request at ./none:0 [inlined]
│ [13] #request#6 at /Users/vagrant/worker/juliapro-release-osx1011-0_6/build/tmp_julia/Julia-1.1.app/Contents/Resources/julia/share/julia/stdlib/v1.1/HTTP/src/HTTP.jl:314 [inlined]
│ [14] #request at ./none:0 [inlined]
│ [15] #open#7 at /Users/vagrant/worker/juliapro-release-osx1011-0_6/build/tmp_julia/Julia-1.1.app/Contents/Resources/julia/share/julia/stdlib/v1.1/HTTP/src/HTTP.jl:339 [inlined]
│ [16] open at /Users/vagrant/worker/juliapro-release-osx1011-0_6/build/tmp_julia/Julia-1.1.app/Contents/Resources/julia/share/julia/stdlib/v1.1/HTTP/src/HTTP.jl:339 [inlined]
│ [17] download at /Users/vagrant/worker/juliapro-release-osx1011-0_6/build/tmp_julia/Julia-1.1.app/Contents/Resources/julia/share/julia/stdlib/v1.1/CredentialsHandler/src/CredentialsHandler.jl:89 [inlined] (repeats 2 times)
│ [18] (::getfield(BinaryProvider.JuliaTeam, Symbol("##1#2")){getfield(BinaryProvider, Symbol("##49#72"))})(::String, ::String) at /Users/vagrant/worker/juliapro-release-osx1011-0_6/build/tmp_julia/Julia-1.1.app/Contents/Resources/julia/share/julia/stdlib/v1.1/BinaryProvider/src/JuliaTeam.jl:18
│ [19] #download#93(::Bool, ::Function, ::String, ::String) at /Users/vagrant/worker/juliapro-release-osx1011-0_6/build/tmp_julia/Julia-1.1.app/Contents/Resources/julia/share/julia/stdlib/v1.1/BinaryProvider/src/PlatformEngines.jl:494
│ [20] #download at ./none:0 [inlined]
│ [21] #download_verify#94(::Bool, ::Bool, ::Bool, ::Function, ::String, ::String, ::String) at /Users/vagrant/worker/juliapro-release-osx1011-0_6/build/tmp_julia/Julia-1.1.app/Contents/Resources/julia/share/julia/stdlib/v1.1/BinaryProvider/src/PlatformEngines.jl:595
│ [22] #download_verify at ./none:0 [inlined]
│ [23] #install#133(::Prefix, ::String, ::Bool, ::Bool, ::Bool, ::Function, ::String, ::String) at /Users/vagrant/worker/juliapro-release-osx1011-0_6/build/tmp_julia/Julia-1.1.app/Contents/Resources/julia/share/julia/stdlib/v1.1/BinaryProvider/src/Prefix.jl:314
│ [24] (::getfield(BinaryProvider, Symbol("#kw##install")))(::NamedTuple{(:prefix, :force, :verbose),Tuple{Prefix,Bool,Bool}}, ::typeof(install), ::String, ::String) at ./none:0
│ [25] top-level scope at /Users/liaoqiayuan/.juliapro/JuliaPro_v1.1.1.1/packages/OSQP/FaA6U/deps/build.jl:55
│ [26] include_relative(::Module, ::String) at /Applications/JuliaPro-1.1.1.1.app/Contents/Resources/julia/Contents/Resources/julia/lib/julia/sys.dylib:?
│ [27] include(::Module, ::String) at /Applications/JuliaPro-1.1.1.1.app/Contents/Resources/julia/Contents/Resources/julia/lib/julia/sys.dylib:?
│ [28] include(::String) at ./client.jl:403
│ [29] top-level scope at none:0
│ in expression starting at /Users/liaoqiayuan/.juliapro/JuliaPro_v1.1.1.1/packages/OSQP/FaA6U/deps/build.jl:48
└ @ Pkg.Operations /Users/vagrant/worker/juliapro-release-osx1011-0_6/build/tmp_julia/Julia-1.1.app/Contents/Resources/julia/share/julia/stdlib/v1.1/Pkg/src/Operations.jl:1138

Throw error if model tries to copy unsupported MOI-Attributes

At the moment the OSQP-MOI-Wrapper only processes some MOI - Attributes, e.g. ObjectiveSense, VariablePrimalStart, ConstraintDualStart, and every attribute, unknown to OSQP, is ignored.

For example the following example wouldn't produce an error:

using OSQP
using OSQP.MathOptInterfaceOSQP
using LinearAlgebra
using Random
using SparseArrays
using Test

using MathOptInterface
const MOI = MathOptInterface
const MOIT = MOI.Test
const MOIU = MOI.Utilities
const Affine = MOI.ScalarAffineFunction{Float64}

model = MOIU.UniversalFallback(MOIU.UniversalFallback(OSQPModel{Float64}()));
optimizer = OSQP.Optimizer()
# define any example problem
x = MOI.add_variable(model)
y = MOI.add_variable(model)
cf = MOI.ScalarAffineFunction{Float64}(MOI.ScalarAffineTerm{Float64}.([1., 1.], [x, y]), 0.)
c = MOI.add_constraint(model, cf, MOI.LessThan(0.))
# define an unknown model attribute 
struct UnsupportedModelAttribute  <: MOI.AbstractModelAttribute end
MOI.set(model, UnsupportedModelAttribute(), 0.)
# the attribute gets ignored during copy_to
@test_throws MOI.UnsupportedAttribute{UnsupportedModelAttribute} MOI.copy_to(optimizer, model);

This can lead to problems if the user falsely believes that a provided attribute got copied.

In this example the user uses the wrong macro @NLobjective instead of @objective to define the objective function (notice that I swapped COSMO with OSQP):

using LinearAlgebra, OSQP, JuMP

X=[1 1; 1 2; 2 2 ];
y=[+1 -1 -1 ];
n=length(y);
p=size(X,2);
G=X*X';

model = Model(with_optimizer(OSQP.Optimizer))    
@variables model begin
  alpha[i=1:length(y)] 
end  
@NLobjective(model, Min, sum(0.5*alpha[k]*G[k,i]*y[k]*y[i]*alpha[i] -alpha[k] for i=1:n for k=1:n))
@constraint(model, sum( y[i] * alpha[i] for i=1:n ) == 0)
@constraint(model, [i=1:n], -alpha[i]<=0)
optimize!(model);   

The @NLobjective leads to an attribute NLPblock in the underlying MOI model, which is ignored during copy_to. Instead of throwing an error, OSQP solves the problem as a feasibility problem with P=0 q=0. For the user it is not obvious why the solver doesn't return the expected result.

I would suggest to loop over all the model-, variable- and constraint-attributes in the model and throw an error or warning if one of them is not supported.

It could be done in a similar way to how I fixed the same behaviour in COSMO:
oxfordcontrol/COSMO.jl@39d7bc1

Support for MOI 1

OSQP currently pins MOI to 0.10.3. A few days ago, MOI as reached 1.0. It would be great to support MOI 1.0 within OSQP and adjust the compat bounds accordingly.

OSQP.solve! type inference issues

Thanks for the package, excited to try it!

I found two small issues with the code_warntype for OSQP.solve!:

using OSQP, Base.Test
include(Pkg.dir("OSQP", "test", "basic.jl"))
problem, options = setup_basic()
model = OSQP.Model()
OSQP.setup!(model; P=problem[:P], q=problem[:q], A=problem[:A], l=problem[:l], u=problem[:u], options...)
@code_warntype OSQP.solve!(model)

shows two problems:

  1. The return type of OSQP.solve is inferred as Union{OSQP.Results, Void}
  2. A temporary variable stemming from https://github.com/oxfordcontrol/OSQP.jl/blob/28067ad4489314d729ab04cf7ea0feb6ff07d11c/src/interface.jl#L196 is inferred as Any.

PR with fix incoming.

🏴‍☠️ Remove type piracy 🏴‍☠️

Please don't do this:

# FIXME: type piracy. Needs https://github.com/jump-dev/MathOptInterface.jl/issues/1310
function MOI.get(optimizer::MOIU.CachingOptimizer, attr::MOI.ConstraintPrimal, ci::MOI.ConstraintIndex)
# FIXME `get_fallback` should do this first line
MOI.check_result_index_bounds(optimizer, attr)
return MOI.Utilities.get_fallback(optimizer, attr, ci)
end

Not sure why it's implemented, but we're considering something similar: jump-dev/MathOptInterface.jl#1310

OSQP v0.6.0 can't be installed

The link for the OSQP version 0.6.0 is broken

ERROR: Error building `OSQP`: 
ERROR: LoadError: HTTP/1.1 403 Forbidden while requesting https://dl.bintray.com/bstellato/generic/OSQP/0.6.0/osqp-0.6.0-linux64.tar.gz.sha256

This is relevant since #94 is still a problem.

Constraints relaxation

Hello!

I have an optimization problem with variables belonging to [0,1] and an objective whose convexity depends on the non-negativity of the aforementioned variables. Unfortunately, it seems that the solver relaxes the constraints resulting in an error since the objective becomes non-convex.

Is there a way to prevent this from happening? to force the solver to respect some constraints?

New version

What do you think of releasing a new version of OSQP.jl with MOI support ? Would you prefere v0.5.1 or v0.6.0 ?

passing verbose option

It seems that the option passing from JuMP might be broken. The instructions here https://osqp.org/docs/parsers/jump.html?highlight=verbose are outdated but I have been trying to use the same configuration used by other solvers.

using JuMP
using OSQP
OSQP_optimizer = JuMP.with_optimizer(OSQP.Optimizer, verbose = false)
m = Model(OSQP_optimizer)

And this other alternative

OSQP_optimizer = JuMP.with_optimizer(OSQP.Optimizer, settings = Dict(:verbose => false))
m = Model(OSQP_optimizer)

It returns an unsupported keyword error in both cases.

MethodError: no method matching OSQP.MathOptInterfaceOSQP.Optimizer(; settings=Dict(:verbose=>false))
Closest candidates are:
  OSQP.MathOptInterfaceOSQP.Optimizer() at /Users/jdlara/.julia/packages/OSQP/H4U2v/src/MOI_wrapper.jl:76 got unsupported keyword argument "settings"

OSQP segmentation fault with MOI.Test.test_model_copy_to_UnsupportedConstraint

See https://github.com/osqp/OSQP.jl/runs/5384596071?check_suite_focus=true#step:6:512

signal (11): Segmentation fault
in expression starting at /home/blegat/.julia/dev/OSQP/test/MOI_wrapper.jl:539
csc_spfree at /home/blegat/.julia/artifacts/c5f30b0b864e1623da3a7dc4d445e37ab3c33e8b/lib/libosqp.so (unknown line)
osqp_cleanup at /home/blegat/.julia/artifacts/c5f30b0b864e1623da3a7dc4d445e37ab3c33e8b/lib/libosqp.so (unknown line)
clean! at /home/blegat/.julia/dev/OSQP/src/interface.jl:224
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1788 [inlined]
run_finalizer at /buildworker/worker/package_linux64/build/src/gc.c:278
jl_gc_run_finalizers_in_list at /buildworker/worker/package_linux64/build/src/gc.c:365
run_finalizers at /buildworker/worker/package_linux64/build/src/gc.c:394
jl_gc_run_pending_finalizers at /buildworker/worker/package_linux64/build/src/gc.c:405
jl_mutex_unlock at /buildworker/worker/package_linux64/build/src/julia_locks.h:131 [inlined]
jl_generate_fptr at /buildworker/worker/package_linux64/build/src/jitlayers.cpp:359
jl_compile_method_internal at /buildworker/worker/package_linux64/build/src/gf.c:1980
jl_compile_method_internal at /buildworker/worker/package_linux64/build/src/gf.c:2246 [inlined]
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2239 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
add_bridged_constraint at /home/blegat/.julia/dev/MathOptInterface/src/Bridges/bridge_optimizer.jl:1469
unknown function (ip: 0x7f603b83d876)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
add_constraint at /home/blegat/.julia/dev/MathOptInterface/src/Bridges/bridge_optimizer.jl:1521
_copy_constraints at /home/blegat/.julia/dev/MathOptInterface/src/Utilities/copy.jl:248
unknown function (ip: 0x7f603b83f8d8)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
_pass_constraints at /home/blegat/.julia/dev/MathOptInterface/src/Utilities/copy.jl:303
default_copy_to at /home/blegat/.julia/dev/MathOptInterface/src/Utilities/copy.jl:498
#copy_to#7 at /home/blegat/.julia/dev/MathOptInterface/src/Bridges/bridge_optimizer.jl:421 [inlined]
copy_to at /home/blegat/.julia/dev/MathOptInterface/src/Bridges/bridge_optimizer.jl:421 [inlined]
optimize! at /home/blegat/.julia/dev/MathOptInterface/src/MathOptInterface.jl:80 [inlined]
test_model_copy_to_UnsupportedConstraint at /home/blegat/.julia/dev/MathOptInterface/src/Test/test_model.jl:582
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
macro expansion at /home/blegat/.julia/dev/MathOptInterface/src/Test/Test.jl:216 [inlined]
macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.7/Test/src/Test.jl:1283 [inlined]
#runtests#2 at /home/blegat/.julia/dev/MathOptInterface/src/Test/Test.jl:209
runtests##kw at /home/blegat/.julia/dev/MathOptInterface/src/Test/Test.jl:195 [inlined]
test_runtests at /home/blegat/.julia/dev/OSQP/test/MOI_wrapper.jl:65
unknown function (ip: 0x7f605464715f)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
macro expansion at /home/blegat/.julia/dev/OSQP/test/MOI_wrapper.jl:21 [inlined]
macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.7/Test/src/Test.jl:1283 [inlined]
runtests at /home/blegat/.julia/dev/OSQP/test/MOI_wrapper.jl:21
unknown function (ip: 0x7f6054599b5f)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1788 [inlined]
do_call at /buildworker/worker/package_linux64/build/src/interpreter.c:126
eval_value at /buildworker/worker/package_linux64/build/src/interpreter.c:215
eval_stmt_value at /buildworker/worker/package_linux64/build/src/interpreter.c:166 [inlined]
eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:587
jl_interpret_toplevel_thunk at /buildworker/worker/package_linux64/build/src/interpreter.c:731
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:885
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:830
jl_toplevel_eval_in at /buildworker/worker/package_linux64/build/src/toplevel.c:944
eval at ./boot.jl:373 [inlined]
include_string at ./loading.jl:1196
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
_include at ./loading.jl:1253
include at ./client.jl:451
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1788 [inlined]
do_call at /buildworker/worker/package_linux64/build/src/interpreter.c:126
eval_value at /buildworker/worker/package_linux64/build/src/interpreter.c:215
eval_stmt_value at /buildworker/worker/package_linux64/build/src/interpreter.c:166 [inlined]
eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:587
jl_interpret_toplevel_thunk at /buildworker/worker/package_linux64/build/src/interpreter.c:731
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:885
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:830
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:830
jl_toplevel_eval_in at /buildworker/worker/package_linux64/build/src/toplevel.c:944
eval at ./boot.jl:373 [inlined]
eval_user_input at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.7/REPL/src/REPL.jl:150
repl_backend_loop at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.7/REPL/src/REPL.jl:246
start_repl_backend at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.7/REPL/src/REPL.jl:231
#run_repl#47 at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.7/REPL/src/REPL.jl:364
run_repl at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.7/REPL/src/REPL.jl:351
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
#930 at ./client.jl:394
jfptr_YY.930_45169.clone_1 at /home/blegat/packages/julias/julia-1.7.2/lib/julia/sys.so (unknown line)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1788 [inlined]
jl_f__call_latest at /buildworker/worker/package_linux64/build/src/builtins.c:757
#invokelatest#2 at ./essentials.jl:716 [inlined]
invokelatest at ./essentials.jl:714 [inlined]
run_main_repl at ./client.jl:379
exec_options at ./client.jl:309
_start at ./client.jl:495
jfptr__start_38732.clone_1 at /home/blegat/packages/julias/julia-1.7.2/lib/julia/sys.so (unknown line)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1788 [inlined]
true_main at /buildworker/worker/package_linux64/build/src/jlapi.c:559
jl_repl_entrypoint at /buildworker/worker/package_linux64/build/src/jlapi.c:701
main at julia (unknown line)
__libc_start_main at /usr/lib/libc.so.6 (unknown line)
unknown function (ip: 0x400808)
Allocations: 335554757 (Pool: 335435824; Big: 118933); GC: 216
[1]    332090 segmentation fault (core dumped)  julia --color=yes --project

Using a Julia linear system solver?

Hello and thanks for this awesome package! This is more of a question than an issue, I'd be interested in the feasibility of using a linear system solver implemented in Julia with OSQP. Has anyone explored or thought about his? The docs indicate that implementing new solvers should be doable by writing a C wrapper? I notice that the docs talk about

subfolder direct/ or indirect/ depending on the type of solver.

but the subfolder indeirect does not appear to exist. I'd be primarily interested in adding an iterative solver to experiment with fast re-factorization (warmstarting of the factorization step) for nonlinear MPC (if you have any insights into this particular idea, those would be very welcome as well :).

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

Implement DiffOpt interface

I was glad to see at Bartolomeo's talk at ICCOPT that OSQP will support querying differentiation information.
We developed an extension of MOI for this at https://github.com/jump-dev/DiffOpt.jl.
At the moment, no solver implements DiffOpt's interface so the DiffOpt.Optimizer uses the solver to compute primal and dual information and then has to solve a linear system to compute these derivative information.
If package implements the DiffOpt interface then it would allow querying these informations from OSQP directly without needing this DiffOpt.Optimizer which would be faster as OSQP has already done part of the work needing to get these information when solving the problem.

OSQP installation error

I am getting following error message while trying to run using OSQP in Julia 1.1

[ Info: Precompiling OSQP [ab2f91bb-94b4-55e3-9ba0-7f65df51de79]
ERROR: LoadError: OSQP not properly installed. Please run Pkg.build("OSQP")
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] top-level scope at /nethome/ssharan31/.julia/packages/OSQP/H4U2v/src/OSQP.jl:16
 [3] include at ./boot.jl:326 [inlined]
 [4] include_relative(::Module, ::String) at ./loading.jl:1038
 [5] include(::Module, ::String) at ./sysimg.jl:29
 [6] top-level scope at none:2
 [7] eval at ./boot.jl:328 [inlined]
 [8] eval(::Expr) at ./client.jl:404
 [9] top-level scope at ./none:3
in expression starting at /nethome/ssharan31/.julia/packages/OSQP/H4U2v/src/OSQP.jl:13
ERROR: Failed to precompile OSQP [ab2f91bb-94b4-55e3-9ba0-7f65df51de79] to /nethome/ssharan31/.julia/compiled/v1.1/OSQP/BVtcb.ji.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1197
 [3] _require(::Base.PkgId) at ./loading.jl:960
 [4] require(::Base.PkgId) at ./loading.jl:858
 [5] require(::Module, ::Symbol) at ./loading.jl:853

Please suggest how to fix this. Thanks

fail to install OSQP.jl

when I try to build OSQP in julia,there comes a problem like this.Whould any kind people know how to fix this?

(v1.0) pkg> build OSQP
Building OSQP → ~/.julia/packages/OSQP/FaA6U/deps/build.log
┌ Error: Error building OSQP:
│ % Total % Received % Xferd Average Speed Time Time Time Current
│ Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
│ curl: (22) The requested URL returned error: 404 Not Found
│ ERROR: LoadError: failed process: Process(curl -g -L -f -o /tmp/juliar7EVp0 https://dl.bintray.com/bstellato/generic/OSQP/0.5.0/osqp-0.5.0-linux64.tar.gz.sha256, ProcessExited(22)) [22]
│ Stacktrace:
│ [1] error(::String, ::Base.Process, ::String, ::Int64, ::String) at ./error.jl:42
│ [2] pipeline_error at ./process.jl:705 [inlined]
│ [3] #run#505(::Bool, ::Function, ::Cmd) at ./process.jl:663
│ [4] run at ./process.jl:661 [inlined]
│ [5] download(::String, ::String) at ./download.jl:27
│ [6] download at ./download.jl:45 [inlined]
│ [7] get_hash_code(::String) at /home/hzh/.julia/packages/OSQP/FaA6U/deps/build.jl:31
│ [8] top-level scope at none:0
│ [9] include at ./boot.jl:317 [inlined]
│ [10] include_relative(::Module, ::String) at ./loading.jl:1044
│ [11] include(::Module, ::String) at ./sysimg.jl:29
│ [12] include(::String) at ./client.jl:392
│ [13] top-level scope at none:0
│ in expression starting at /home/hzh/.julia/packages/OSQP/FaA6U/deps/build.jl:39
└ @ Pkg.Operations /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Pkg/src/Operations.jl:1096

formatting nit-pick

I see the repository uses tabs for intending. The convention in Julia is to use 4 spaces instead.

OSQP segmentation fault using direct mode

The issue happens when the model is being displayed into the REPL.

MWE

julia> using JuMP, OSQP
julia> m = direct_model(OSQP.Optimizer())

Resulting segmentation fault

signal (11): Segmentation fault: 11
in expression starting at none:0
unsafe_load at ./pointer.jl:105 [inlined]
unsafe_load at ./pointer.jl:105 [inlined]
dimensions at /Users/jdlara/.julia/packages/OSQP/BU4WO/src/interface.jl:498 [inlined]
get at /Users/jdlara/.julia/packages/OSQP/BU4WO/src/MOI_wrapper.jl:407
unknown function (ip: 0x1181c08df)
get at /Users/jdlara/.julia/packages/JuMP/qhoVb/src/JuMP.jl:863
num_variables at /Users/jdlara/.julia/packages/JuMP/qhoVb/src/JuMP.jl:430
show at /Users/jdlara/.julia/packages/JuMP/qhoVb/src/print.jl:166
show at ./multimedia.jl:47
unknown function (ip: 0x1181c07f8)
display at /Users/jdlara/.julia/packages/OhMyREPL/07uNa/src/output_prompt_overwrite.jl:8
unknown function (ip: 0x1181bdba8)
display at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:218
display at ./multimedia.jl:328
jl_apply at /Users/julia/buildbot/worker/package_macos64/build/src/./julia.h:1690 [inlined]
do_apply at /Users/julia/buildbot/worker/package_macos64/build/src/builtins.c:655
jl_f__apply at /Users/julia/buildbot/worker/package_macos64/build/src/builtins.c:669 [inlined]
jl_f__apply_latest at /Users/julia/buildbot/worker/package_macos64/build/src/builtins.c:705
#invokelatest#1 at ./essentials.jl:710 [inlined]
invokelatest at ./essentials.jl:709 [inlined]
print_response at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:238
unknown function (ip: 0x1181bd357)
print_response at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:223
unknown function (ip: 0x1181bc465)
do_respond at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:822
unknown function (ip: 0x1181ba690)
jl_apply at /Users/julia/buildbot/worker/package_macos64/build/src/./julia.h:1690 [inlined]
do_apply at /Users/julia/buildbot/worker/package_macos64/build/src/builtins.c:655
jl_f__apply at /Users/julia/buildbot/worker/package_macos64/build/src/builtins.c:669 [inlined]
jl_f__apply_latest at /Users/julia/buildbot/worker/package_macos64/build/src/builtins.c:705
#invokelatest#1 at ./essentials.jl:710 [inlined]
invokelatest at ./essentials.jl:709 [inlined]
run_interface at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/REPL/src/LineEdit.jl:2355
jfptr_run_interface_29039.clone_1 at /Applications/Julia-1.5.app/Contents/Resources/julia/lib/julia/sys.dylib (unknown line)
run_frontend at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:1144
#38 at ./task.jl:356
jfptr_YY.38_29911.clone_1 at /Applications/Julia-1.5.app/Contents/Resources/julia/lib/julia/sys.dylib (unknown line)
jl_apply at /Users/julia/buildbot/worker/package_macos64/build/src/./julia.h:1690 [inlined]
start_task at /Users/julia/buildbot/worker/package_macos64/build/src/task.c:705
Allocations: 28385145 (Pool: 28376481; Big: 8664); GC: 27

If the user uses a ; it won't cause the seg fault.

OSQP violates constraints for a quadratic programming problem

Hi all,

Thanks for the hard work put into OSQP.

When using OSQP.jl from JuMP.jl to solve a quadratic programming problem, I find that OSQP does not satisfy the constraints that I require.

The first bit of code is just some code to make some random labeled data, where each data point is a 2D vector in $[-1,1]\times[-1,1]$. The points are separated by a straight line. You can ignore this code, you just need it to be able to run the example that I give

function create_line(line_start,line_end)
    m = (line_end[2]-line_start[2])/(line_end[1]-line_start[1])
    c = line_start[2]-m*line_start[1]
    
    [m,c], x -> m*x+c
end

function classify(line::Function,point::AbstractArray)
    ifelse(line(point[1]) > point[2],-1,1)
end

function classify(weights::AbstractArray,point::AbstractArray)
    sign(weights'*point)
end

function create_data!(data,labels)
    N = size(data)[1]
    data_valid = false
    while !data_valid
        data .= 2rand(N,2).-1
        line_start = 2rand(1,2).-1
        line_end = 2rand(1,2).-1

        global line_coefficients,line = create_line(line_start,line_end)
        for i in 1:N
            labels[i] = classify(line,data[i,:])
        end
        
        !(all(labels .== 1) || all(labels .== -1)) && (data_valid = true)
    end
    
    data,labels,line
end

The next bit of code is the important bit:

using LinearAlgebra
using JuMP
using OSQP

N = 100
data = Array{Float64}(undef,N,2)
labels = Array{Int64}(undef,N)
data,labels,line = create_data!(data,labels)

m = Model(with_optimizer(OSQP.Optimizer))
# m = Model(with_optimizer(Ipopt.Optimizer,print_level=0))
@variable(m,α[1:N])
Q = [labels[i]*labels[j]*dot(data[i,:],data[j,:]) for i in 1:N, j in 1:N]
@objective(m,Min,0.5α'*Q*α-ones(N)'*α)
@constraint(m,[i=1:N],0.0 <= α[i])
@constraint(m,dot(labels,α) == 0)

@time optimize!(m)

αsol = value.(α)
minimum(αsol)

Upon running this, I usually find that the minimum value of α is much less than zero, which is a violation of the constraint that I gave. If I use Ipopt and uncomment the commented line, then the constraint will be satisfied.

julia> versioninfo()
Julia Version 1.1.0
Commit 80516ca202 (2019-01-21 21:24 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, skylake)

(v1.1) pkg> st OSQP
    Status `~/.julia/environments/v1.1/Project.toml`
  [ab2f91bb] OSQP v0.5.1

(v1.1) pkg> st JuMP
    Status `~/.julia/environments/v1.1/Project.toml`
  [f6369f11] ForwardDiff v0.10.3
  [4076af6c] JuMP v0.19.0

Problem with obtaining optimal rho estimate

Hello,

I have been trying to obtain the optimal estimate of the rho parameter from the solver but ran into the following issue. The field info.rho_estimate from the result of OSQP.solve!(...) does not match the value reported in the solver log.

I have created this minimal gist, where I solve the AUG3D instance from the Maros-Meszaros dataset. The solver log is as follows:

-----------------------------------------------------------------
           OSQP v0.6.2  -  Operator Splitting QP Solver
              (c) Bartolomeo Stellato,  Goran Banjac
        University of Oxford  -  Stanford University 2021
-----------------------------------------------------------------
problem:  variables n = 3873, constraints m = 1000
          nnz(P) + nnz(A) = 9219
settings: linear system solver = qdldl,
          eps_abs = 1.0e-03, eps_rel = 1.0e-03,
          eps_prim_inf = 1.0e-04, eps_dual_inf = 1.0e-04,
          rho = 1.00e-01 (adaptive),
          sigma = 1.00e-06, alpha = 1.60, max_iter = 4000
          check_termination: on (interval 25),
          scaling: on, scaled_termination: off
          warm start: on, polish: off, time_limit: off

iter   objective    pri res    dua res    rho        time
   1  -4.2768e+02   1.00e+00   1.48e+02   1.00e-01   4.07e-03s
  25   4.3955e+02   3.08e-04   7.00e-04   1.00e-01   6.36e-03s

status:               solved
number of iterations: 25
optimal objective:    439.5500
run time:             6.41e-03s
optimal rho estimate: 1.37e-01

However, when I do println(result.info.rho_estimate), the value is either something really close to zero (or sometimes NaN).

I'm running Julia v1.6.1 on 64-bit Linux. Any help is appreciated. Thanks!

Segfault when solving without setup!

The following code produces a segfault in Julia:

using OSQP
model = OSQP.Model()
result = OSQP.solve!(model)

results in:

ERROR in osqp_solve: Solver workspace not initialized.

signal (11): Segmentation fault: 11
in expression starting at REPL[3]:1
getproperty at ./Base.jl:20 [inlined]
solve! at /Users/Micha/.julia/packages/OSQP/BU4WO/src/interface.jl:173
solve! at /Users/Micha/.julia/packages/OSQP/BU4WO/src/interface.jl:171
jl_apply at /Users/sabae/buildbot/worker/package_macos64/build/src/./julia.h:1631 [inlined]
do_call at /Users/sabae/buildbot/worker/package_macos64/build/src/interpreter.c:328
eval_body at /Users/sabae/buildbot/worker/package_macos64/build/src/interpreter.c:0
jl_interpret_toplevel_thunk_callback at /Users/sabae/buildbot/worker/package_macos64/build/src/interpreter.c:888
unknown function (ip: 0xfffffffffffffffe)
unknown function (ip: 0x131322a0f)
unknown function (ip: 0x0)
jl_interpret_toplevel_thunk at /Users/sabae/buildbot/worker/package_macos64/build/src/interpreter.c:897
jl_toplevel_eval_flex at /Users/sabae/buildbot/worker/package_macos64/build/src/toplevel.c:814
jl_toplevel_eval_flex at /Users/sabae/buildbot/worker/package_macos64/build/src/toplevel.c:764
jl_toplevel_eval at /Users/sabae/buildbot/worker/package_macos64/build/src/toplevel.c:823 [inlined]
jl_toplevel_eval_in at /Users/sabae/buildbot/worker/package_macos64/build/src/toplevel.c:843
eval at /Applications/Julia-1.3.app/Contents/Resources/julia/lib/julia/sys.dylib (unknown line)
eval_user_input at /Applications/Julia-1.3.app/Contents/Resources/julia/share/julia/stdlib/v1.3/REPL/src/REPL.jl:86
run_backend at /Users/Micha/.julia/packages/Revise/SefCg/src/Revise.jl:1042
#85 at ./task.jl:333
jl_apply at /Users/sabae/buildbot/worker/package_macos64/build/src/./julia.h:1631 [inlined]
start_task at /Users/sabae/buildbot/worker/package_macos64/build/src/task.c:659
Allocations: 33366879 (Pool: 33359381; Big: 7498); GC: 32
Segmentation fault: 11

This should be easy to fix.
I will make a PR to fix this (hopefully) sometime this week.

Fix `Silent`

It seems :verbose is ignored when it is set by update_settings!, i.e. by osqp_update_verbose.

OSQP.Optimizer doesn't handle kwargs correctly

The following gives me an error:

julia> OSQP.Optimizer(max_iter=10)
ERROR: MethodError: Cannot `convert` an object of type Symbol to an object of type String
Closest candidates are:
  convert(::Type{String}, ::String) at essentials.jl:218
  convert(::Type{T}, ::T) where T<:AbstractString at strings/basic.jl:231
  convert(::Type{T}, ::AbstractString) where T<:AbstractString at strings/basic.jl:232   
  ...
Stacktrace:
 [1] MathOptInterface.RawOptimizerAttribute(name::Symbol)
   @ MathOptInterface ~\.julia\packages\MathOptInterface\src\attributes.jl:868
 [2] OSQP.MathOptInterfaceOSQP.Optimizer(; kwargs::Base.Pairs{Symbol, Int64, Tuple{Symbol}, NamedTuple{(:max_iter,), Tuple{Int64}}})
   @ OSQP.MathOptInterfaceOSQP ~\.julia\packages\OSQP\src\MOI_wrapper.jl:81
 [3] top-level scope
   @ REPL[12]:1

The backtrace points to the following lines in MOI_wrapper.jl:

for (key, value) in kwargs
    MOI.set(optimizer, MOI.RawOptimizerAttribute(key), value)
end

I looked up the call signature for RawOptimizerAttribute in MathOptInterface and it's RawOptimizerAttribute(name::String). So I think the keys need to be converted into Strings. Or add support in MathOptInterface for RawOptimizerAttribute(name::Symbol)? If that's preferable, I can open an issue over there instead.

LQ problem infeasible OSQP after 0.6.1 update

after the update to 0.6.1 the following MWE returns infeasible.

gen =  [264.0
 331.0
 397.0
 462.0
 530.0]

price = [
9565.599999999999
 10791.66
 12036.52
 13340.8
 14748.7
]

m = Model(OSQP.Optimizer)
n_bp = length(price)
@variable(m, var_price[1:n_bp] >= 0)
@variable(m, quad_mult >= 0)
@variable(m, linear_mult >= 0)
@variable(m, intercept >= 0)
@constraint(m, [i in 1:n_bp], var_price[i] == intercept + linear_mult*gen[i] + quad_mult*gen[i]^2)
@objective(m, Min, sum((price[i] - var_price[i])^2 for i in 1:n_bp))
optimize!(m)

image

Build error on CentOS 7 and Julia v1.3.1

When trying to install OSQP.jl on CentOS 7 and Julia v1.3.1 I get the following build error:

(v1.3) pkg> build OSQP
  Building OSQP  `~/.julia/packages/OSQP/BU4WO/deps/build.log`
┌ Error: Error building `OSQP`: 
│ ┌ Warning: platform_key() is deprecated, use platform_key_abi() from now on
│ │   caller = ip:0x0
│ └ @ Core :-1
│ ┌ Warning: Could not extract the platform key of https://dl.bintray.com/bstellato/generic/OSQP/0.6.0/osqp-0.6.0-linux64.tar.gz; continuing...
│ └ @ BinaryProvider ~/.julia/packages/BinaryProvider/U2dKK/src/Prefix.jl:185
│ ERROR: LoadError: LibraryProduct("/home/trin3213/.julia/packages/OSQP/BU4WO/deps/usr/osqp-0.6.0-linux64/lib", ["libosqp"], :osqp, nothing) is not satisfied, cannot generate deps.jl!
│ Stacktrace:
│  [1] error(::String) at ./error.jl:33
│  [2] #write_deps_file#165(::Bool, ::Bool, ::typeof(write_deps_file), ::String, ::Array{LibraryProduct,1}) at /home/trin3213/.julia/packages/BinaryProvider/U2dKK/src/Products.jl:419
│  [3] (::BinaryProvider.var"#kw##write_deps_file")(::NamedTuple{(:verbose,),Tuple{Bool}}, ::typeof(write_deps_file), ::String, ::Array{LibraryProduct,1}) at ./tuple.jl:0
│  [4] top-level scope at /home/trin3213/.julia/packages/OSQP/BU4WO/deps/build.jl:65
│  [5] include at ./boot.jl:328 [inlined]
│  [6] include_relative(::Module, ::String) at ./loading.jl:1105
│  [7] include(::Module, ::String) at ./Base.jl:31
│  [8] include(::String) at ./client.jl:424
│  [9] top-level scope at none:5in expression starting at /home/trin3213/.julia/packages/OSQP/BU4WO/deps/build.jl:65
└ @ Pkg.Operations /data/engs-goulart/trin3213/julia-1.3.1/share/julia/stdlib/v1.3/Pkg/src/backwards_compatible_isolation.jl:649

I assume this is related to the BinaryBuilder PR #75. My current workaround is to clone @kefrobotics fork: https://github.com/kefrobotics/OSQP.jl and install via pkg> add path-to-fork/OSQP.jl

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.