octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #58505] Handing NAs to glpk() can causes sever


From: anonymous
Subject: [Octave-bug-tracker] [bug #58505] Handing NAs to glpk() can causes several classes of crashes
Date: Tue, 28 Jul 2020 20:45:20 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0

Follow-up Comment #2, bug #58505 (project octave):

I confirm the crashes with NA. The last problem from OP actually works for me
and glpk returns a value.

I agree that the Octave script scripts/optimization/glpk.m should error on any
of the input values being NaN or NA. No optimization solver can deal with NaN
anyway.

Here is a diff of the proposed changes:

$ diff glpk.m glpk.m.new 
492,493c492,493
<   if (all (size (c) > 1) || iscomplex (c) || ischar (c))
<     error ("glpk: C must be a real vector");
---
>   if (all (size (c) > 1) || iscomplex (c) || ischar (c) || any ( isnan (c) )
)
>     error ("glpk: C must be a real vector and free of NaNs");
506a507,509
>   if (any (isnan (A(:) ) ) )
>     error ("glpk: A must not have NaN");
>   endif
520a524,526
>   if (any (isnan (b(:) ) ) )
>     error ("glpk: b must not have NaN");
>   endif
527c533
<     elseif (! isreal (lb) || all (size (lb) > 1) || length (lb) != nx)
---
>     elseif (! isreal (lb) || all (size (lb) > 1) || length (lb) != nx || any
(isnan(lb)) )
539c545
<     elseif (! isreal (ub) || all (size (ub) > 1) || length (ub) != nx)
---
>     elseif (! isreal (ub) || all (size (ub) > 1) || length (ub) != nx || any
(isnan(ub)) )
582c588
<     elseif (ischar (sense) || all (size (sense) > 1) || ! isreal (sense))
---
>     elseif (ischar (sense) || all (size (sense) > 1) || ! isreal (sense) ||
any (isnan (sense)))



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?58505>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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