[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: RFC: quadprog/lsqlin with __qp__ (Re: GSoC 2015, optim)
From: |
AsmaA |
Subject: |
Re: RFC: quadprog/lsqlin with __qp__ (Re: GSoC 2015, optim) |
Date: |
Mon, 13 Jul 2015 19:40:47 -0700 (PDT) |
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
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].
> 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)
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?
For other examples (now uncommented in runquadprog.m) lambda.eqlin is
-1 * matlab's values but the multipliers corresponding to the lower
bounds and the ordering is fine.
Kind Regards,
Asma.
[1] https://github.com/AsmaAfzal/octave_workspace/blob/master/quadprog.m
[2] https://github.com/AsmaAfzal/octave_workspace/blob/master/runquadprog.m
View this message in context: Re: RFC: quadprog/lsqlin with __qp__ (Re: GSoC 2015, optim)
Sent from the Octave - Maintainers mailing list archive at Nabble.com.