bugGNU Octave - Bugs: bug #63858, [octave forge] (optim) fmincon...

 
 

bug #63858: [octave forge] (optim) fmincon fails in Octave 7.1.0, but not Octave 6.3

Submitter:  None
Submitted:  Wed 01 Mar 2023 10:00:56 PM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Fixed Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 7.1.0
Operating System:  * GNU/Linux Fixed Release:  8.1.0
Planned Release:  8.1.0
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Mon 06 Mar 2023 08:23:02 PM UTC, comment #7: 

Marking as fixed and closing report.

Rik <rik5>
Group administrator
Mon 06 Mar 2023 05:42:41 PM UTC, comment #6: 

on my windows system, octave 8.0.90, optim 1.6.2 (and struct 1.0.18 which it also loads), running the comment 0 code produces:


>> [beta_star,f_star,e]=fmincon(@(beta) objfun_g(beta,mg,ms,Lps,params),b0,[],[],[],[],-1,10,[],options);
beta_star = -0.4961
f_star = 1.5425e-14
e = 1


without error

Nicholas Jankowski <nrjank>
Group Member
Mon 06 Mar 2023 04:17:00 PM UTC, comment #5: 

Marking bug as "Need Info".  Can the original reporter upgrade their optim package and report whether the issue is still present?

Rik <rik5>
Group administrator
Thu 02 Mar 2023 09:17:31 AM UTC, comment #4: 

Should have read:

Oops. Didn't notice the OS was set to GNU/Linux.

Markus Mützel <mmuetzel>
Group administrator
Thu 02 Mar 2023 09:16:58 AM UTC, comment #3: 

Oops. Didn't notice the OS was set to 7.1.0.

Anyway, updating the optim package will likely fix this.

Likely a duplicate of bug #62393.

Markus Mützel <mmuetzel>
Group administrator
Thu 02 Mar 2023 07:11:40 AM UTC, comment #2: 

Does the error still occur with the latest version of the optim package?

The latest version is included in Octave for Windows 7.3.0. So, the best world probably be of you updated to that version.

Markus Mützel <mmuetzel>
Group administrator
Wed 01 Mar 2023 10:32:06 PM UTC, comment #1: 

Before octave 7 calling a function with too many arguments was allowed to silently continue. In octave 7 this was changed to give the first error message you received. It tells you that occurred with an anonymous function, this is usually but not always one the user defined. In your code, you only define one anonymous function:

@(beta) objfun_g(beta,mg,ms,Lps,params)


And in both your example and the help text example that's only a one parameter function. So might need to step through the code to see why this is happening

Nicholas Jankowski <nrjank>
Group Member
Wed 01 Mar 2023 10:00:56 PM UTC, original submission:  

Hi,

In the code below, I use fmincon for non-linear optimization. The code seems to work in Octave 6.3, but hits the following error in 7.1.0:

error: @<anonymous>: function called with too many inputs
error: called from
    @<anonymous>
    _dfdp_ at line 304 column 15
    fmincon>@<anonymous> at line 385 column 26
    _jacobian_constants_>@<anonymous> at line 135 column 11
    _octave_sqp_wrapper_>@<anonymous> at line 61 column 19
    sqp at line 364 column 7
    _octave_sqp_wrapper_ at line 76 column 60
    fmincon at line 451 column 24
    test_fmincon at line 35 column 22

Do you know what might be the problem? Does the functionality of fmincon change with newer versions of Octave?


clear
pkg load optim

function alpha=alpha_poly(beta,mgn,msn,Lpn)

betapol=[beta;0];
K=length(beta);
mgn=mean(mgn); msn=mean(msn); Lpn=mean(Lpn,1);

  Hn=0;
for k=1:K
       j=K+1-k;
   Hn=Hn+beta(j)*((msn+log(Lpn)).^k-msn.^k);
endfor
Hn=log(0.01*sum(exp(Hn).*Lpn,2));

alpha=mgn-msn-polyval(betapol,msn)-Hn;
endfunction

function S=objfun_g(beta,mgn,msn,Lpn,param)
A=param(1); B=param(2);
alpha=A+B*beta;
S=alpha-alpha_poly(beta,mgn,msn,Lpn);
S=S'*S;
endfunction

mg = 8.2141
ms = 7.3109
Lps =[ 0.061017      0.065218 0.076858 0.088419 0.099907 0.11133   0.12269   0.13399                  0.14525   0.15646   0.16762   0.17876   0.18987   0.20095   0.21201   0.22306                  0.23409   0.24513   0.25616   0.2672      0.27825   0.28931   0.30039   0.3115                  0.32264   0.33381   0.34502   0.35628   0.36759   0.37895   0.39037   0.40187                  0.41343   0.42508   0.43681   0.44863   0.46056   0.47258   0.48473   0.49699                  0.50938   0.52191   0.53458   0.54741   0.5604      0.57357   0.58692   0.60047                  0.61423   0.6282      0.64241   0.65687   0.67159   0.68659   0.70189   0.71751                  0.73346   0.74976   0.76645   0.78354   0.80107   0.81905   0.83753   0.85654                  0.87612   0.8963      0.91715   0.93869   0.961        0.98414   1.0082      1.0332                  1.0593      1.0865      1.115        1.1449      1.1764      1.2096      1.2447      1.2819                  1.3216      1.3639      1.4094      1.4585      1.5117      1.5697      1.6334      1.7039                  1.7826      1.8714      1.9729      2.0907      2.2299      2.3985      2.6092      2.8842                  3.2668      3.8574      4.9767      14.11                          ]
params = [1.2235; -6.9294]
b0 = .2564
alpha_star=[]; beta_star=[];
options=optimset('Algorithm','octave_sqp');

[beta_star,f_star,e]=fmincon(@(beta) objfun_g(beta,mg,ms,Lps,params),b0,[],[],[],[],-1,10,[],options);

Anonymous

 

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

Attach Files:
   
   
Comment:
   

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 rik5 (Posted a comment)
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by nrjank (Posted a comment)
  •  

    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 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-03-06 rik5 Open/ClosedOpen Closed
    2023-03-06 rik5 StatusNeed Info Fixed
        Fixed ReleaseNone 8.1.0
        Planned ReleaseNone 8.1.0
    2023-03-06 rik5 CategoryOctave Function Octave Package
        Item GroupNone Unexpected Error or Warning
        StatusNone Need Info
    2023-03-02 mmuetzel Summaryfmincon fails in Octave 7.1.0, but not Octave 6.3 [octave forge] (optim) fmincon fails in Octave 7.1.0, but not Octave 6.3

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code