help-octave
[Top][All Lists]

Re: qp(): how do I get a simple inequality constraint?

 From: Leo Butler Subject: Re: qp(): how do I get a simple inequality constraint? Date: Fri, 23 Sep 2011 09:46:27 -0400 User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/23.2 (gnu/linux)

```forkandwait <address@hidden> writes:

> Hi all,
>
> I am trying to use qp to do an example in Caswell's Matrix Population Models
> 2001 (p147).  (I also know very little about optimization, so please bear with
> me.)
>
> Octave's qp seems to have different parameters than either ML's quadprog or
> Caswell's 2001 version of qp.  Since I don't really know what is going on, I
> am
> trying to work the example "formally".
>
> Here is the set up.  The problem in Caswell is posed as:
>
> min (p'*G*p)/2 + f'*p
>
> subject to C*p <= b
>
>
> In his sample code to qp (with no initial guess of x0), that is written as:
>
> p = qp(G, f, C, b)
>
> However the Octave documentation states that with qp(X0,H,Q,A,B), A*x = b --
> i.e. that A and b define an EQUALITY constraint, not an inequality constraint.
>
> How do I get an inequality constraint like Caswell's, and make sure not to
> have
> any equality constraints?  Do I use A_LB and set the other parameters == []?
>
> Thanks for any help!

You add a slack variable to your state, call it s. Your inequality
becomes

1)  C*p + s = b,

2)  s >= 0.

You can then use the LB/UB to enforce (2). I leave it to you to write
your original program with this extra slack variable.

Leo

```

reply via email to