help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: quadprog->qp newbie help


From: fork
Subject: Re: quadprog->qp newbie help
Date: Tue, 27 Mar 2012 16:26:23 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

MarkSheedy <mark.sheedy <at> edftrading.com> writes:

> 
> Hello,
> 
> I am converting some code that uses the MatLab quadprog function to the
> Octave qp function.

You want the following Octave code (I am *almost* sure):

[X, OBJ, INFO, LAMBDA] = qp([], H,f, [], [], lb, [], [], A, b)

The problem you had in translating is that ML uses "A" and "b" to refer to the
inequality constraint matrix and vector in their docs, while Octave uses "A_in"
and "A_ub" to refer the same thing.  Octave puts them at the end instead of the
front, contra ML.  

In the Octave documentation, "A" and "b" refer to the equality constraints, NOT
inequality.  The way you called qp() provided an overdetermined matrix for
equality constraint.  You could have solved the system from your A\b to give
[0.77; 1.37]; when you feed this into qp() you x=[0.77; 1.37] since you have set
an *equality* constraint to be such.  I think this is what happened when you
disabled the check in qp.m

http://www.gnu.org/software/octave/doc/interpreter/Quadratic-Programming.html 
The fifth example down shows how to call it with an inequality matrix.

As I understand it, Octave's qp() matches the older ML's qp(), which they
changed sometime in the last decade. Lame.

Let me know if that works or helps.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]