Questions tagged [quadprog]

quadprog is a library for solving quadratic programming optimization problems. Implementations exist in several languages, including R and MATLAB.

A quadratic program is a type of numerical optimization problem. In a quadratic program, the task is to minimize a quadratic function subject to a series of linear constraints. Famous applications of quadratic programming include portfolio optimization and computing the support vector machine classifier.

Efficient methods for solving quadratic programs have been known for many years (for example, the Goldfarb-Idnani technique). There are excellent open source implementations of quadratic programming solvers in several languages. Popular quadprog libraries including R quadprog, MATLAB quadprog and C++ quadprog++ which are specialized for solving quadratic programs. Some general numerical optimization frameworks (e.g. CVXOPT) also include methods for solving quadratic programs.

The quadprog tag should be used for questions related to solving quadratic programs using a library with the name quadprog. For other libraries and more general questions about quadratic programming, the quadratic-programming tag may be more appropriate.

90 questions
0
votes
1 answer

quadratic programming in R with more parameters (constraints) than observations

I want to run a constrained linear regression such that the coefficients are nonnegative and sum to one. Usually this can be done with quadratic programming, However, I have more parameters (constraints) than observations (p > n). How can I do…
user116514
  • 13
  • 2
0
votes
1 answer

how do i install quadprog on mac os

I'm having some difficulty installing quadprog on macOS under Python 3.6. I've tried numerous solutions but nothing seems to be working. What I need to install is trajectory_planning_helpers and it needs quadprog. This is the error that I'm getting…
ntinos
  • 11
  • 3
0
votes
1 answer

Polynomial regression using quadprog

I am trying to run a polynomial regression using limSolve based on the example here. My code is the following. hr <- c(9.0, 9.5, 10.0, 10.5, 11.0, 11.5, 12.0, 12.5, 13.0, 13.5, 14.0, 14.5, 15.0, 15.5, 16.0, 16.5, 17.0, 17.5, 18.0, 18.5,…
Stata_user
  • 562
  • 3
  • 14
0
votes
2 answers

solve simple quadratic optimization in R with sum constraint

I want to solve a very simple quadratic optimization problem in R where one of the constraints is an equality constraint related to the sum of a vector. I tried to use the quadprog package but I cannot figure out how to make it work. The help…
0
votes
0 answers

Maximize active return minimze active risk portfolio analytics R

I am trying to maximize active return and minimize active risk using portfolio analytics optimization. is this possible using this package? i am trying to minimize the active weight.. so Min(Portw -Benchw)*Cov. is there a way to add in the bench…
0
votes
0 answers

Solving compound linear optimization problem

I would like to solve the following compound optimization problem in MATLAB: min (Ax-a), min (Bx-b), min (Cx-c) subject to Dx=d and x>=0, where a,b,c,d are vectors and A,B,C,D are matrices, all of them given. First of all, I don't know how to set…
0
votes
2 answers

C++ compilling errors when using Quadprog++ with Eigen together

this is my first question here, I've searched it all over for a long time yet no solution. I'm using QUadprog++ to solve a quadratic problem. When I use it in a test alone, it was alright. But when I implement it into my project, which contains…
0
votes
1 answer

How to reform the quadratic program objective function to fit matlab quadprog?

I have a quadratic problem question with the objective function f=arg min(A*f-b)^T*S*(A*f-b)+alpha*f^T*W*f s.t. d_low < C*f < d_up where f is the optimization variable, S and W are positive-define weight matrices. A*f-b is a matrix…
zy han
  • 3
  • 1
  • 2
0
votes
1 answer

Linear programming with Scipy fails but quadratic programming succeeds in finding a solution

I am trying to solve a linear programming problem with Python. Ling program fails to find a solution. But quad program works. I do not understand why, and I am not sure my formulation of the program in linprog and quad program are equivalent. The…
0
votes
1 answer

Constraints for a Linear Model Using Quadprog for Ranges/Limits on Coefficients

I'm doing some experimented, and I'm certainly aware why constraining coefficients is rarely needed, but here goes. In the following data, I have used quadprog to solve a linear model. Note that X1 is simply the intercept. X1 <- 1 X2 <- c(4.374,…
Lindon
  • 55
  • 5
0
votes
1 answer

Quadratic Program formulation: Matlab

Given this objective function: Minimize: f = (Ax + By)' * G * (Ax + By) subject to some equalities and inequalities. where x and y are real-valued vectors (decision variables) with p and q elements, respectively. A of size m * p, B of size m *…
0
votes
1 answer

Difference between Matlab's fmincon and quadprog case for linear case

I am trying to convert my quadprog linear quadratic problem over to fmincon so that later I can add nonlinear constraints. I am having difficulty when I compare my solutions using the two methods (for the same problem). The odd thing is that I get…
0
votes
1 answer

R error QP:not a positive definite matrix?

Im trying to solve the following problem in R, using the quadprog package: min: vec %*% p + t(p) %*% mat %*% p st: p >= 0 where mat <- matrix(c(1162296,0,0,0,0,1,0,0,951.7089,0,1,0,-951.7089,0,0,1),4) vec <-…
D.Cirkel
  • 65
  • 1
  • 8
0
votes
1 answer

ADMM quadprog R

To implement the ADMM optimization, I try to use quadprog. The equation I want to minimize is `min x^T*S*x + 1(x) + lambda^T*(x-z) + rho/2*||x-z||²` quadprog minimize a function under the following format `min -d^T*b + 1/2*b^T*D*b` after…
user1595929
  • 1,284
  • 3
  • 13
  • 23
0
votes
1 answer

Is it possible to include previous solutions from a quadprog solver into the constraints for subsequent solution values?

I have a question concerning the quadprog solver. I have set up an optimisation problem with 96 values to be optimised and 4 constraints which is working fine. Now I would like to do a somewhat more sophisticated optimisation. The values which are…
T. Wolf
  • 111
  • 1
  • 6