qp() delivers incorrect results for large-valued boundaries

Gabriele Pannocchia g.pannocchia at ing.unipi.it
Fri May 2 15:29:17 CDT 2008


Hi all,

I can reproduce the error on octave-3.0.0 and the reason is the
following. 

If no initial guess is supplied qp.m initializes it with 
x0 = zeros(n,1); 
then check if such x0 is feasible (w.r.t. equality and inequality
constraints) with the following tests:

eq_infeasible = (n_eq > 0 && norm (A*x0-b) > rtol*(1+norm (b)));
in_infeasible = (n_in > 0 && any (Ain*x0-bin < -rtol*(1+norm (bin))));

If any of these tests fail, then an LP is solved to find an initial
feasible point (if any) or telling that the QP is infeasible.

Given the large bounds, norm(bin) is large and hence x0 "seems" feasible
although it is not. Indeed, if I supply an initial feasible point, qp.m
returns the correct solution:
octave:12>
n=3;H=eye(n);q=zeros(n,1);A=[];b=[];lb=ones(n,1);ub=1e8*ones(n,1);
octave:13> [x,obj,info] = qp(ones(n,1),H,q,A,b,lb,ub)
x =

   1
   1
   1

obj =  1.5000
info =
{
  solveiter =  1
  info = 0
}

Perhaps, one possible way to fix these kinds of problems could be
evaluating the constraints once at the time. The following patch solves
the problem for me, but I would like to have more opinions on these
proposed changes.

Kind regards,
	Gabriele

--- /usr/share/octave/3.0.0/m/optimization/qp.m 2008-03-26
11:56:57.000000000 +0100
+++ qp.m        2008-05-02 22:21:29.000000000 +0200
@@ -190,8 +190,8 @@
     ## Check if the initial guess is feasible.
     rtol = sqrt (eps);

-    eq_infeasible = (n_eq > 0 && norm (A*x0-b) > rtol*(1+norm (b)));
-    in_infeasible = (n_in > 0 && any (Ain*x0-bin < -rtol*(1+norm
(bin))));
+    eq_infeasible = (n_eq > 0 && norm (A*x0-b) > rtol*(1+abs (b)))
+    in_infeasible = (n_in > 0 && any (Ain*x0-bin < -rtol*(1+abs
(bin))))

     info = 0;
     if (eq_infeasible || in_infeasible)
@@ -211,7 +211,7 @@
       ## constraints also.
       if (n_in > 0)
        res = Ain * xbar - bin;
-       if (any (res < -rtol * (1 + norm (bin))))
+       if (any (res < -rtol * (1 + abs (bin))))
          ## xbar is not feasible with respect to the inequality
          ## constraints.  Compute a step in the null space of the
          ## equality constraints, by solving a QP.  If the slack is




More information about the Bug-octave mailing list