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

1.1k Views Asked by At

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 notation is:

Calculation matrix D which is Dmat:

And because D is symmetric, the solution is

2) Second argument dvec: The linear part of the objective function

3) Third argument Amat: This is the left-hand-side of the constraints

4) Forth argument bvec: This is the right-hand-side of the constraints

5) Fifth argument meq is zero because of only inequality constraints

6) Sixth argument factorized: see question

And now I have to put these six arguments in the function solve.QP(). But here I'm sure that there's a need of further "transformation"...

  • When you look at the package description the quadratic part is multiplied by 0.5 and the linear part is negativ

  • Also the constraints are differently defined - >= sign

Questions:

  1. How must I "transform" the first four arguments of solve.QP()
  2. What does the last argument factorized affect
  3. How can I maximize the function solve.QP()

Many thanks in advance!

Edit: I have done now my "transformation" like suggested in the link from G. Grothendieck - I hope I have done everything right?!

enter image description here

And when I change the argument factorized=TRUE then I get my expected solution with x1=2 and x2=4.

enter image description here

In the help a R^-1 is mentioned. But sadly I have no clue what that means... Any hints appreciated.

enter image description here

0

There are 0 best solutions below