bugGNU Octave - Bugs: bug #41915, fminsearch: problem with anonymous...

 
 

bug #41915: fminsearch: problem with anonymous function and options

Submitted by:  Hartmut <hardy>
Submitted on:  Thu 20 Mar 2014 09:04:36 PM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
Release: 3.8.1Operating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Sat 29 Mar 2014 06:50:14 PM UTC, comment #6:

I checked in a changeset that changes optimget() and thereby fixes the example in this bug report. The fix was done on the development branch (http://hg.savannah.gnu.org/hgweb/octave/rev/8d4d78285c8e). In order to see the fix you will need to wait until the 4.2 release, which could be a very long time, or simply grab the optimset.m and optimget.m files from Mercurial (there is a web interface at http://hg.savannah.gnu.org/hgweb/octave/).

Rik <rik5>
Project Administrator
Wed 26 Mar 2014 08:50:53 PM UTC, comment #5:

Thanks for the testing. I can see how to fix this now, but I probably can't get to it until the weekend.

Rik <rik5>
Project Administrator
Wed 26 Mar 2014 08:25:45 PM UTC, comment #4:

You were right, Matlab does return the value 100 (which is obviously the same as 1e2) for the optimget commmand you wrote.

By the way, I have also notice another difference between Matlab and Octave. The command
does produce different results:

  • Matlab returns a big struct with a lot of empty fields, and only one field with content, the TolX field. I have attached textfile that shows thte Matlab result.
  • Octave returns a struct with onyl one field, the TolX field.

I dont' know if this difference to Matlab has anything to do with the topic of this bug.

(file #31051)

Hartmut <hardy>
Mon 24 Mar 2014 10:42:52 PM UTC, comment #3:

This is kind of what I expected was happening. What does Matlab do for this piece of code?

I think it will return 1e2, while Octave returns [].

If that is the case, this is pretty easy to fix inside optimget.

Rik <rik5>
Project Administrator
Mon 24 Mar 2014 07:48:48 PM UTC, comment #2:

I have checked what Matlab and Octave give as results of

You find the detailed results in the two attached text files. (Matlab version is 7.11.0 which is R2010b, Octave version is 3.8.1)

BOTH results are a struct of several named fields, with all the field values being empty. Matlab has some more fields, but I assume that the Octave version of optimset will generate all necessary fields for the Octave version of fminsearch.

So the bottom line might be, that fminsearch in Octave should be able to deal with option structs that contain empty values.

(file #31028, file #31029)

Hartmut <hardy>
Fri 21 Mar 2014 04:29:40 AM UTC, comment #1:

What is the result of

in Matlab?

I think the problem is that the above command in Octave is creating a structure where every named field, like 'TolX', has an empty value.

Rik <rik5>
Project Administrator
Thu 20 Mar 2014 09:04:36 PM UTC, original submission:

Here is an example that shows the behavior:

  • myfun.m contains:
  • The demo script is:

Octave throws an error message: "error: parse_options: A(I) = X: X must have the same size as I".

In Matlab the very same script returns a useful result. Since I haven't found where this usage of fminsearch violates its documented behavior, I've reported this as "incorrect result" for now, but maybe I'm wrong.

Note: If you leave out the options, then the script runs totally fine in Octave (as well as in Matlab), but obviously without your intended options:

Hartmut <hardy>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #31051:  optimset_matlab.txt added by hardy (2KiB - text/plain)
file #31028:  options_Matlab.txt added by hardy (2KiB - text/plain)
file #31029:  options_Octave.txt added by hardy (404B - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by hardy (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 29 Mar 2014 06:50:14 PM UTCrik5StatusIn Progress=>Fixed
      Open/ClosedOpen=>Closed
    Wed 26 Mar 2014 08:25:45 PM UTChardyAttached File-=>Added optimset_matlab.txt, #31051
    Mon 24 Mar 2014 10:42:52 PM UTCrik5StatusNone=>In Progress
    Mon 24 Mar 2014 07:48:48 PM UTChardyAttached File-=>Added options_Matlab.txt, #31028
      Attached File-=>Added options_Octave.txt, #31029

    Back to the top


    Powered by Savane 3.1-cleanup1