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

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

[Octave-bug-tracker] [bug #55348] [octave forge] (ga) Unit test in ga.m


From: Rafael Laboissiere
Subject: [Octave-bug-tracker] [bug #55348] [octave forge] (ga) Unit test in ga.m fails randomly
Date: Mon, 31 Dec 2018 12:06:46 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.7 Safari/537.36

URL:
  <https://savannah.gnu.org/bugs/?55348>

                 Summary: [octave forge] (ga) Unit test in ga.m fails randomly
                 Project: GNU Octave
            Submitted by: rlaboiss
            Submitted on: Mon 31 Dec 2018 05:06:44 PM UTC
                Category: Octave Forge Package
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Unexpected Error
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: other
        Operating System: Any

    _______________________________________________________

Details:

The following unit test in ga.m (line 197), fails randomly:


%!test
%! ps = getfield (default_options, "PopulationSize");
%! options = gaoptimset ("EliteCount", randi ([0, ps]));
%! x = ga (f, nvars, [], [], [], [], [], [], @nonlcon, options);


To bug can be reproduced by running the following script:


pkg load ga
f = @rastriginsfcn;
nvars = 2;
default_options = gaoptimset ();
function [C, Ceq] = nonlcon (x)
    C = [];
    Ceq = [];
endfunction
while 1
    ps = getfield (default_options, "PopulationSize");
    options = gaoptimset ("EliteCount", randi ([0, ps]));
    printf ("EliteCount = %d\n", options.EliteCount);
    x = ga (f, nvars, [], [], [], [], [], [], @nonlcon, options);
endwhile


It produces an output like this:


EliteCount = 8
EliteCount = 14
EliteCount = 15
[snip]
EliteCount = 3
EliteCount = 20
error: value on right hand side of assignment is undefined
error: called from
    __ga_selectionfcn__ at line 20 column 26
    __ga_problem__ at line 55 column 42
    ga at line 113 column 47


Apparently, EliteCount must be strictly smaller than PopulationSize, but the
root of the bug may be elsewhere (I did not investigate deeply the problem).

At any rate, the patch attached to this bug report seems to fix the problem.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Mon 31 Dec 2018 05:06:44 PM UTC  Name:
max-EliteCount-in-ga-unit-test.patch  Size: 725B   By: rlaboiss

<http://savannah.gnu.org/bugs/download.php?file_id=45815>

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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