Git Product home page Git Product logo

Comments (1)

goulart-paul avatar goulart-paul commented on August 17, 2024 1

The issue appears to be that OSQP is not properly receiving the P matrix. When I run your example code above, OSQP reports that nnz(A) + nnz(P) = 6, which is obviously not correct since A itself has 6 nonzeros. I think it has simply ignored P for some reason.

If I replace your P with
P <- Matrix(c(1, 0,0, 1e-10, 1,0, 0,0,1), 3, 3, sparse = TRUE)
and rerun, then I get nnz(P) + nnz(A) = 10, which is correct (counting only the upper triangle of P). I also get the solution [0.5 0.35 0.35], which also appears to be correct and matches the solution obtained from OSQP through our other language interfaces.

The underlying issue appears to be a failure to properly process P because it is of type ddiMatrix in your example, and OSQP only seems to understand it if it is of type dsCMatrix. For example, this seems to work:

model <- osqp(forceSymmetric(P), q, A, l, u, settings)
res <- model$Solve()

As does this:

P <- as(as(P,"symmetricMatrix"),"dsCMatrix")

The user should not have to do that though. I'm not very familiar with R, so I will leave this open for now and come back to it as time permits, unless someone else can propose a fix.

from osqp-r.

Related Issues (18)

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.