Hi,

in package optim, function linprog(), there is an error that prevents
proper execution of the function if only the minimal set of parameters
(f, A, b) is given.

Example code to reproduce:

f = [-3, -2, -2]';
A = [ 1, 0, 1;
      1, 1, 0;
      1, 2, 0];
b = [8, 7, 12]';
linprog(f, A, b)

This leads to the following error message:

> error: size (lb) != [(rows (f)) 1]
> error: called from:
> error:   /usr/share/octave/packages/3.2/optim-1.0.16/linprog.m at line 99, 
> column 7
> error:   test.m at line 6, column 1

I use Octave 3.2.4 that comes with the latest stable version of Ubuntu
(11.10) and the octave-optim packet version 1.0.16-1 from the official
Ubuntu repositories.

The relevant code in linprog.m is the following:
>     ## Sanitize lb
>     if (isempty (lb))
>       LB = - Inf (nr_f, 1);
>     endif
>     if (size (lb) != [nr_f 1])
>       error ("size (lb) != [(rows (f)) 1]");
>     endif
> 
>     ## Sanitize ub
>     if (isempty (ub))
>       UB = Inf (nr_f, 1);
>     endif
>     if (size (ub) != [nr_f 1])
>       error ("size (ub) != [(rows (f)) 1]");
>     endif

If lb is empty, it is not changed but a new variable LB is set. The
following condition can thus never be fulfilled when lb was initially
empty. For ub/UB, the same holds. If LB and UB are replaced by their
lowercase equivalents, the code works as expected.

Greetings and thanks for your work on Octave,
Daniel

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to