Linear Programming


How do I solve the LP with the OSQP?


Thank you

Best Regards

You have not really given us enough information to help you. If you are using OSQP through Matlab or Python, I would suggest starting here.

You could also considering using something like CvxPy, which supports OSQP as one of its solvers.

Thank you for the guide. I am using Matlab for the OSQP and encountered the error below. My question is what defines the size of P for LP problems?osqp1

You are setting P to be a 1x2 matrix in your code. It should be nxn, where n is the number of variables (should match the length of q).

You can either:

  1. Just set P = []. In this case the matlab interface will automatically set P to a zero matrix of appropriate size.

  2. Make a 2x2 sparse matrix of zeros, i.e. P = sparse(2,2);