Questions tagged [quadratic-programming]

Quadratic programming (QP) is a special type of mathematical optimization problem. It is the problem of optimizing (minimizing or maximizing) a quadratic function of several variables subject to linear constraints on these variables.

Quadratic programming (QP) is a special type of mathematical optimization problem. It is the problem of optimizing (minimizing or maximizing) a quadratic function of several variables subject to linear constraints on these variables.

237 questions
23
votes
4 answers

How can I efficiently calculate a quadratic form in Julia?

I would like to calculate a quadratic form: x' Q y in Julia. What would be the most efficient way to calculate this for the cases: No assumption. Q is symmetric. x and y are the same (x = y). Both Q is symmetric and x = y. I know Julia has dot().…
Eric Johnson
  • 682
  • 1
  • 12
17
votes
1 answer

How to convert quadratic to linear program?

I have an optimization problem that has in the objective function 2 multiplied variables, making the model quadratic. I am currently using zimpl, to parse the model, and glpk to solve it. As they don't support quadratic programming, I would need to…
14
votes
4 answers

CVXOPT QP Solver: TypeError: 'A' must be a 'd' matrix with 1000 columns

I'm trying to use the CVXOPT qp solver to compute the Lagrange Multipliers for a Support Vector Machine def svm(X, Y, c): m = len(X) P = matrix(np.dot(Y, Y.T) * np.dot(X, X.T)) q = matrix(np.ones(m) * -1) g1 =…
Utumbu
  • 432
  • 3
  • 7
  • 18
11
votes
4 answers

MATLAB: Find abbreviated version of matrix that minimises sum of matrix elements

I have a 151-by-151 matrix A. It's a correlation matrix, so there are 1s on the main diagonal and repeated values above and below the main diagonal. Each row/column represents a person. For a given integer n I will seek to reduce the size of the…
7
votes
4 answers

Quadratic Programming in Python using Numpy?

I am in the process of translating some MATLAB code into Python. There is one line that is giving me a bit of trouble: [q,f_dummy,exitflag, output] = quadprog(H,f,-A,zeros(p*N,1),E,qm,[],[],q0,options); I looked up the documentation in MATLAB to…
A.Torres
  • 413
  • 1
  • 6
  • 16
7
votes
1 answer

What are the specific reasons for CVXPY to throw `SolverError` exception?

I am using CVXPY (version 1.0) to solve a quadratic program (QP) and I often get this exception: SolverError: Solver 'xxx' failed. Try another solver. which makes my program really fragile. I have tried different solvers, including CVXOPT, OSQP,…
6
votes
3 answers

Is there any quadratic programming function that can have both lower and upper bounds - Python

Normally I have been using GNU Octave to solve quadratic programming problems. I solve problems like x = 1/2x'Qx + c'x With subject to A*x <= b lb <= x <= ub Where lb and ub are lower bounds and upper bounds, e.g limits for x My Octave code looks…
euraad
  • 2,467
  • 5
  • 30
  • 51
6
votes
1 answer

Linear regression with constraints on the coefficients

I am trying to perform linear regression, for a model like this: Y = aX1 + bX2 + c So, Y ~ X1 + X2 Suppose I have the following response vector: set.seed(1) Y <- runif(100, -1.0, 1.0) And the following matrix of predictors: X1 <- runif(100, 0.4,…
arielle
  • 915
  • 1
  • 12
  • 29
6
votes
1 answer

Optimisation in swi prolog

Say I want to find argmax(x,y,z) -1/2(20x^2+32xy +16y^2)+2x+2y. subject to: x>=0, y>=0,z>=0 and -x-y+z =0. I know the partial derivatives being set to 0 is : -20x-16y+2=0 and -16x-16y+2 =0 so we could have x= 0 and y =1/8 and z=1/8. How would I do…
user27815
  • 4,767
  • 14
  • 28
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
1 answer

Error in quadratic programing in R using portfolio.optim function

I’m trying to create the realized efficient frontier from a quarter period, with the daily closing prices of a hundred stocks, no short positions allowed. The first step is to calculate the daily return for the period for each…
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

CPLEX Java Convex Quadratic Constraint (only PSD if x non-negative)

I have a quadratic problem with the variables e and a, both of which are non-negative. I have a constraint that reads a <= e (1 - a). When transformed, the matrix Q reads [[0,-1][0,0]] which is obviously neither positive nor negative semi-definite…
Layla
  • 125
  • 10
3
votes
1 answer

Maximization of quadratic forms in R with respect to a vector of weights

I have a distance (similarity) matrix D, for example, D <- matrix(c(0.00, 1.00, 1.00, 0.10, 0.05, 1.00, 0.00, 1.00, 1.00, 1.00, 1.00, 1.00, 0.00, 0.90, 0.95, 0.10, 1.00, 0.90, 0.00, 0.15, 0.05, 1.00, 0.95, 0.15, 0.00),5,5) and a vector of weights…
3
votes
1 answer

Warm starting QP solver in CPLEX

I'm trying to figure out how to warm start the quadratic programming solver(s) for CPLEX. I am specifically interested in warm starting the QP solver for nonconvex quadratic programs terminating at first-order stationary points. I believe the…
ae0709
  • 304
  • 1
  • 10
1
2 3
15 16