[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: RFC: quadprog/lsqlin with __qp__ (Re: GSoC 2015, optim)
From: |
Olaf Till |
Subject: |
Re: RFC: quadprog/lsqlin with __qp__ (Re: GSoC 2015, optim) |
Date: |
Wed, 15 Jul 2015 10:36:22 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Mon, Jul 13, 2015 at 07:40:47PM -0700, AsmaA wrote:
> Hi Olaf,
>
> Thank you for your reply.
>
> > But currently it is accepted if one of A and b is empty and the other
> > not. What's the sense in this?
>
> Are you referring to qp.m (lines 253 onward)? qp.m gives an error if
I'm refering to your code of quadprog.m.
> A_in is empty but it works if A_in is given and A_ub is empty.
> Example:
>
> qp ([],H,f,Aeq,beq,lb,ub,[],A,[])
>
> This works. qp simply ignores inequality constraints due to if checks
> in lines (258, 266, 275)
> Matlab gives an error if A is empty and b is not and vice versa. Example:
>
> quadprog (H, f, A, [], Aeq, beq, lb, ub)
>
> Error: The number of rows in A must be the same as the length of b.
>
> I have added this check in line 181 of quadprog. Please refer to the
> updated code [1].
The updated code still accepts (H, f, A, [], ...) and (H, f, [], A, ...).
>
> > Running the example which is not commented out, I get
> >
> > ...
> > lb = -0.1*ones(4,1);
> > ...
> > [x,obj,flag,op,lambda]=quadprog(C'*C,-C'*d,A,b,Aeq,beq,lb,ub)
> > x =
> >
> > -0.10000
> > -0.10000
> > 0.15991
> > 0.40896
> > ...
> > lambda =
> >
> > scalar structure containing the fields:
> >
> > lower =
> >
> > 0.06743
> > 0.00000
> > 0.24993
> > 0.00000
> > ...
> >
> > which indicates an error in the ordering of lambda for lower bounds.
>
> The values are different from Matlab's, but I was more concerned about
> arranging multipliers from qp in the right order. Running this example
> with qp I get:
>
> [x, obj_qp, INFO, lambda] = qp ([], C'*C,-C'*d,Aeq,beq,lb,ub,[],A,b)
>
> lambda =
>
> 0.01654
> 0.06743
> 0.00000
> 0.24993
> 0.00000
> 0.00000
> 0.00000
> 0.00000
> 0.00000
> 0.00000
> 0.49819
> 0.00000
>
> I am not sure why the values are swapped (third and fourth values)
I'd rather say the 2nd and 3rd values are swapped.
> and the sign is different for lambda.eqlin.
> lambda.eqlin in matlab is -0.0165 for this example and lambda.lower =
> 0.0674
> 0.2499
> 0
> 0
>
> Can you explain why this is so?
I don't think I've currently the time to dig into __qp__.cc to explain
the swapping. But it's an indication that nobody ever used the lambda
returned by __qp__.cc.
To repeat myself, I'd appreciate if someone could tell me what the
user can do with that lambda.
Olaf
--
public key id EAFE0591, e.g. on x-hkp://pool.sks-keyservers.net
signature.asc
Description: Digital signature