changeset 28812:f864f78440e6 stable

allow glpk bounds to be infinite (bug #58505) * glpk.m: Allow bounds to be infinite. Update tests.
author John W. Eaton <jwe@octave.org>
date Mon, 28 Sep 2020 22:25:54 -0400
parents 90f7c563e706
children cf2f1a0a4ef8 697562e2b09a
files scripts/optimization/glpk.m
diffstat 1 files changed, 6 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/optimization/glpk.m	Mon Sep 28 18:40:07 2020 -0400
+++ b/scripts/optimization/glpk.m	Mon Sep 28 22:25:54 2020 -0400
@@ -532,9 +532,8 @@
     if (isempty (lb))
       lb = zeros (nx, 1);
     elseif (! isreal (lb) || all (size (lb) > 1) || length (lb) != nx
-            || any (! isfinite (lb)))
-      error ("glpk: LB must be a real and finite valued %d by 1 column vector",
-             nx);
+            || any (isnan (lb)))
+      error ("glpk: LB must be a real valued %d by 1 column vector", nx);
     endif
   else
     lb = zeros (nx, 1);
@@ -546,9 +545,8 @@
     if (isempty (ub))
       ub = Inf (nx, 1);
     elseif (! isreal (ub) || all (size (ub) > 1) || length (ub) != nx
-            || any (! isfinite (ub)))
-      error ("glpk: UB must be a real and finite valued %d by 1 column vector",
-             nx);
+            || any (isnan (ub)))
+      error ("glpk: UB must be a real valued %d by 1 column vector", nx);
     endif
   else
     ub = Inf (nx, 1);
@@ -672,6 +670,6 @@
 %!error<C .* finite values> glpk(NaN, 2, 3)
 %!error<A must be finite> glpk(1, NaN, 3)
 %!error<B must be finite> glpk(1, 2, NaN)
-%!error<LB must be .* finite value> glpk(1, 2, 3, NaN)
-%!error<UB must be .* finite value> glpk(1, 2, 3, 4, NaN)
+%!error<LB must be a real valued> glpk(1, 2, 3, NaN)
+%!error<UB must be a real valued> glpk(1, 2, 3, 4, NaN)
 %!error<SENSE must be .* integer> glpk(1, 2, 3, 4, 5, "F", "C", NaN)