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
1
vote
1 answer

How to implement box constraints in QuadProg

I was wondering if the R ‘Quadprog’ package has the ability to incorporate box constraints of the following form: -L*1 <= v <= L*1 Where 1 is a vector of 1’s and L is a constant. The variable to optimize is v. Basically all individual elements of v…
SRM
  • 11
  • 1
1
vote
2 answers

Why doesn't solve.QP and portfolio.optim generate identical results?

The documentation for portfolio.optim {tseries} says that solve.QP {quadprog} is used to generate the solution for finding the tangency portfolio that maximizes the Sharpe ratio. That implies that results should be identical with either function.…
James Picerno
  • 472
  • 4
  • 16
1
vote
0 answers

Long/Short Portfolio Optimization in R with Constraints

I would like to solve a fairly common (and simple) optimization problem, though it seems there are no posts on this: long/short market neutral minimum variance optimization. The form of the optimization in "R pseudo-code": min (t(h) %*% D %*% h )…
1
vote
3 answers

Getting a library to work (QuadProg++ )

I'm trying to use the Quadprog++ library (http://quadprog.sourceforge.net/). I don't understand the instructions though. To build the library simply go through the ./configure; make; make install cycle. In order to use it, you will be required to…
Tessa
  • 297
  • 1
  • 3
  • 10
1
vote
0 answers

MOSEK's quadprog slower than matlab

I am using MOSEK's quadprog. When I run it, I get the following output and then I see no progress (waited for 10 minutes): Setting int param MSK_IPAR_LOG_INTPNT to 1 Setting int param MSK_IPAR_LOG_SIM to 1 Setting int param MSK_IPAR_LOG_BI to…
olamundo
  • 23,991
  • 34
  • 108
  • 149
0
votes
1 answer

Import Error undefined symbol: _Z7qpgen2_PdS_PiS0_S_S_S_S_S_S0_S0_S0_S0_S0_S0_S_S0_

I am running this repo: https://github.com/TUMFTM/global_racetrajectory_optimization on a WSL (alternatively I have tried it on multiple different machines like several Linux machines as well as an NVIDIA Jetson Orin Nano devkit). But somehow, as I…
bach
  • 1
  • 2
0
votes
0 answers

Portfolio Optimization - R solve.QP giving "constraints are inconsistent, no solution"

When I run a shiny app for portfolio optimization, I get this error ("constraints are inconsistent, no solution") randomly about half the time, while it seems to work correctly half the time. I'm not really sure where the code is going wrong, as…
0
votes
0 answers

Portfolio Optimization Using Quadprog Gives the Same Result for Every time even after changing variables

I have a task to construct the efficient frontier using 25 portfolios (monthly data). I tired writing a quadprog code for calculating minimum variance portfolio weights for a given expected rate of return. However, regardless of the expected return,…
0
votes
1 answer

Error: Failed building wheel for quadprog (Ubuntu, python)

In macos I did not receive that error, in Windows I had to install Microsoft Visual Studio but on Linux I do not know how to solve this. The error shows after I type to the terminal: pip install qpsolvers I tried many ways and I ask for help.
0
votes
1 answer

Quadratic optimization - portfolio maximization problems

In portfolio analysis, given the expectation, we aim to find the weight of each asset to minimize the variance here is the code install.packages("quadprog") library(quadprog) #Denoting annualized risk as an vector sigma sigma <- c(0.56, 7.77,…
Mathilda Fang
  • 353
  • 1
  • 13
0
votes
0 answers

how can get rid of "ValueError: all the input array dimensions except for the concatenation axis must match exactly" error when use cvxopt function?

first i define some matrix and vector in proper shape . initialization I=np.eye(24) Z=np.zeros((24,24)) a=0.012 b=1.1 gamma1=0.9/80 gamma2=1.1/80 MM=np.eye(24) for i in range (22): MM[i+1,i]=-1 MM[0,23]=-1 M=random.randint(200,300,…
0
votes
0 answers

Quadprog for Portfolio Optimization with Constraints

Let me start by saying I am new to Stack Exchange sites, so apologies if this turns out to be a low quality question. I am trying to run a mean-variance portfolio optimization using Solve.QP in R and have looked at several previous questions…
0
votes
0 answers

Usage and determination of the arguments of quadprog::solve.QP

The function of quadprog looks like that: solve.QP(Dmat, dvec, Amat, bvec, meq=0, factorized=FALSE) My objective function is: And my two constraints are: Now my aim is to determine the single arguments. 1) First argument Dmat: In the generel…
0
votes
1 answer

Failed to install quadprog on Linux Mint 20

has anyone installed this quadprog lib on Python 3.8 and Linux Mint 20? I'm trying to install and the following error is appearing: pip install quadprog Collecting quadprog Using cached quadprog-0.1.8.tar.gz (269 kB) Requirement already satisfied:…
0
votes
0 answers

Sign Error/Inversed Results with quadprog Package

I am using quadprog to do an optimization with two constraints (sum of asset weights equals 1) and asset weights are between 0 and 10%. Everything works fine but there is some inverse of my result going on that I do not understand. When TAU (my risk…