bugGNU Octave - Bugs: bug #63326, [octave forge] (ga) ga function...


bug #63326: [octave forge] (ga) ga function output unbounded results

Submitter:  Liang Tang <lt1234>
Submitted:  Mon 07 Nov 2022 11:16:14 AM UTC
Category:  Octave Forge Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Confirmed Assigned to:  None
Originator Name:  lt1234 Open/Closed:  * Open
Release:  * 7.1.0 Operating System:  * Microsoft Windows
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment (Rich Markup)

Comment Type & Canned Response:


Wed 09 Nov 2022 02:15:41 PM UTC, comment #3: 

I think the more correct ga options for the simple example below should be

ga_options = gaoptimset('Generations', 100, 'PopulationSize', 30, 'PopInitRange', [LB,UB],  'Vectorized', 'off');

Without any workaround, the output remains the same, x=0.  Thanks.

Liang Tang <lt1234>
Mon 07 Nov 2022 01:53:20 PM UTC, comment #2: 

Hi John, I would also recommend you to verify if other constraints are actually applied. 

I place a brutal work around in _ga_problem_ near Line 80 to get around the issue. It is a wrong way to fix this UB/LB issue. 

NextPopulation=min(max(NextPopulation, LB), UB);


Liang Tang <lt1234>
Mon 07 Nov 2022 01:21:31 PM UTC, comment #1: 

looking at the code, it does look like lb and ub are not currently used anywhere

John Donoghue <lostbard>
Project Member
Mon 07 Nov 2022 11:16:14 AM UTC, original submission:  

I use Octave 7.1.0 with ga 1.10.3 on windows 10 64x. 

ga *|  0.10.3 | C:\Octave\Octave-7.1.0\mingw64\share\octave\packages\ga-0.10.3

The one variable simple problem below gave a wrong answer. x=0 is output.  The correct result should be x=LB. 

LB/UB appear to be ineffective.  I have not found any document to indicate if there are limitations on ga function. 

pkg load ga
fun=@(x) x.^2
x0=1.75; LB=1; UB=2;
ga_options = gaoptimset('Generations', 100, 'PopulationSize', 30, 'InitialPopulation', x0,  'Vectorized', 'off');
[x, fval, exitflag, output, population, scores] = ga (fitnessfcn=fun, nvars=1, A=[], b=[], Aeq=[], beq=[], LB, UB, nonlcon=[], ga_options);x  % x = -1.9613e-11 or some other near zero values


Liang Tang <lt1234>


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

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Updated the item)
  • -email is unavailable- added by lostbard (Posted a comment)
  • -email is unavailable- added by lt1234 (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 project members can vote.





    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-11-07 mmuetzel SummaryOctave Forge ga package/function output unbounded results [octave forge] (ga) ga function output unbounded results
    2022-11-07 lostbard StatusNone Confirmed

    Back to the top

    Powered by Savane 3.9