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
7
votes
2 answers

Docker Container: UDP Communication with other hosts

i am writing a python application that is sending continously UDP messages to a predefined network with other hosts and fixed IPs. I wrote the python application and dockerized it. The application works fine in the docker, no problems…
bumbumquietsch
  • 153
  • 2
  • 10
7
votes
4 answers

How to implement a soft-margin SVM model using Matlab's quadprog?

Suppose we are given a training dataset {yᵢ, xᵢ}, for i = 1, ..., n, where yᵢ can either be -1 or 1 and xᵢ can be e.g. a 2D or 3D point. In general, when the input points are linearly separable, the SVM model can be defined as follows min…
user1067334
  • 243
  • 3
  • 7
  • 15
5
votes
1 answer

How to use R package Quadprog to solve SVM?

I was wondering what's the proper way to implement Quadprog to solve quadratic programming. I have the following question(ripped from the internet)and also was looking at the following…
gchavez101
  • 93
  • 2
  • 8
4
votes
3 answers

Quadratic Programming in python using data from octave

I'm in the midst of converting parts of a MATLAB program in to Python and Octave. I am using Octave to generate two matrices, then importing those matrices in to python using oct2py. The root of my problem are these lines in MATLAB (H_combined and…
nrobins1
  • 41
  • 4
4
votes
2 answers

Why is '.QP_qpgen2' not found in quadprog?

I recently dusted off a script which calls solve.QP from the quadprog package (I currently have version 1.5-5). Now it generates the error "object '.QP_qpgen2' not found". I don't understand why. This object is not created by me but by the…
rmacey
  • 599
  • 3
  • 22
4
votes
1 answer

Constraints on weight in portfolio optimization using quadprog package in R

I am new to using R and portfolio optimization. I am trying to optimize a portfolio with 7 assets such that asset number 3 and 4 have a minimum weight of 0.35 each and the sum of all 7 assets equal to 1. Following is the code I have…
Alok
  • 43
  • 1
  • 4
4
votes
1 answer

matlab: quadprog complaining functional is not symmetrical when it is

When I am running quadprog with a given functional F matlab outputs: Warning: Your Hessian is not symmetric. Resetting H=(H+H')/2. However, checking the difference between the functional and it's transpose: >> max(max(abs(F-F'))) ans = (1,1) …
olamundo
  • 23,991
  • 34
  • 108
  • 149
3
votes
2 answers

Find linear combination of vectors that is the best fit for a target vector

I am trying to find weights across a number of forecasts to give a result that is as close as possible (say, mean squared error) to a known target. Here is a simplified example showing three different types of forecast across four data…
3
votes
1 answer

Matlab's quadprog function is not recognized by Octave

I am using Octave for the first time today as a substitute to Matlab to try and call it from my Python script instead of using the matlab.engine. From what I've found, these two are compatible so running Matlab files in Octave is not complicated.…
Wallflower
  • 550
  • 1
  • 4
  • 13
3
votes
1 answer

Minimize portfolio variance, constrained to be sufficiently similar to a benchmark portfolio

I am performing portfolio optimization, and I would like to extend the discussion here with the following: I have a vector of weights w_bench that is used as a benchmark. I would like to optimize a portfolio weight vector w_pf that…
3
votes
1 answer

Quadratic programme with a_ix_i^2 terms in objective function

With regards to a quadratic programme, how would I set up an objective function like min⁡ ∑a_i (x_i )^2 in the matrix form for packages “quadprog” or “limSolve” (for this package I'm not sure if it needs to be in matrix form)? From the discussion…
NeilC
  • 33
  • 2
3
votes
1 answer

Error in solve.QP

So essentially I have two matrices containing the excess returns of stocks (R) and the expected excess return (ER). R<-matrix(runif(47*78),ncol = 78) ER<-matrix(runif(47*78),ncol = 78) I then combine these removing the first row of R and adding…
adaodante
  • 63
  • 2
  • 7
3
votes
1 answer

Constraining norms with inequalities

I have time-series data for N stocks. sample.data<-replicate(10,rnorm(1000)), where each column shows the returns of different stocks over time. I am trying to construct a portfolio weight vector to minimize the variance of the returns. the…
upabove
  • 1,057
  • 3
  • 18
  • 29
3
votes
0 answers

Box Constraints in QuadProg++

I am currently using QuadProg++ for solving a dual problem. The problem also has some box constraints, i.e. constraints which limit the variable to be between two values. However, QuadProg++ has no provision which allows for incorporating such…
alpha_ulrich
  • 536
  • 5
  • 21
3
votes
0 answers

C++ library - Using Quadprog++ and Array.hh

I'm trying to use the Quadprog++ library (http://quadprog.sourceforge.net/) but there is no documentation about it. In particular I'm trying to do the exponential of a matrix with the function of Array.hh (http://bit.ly/Za0k1J) but I have no idea…
Betelgeuse
  • 682
  • 2
  • 8
  • 27
1
2 3 4 5 6