bugGNU Octave - Bugs: bug #55348, [octave forge] (ga) Unit test in...

 
 

bug #55348: [octave forge] (ga) Unit test in ga.m fails randomly

Submitter:  Rafael Laboissière <rlaboiss>
Submitted:  Mon 31 Dec 2018 05:06:44 PM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Fixed Assigned to:  lostbard
Originator Name:  Open/Closed:  * Closed
Release:  * other Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 07 Jun 2019 03:24:08 PM UTC, comment #5: 

0.10.1 released - closing as fixed

John Donoghue <lostbard>
Group Member
Tue 28 May 2019 02:47:24 PM UTC, comment #4: 
John Donoghue <lostbard>
Group Member
Thu 03 Jan 2019 09:49:07 PM UTC, comment #3: 

I'll close the other one as a duplicate of this

John Donoghue <lostbard>
Group Member
Thu 03 Jan 2019 09:38:17 PM UTC, comment #2: 

Yes it is a duplicate of #54316.  I completely forgot that I have submitted that bug report.

And, yes, I provided a patch this time.

Rafael Laboissière <rlaboiss>
Thu 03 Jan 2019 09:30:53 PM UTC, comment #1: 

Duplicate of #54316 ? but with a patch

John Donoghue <lostbard>
Group Member
Mon 31 Dec 2018 05:06:44 PM UTC, original submission:  

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.

Rafael Laboissière <rlaboiss>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by lostbard (Posted a comment)
  • -email is unavailable- added by rlaboiss (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-06-07 lostbard StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2019-05-28 lostbard StatusNone Ready For Test
        Assigned toNone lostbard
    2018-12-31 rlaboiss Attached File- Added max-EliteCount-in-ga-unit-test.patch, #45815

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code