help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lp.cc (octave-forge) problem


From: A S Hodel
Subject: lp.cc (octave-forge) problem
Date: Tue, 11 Jun 2002 17:43:21 -0500

I've just started trying Ben Sapp's lp.cc code (from octave-forge) on
Mac OS X, and I'm getting some strange results.  Before I dig too
deeply, I'd like to see if these results occur on other platforms as
well or if this is unique to the (currently experimental) .oct file work
on Mac OS X.

Here's the m-file I use to test lp:  all solutions should lie within the
range [-10,10], with the number of equality constraints increasing from
0 to two as the iteration goes.  The results on my machine are at the
end.  Notice that the upper bound is violated and that the equality
constraints are not enforced.

If someone would run this script and let me know if my results are
duplicated, I'd appreciate it.  If they are, then I'll debug the lp.cc
code itself.  If not, then I've got something else going on that I'll
have to figure out.

Thanks.

A. S. Hodel

MyLpTest.m
============
A = eye(2,6);
c = [1 -2 3 -4 5 -6]';
b = [1;1];
lowerBound = -10*ones(size(c));
upperBound = 10*ones(size(c));

for nEqConstr = 0:2
   printf("\n\nnEqConstr=%d\n",nEqConstr);
   # compute results
   x = lp(c',A,b,lowerBound,upperBound,nEqConstr);

   # check against equality constraints, lower and upper bounds
   mesg = str2mat("low","  ","high");
   for ii=1:length(x)
     istr = 2 - (x(ii) < lowerBound(ii)) + (x(ii) > upperBound(ii));
     printf("%4d: %12.4g %12.4g %12.4g %s\n", ii, lowerBound(ii),
x(ii), ...
       upperBound(ii), mesg(istr,:));
   endfor
   ConstraintCheck = A*x - b
end

========= Output of the program: =========


nEqConstr=0
    1:          -10           10           10
    2:          -10           21           10 high
    3:          -10           10           10
    4:          -10           30           10 high
    5:          -10           10           10
    6:          -10           30           10 high
ConstraintCheck =

    9
   20



nEqConstr=1
    1:          -10           10           10
    2:          -10           21           10 high
    3:          -10           10           10
    4:          -10           30           10 high
    5:          -10           10           10
    6:          -10           30           10 high
ConstraintCheck =

    9
   20



nEqConstr=2
    1:          -10           21           10 high
    2:          -10           21           10 high
    3:          -10           10           10
    4:          -10           30           10 high
    5:          -10           10           10
    6:          -10           30           10 high
ConstraintCheck =

   20
   20



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]