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


bug #35333: [octave forge] (optim) implement fmincon via a wrapper for sqp

Submitter:  Ben Abbott <bpabbott>
Submitted:  Fri 20 Jan 2012 01:56:00 AM UTC
Category:  Octave Forge Package Severity:  1 - Wish
Priority:  3 - Low Item Group:  Feature Request
Status:  Confirmed Assigned to:  None
Originator Name:  Ben Abbott Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment (Rich Markup)

( Jump to the original submission )

Sat 09 Apr 2022 10:13:01 AM UTC, comment #10: 

Going through old bug reports. This one looks resolved -- there's been an fmincon for several years now. Can it be closed or are three pending items for this report?

Arun Giridhar <arungiridhar>
Project Member
Sat 04 May 2019 09:10:03 AM UTC, comment #9: 

I have installed optim-1.6.0 on a current build from the default branch. When using the stable branch, the error does not occur.

Torsten Lilge <ttl>
Project Member
Fri 03 May 2019 02:47:40 PM UTC, comment #8: 

I don't get this error with the released package optim-1.6.0, and I can't see in inst/private/__jacobian_constants__.m how this error should ever happen. Maybe your version of the latter function is different from that in the released package.

Olaf Till <i7tiol>
Project Member
Fri 03 May 2019 05:10:19 AM UTC, comment #7: 

Thanks for providing the fmincon frontend. What is the current state in optim 1.6.0? When using fmincon from optim 1.6.0 I get the following error, even for very simple examples:

error: 'fname' undefined near line 135 column 14
error: called from
    __jacobian_constants__>@<anonymous> at line 135 column 11
    __lm_feasible__ at line 145 column 8
    fmincon at line 417 column 24
    fmincon_test at line 6 column 3

Torsten Lilge <ttl>
Project Member
Wed 02 Jan 2019 11:40:22 AM UTC, comment #6: 

I pushed a new fmincon to optim yesterday:


Not a wrapper, but uses some of the same subfunctions as the other frontends (after putting much code of these into subfunctions).

Contrary to nonlin_min, fmincon offers only 2 algorithms, Octaves sqp function and optims "lm_feasible" algorithm. According to


, the default algorithm of fmincon "satisfies bounds at all iterations". So I thought I make optims "lm_feasible" algorithm the default, which satisfies all constraints (not only bounds) at all iterations. However, sqp performs better than "lm_feasible" for problems with many constraints. Maybe the choice of the default algorithm should be discussed.

Returning gradient, Hessian, and lambda is not implemented. The handling of this is partially implemented in other frontends of optim, but needs re-working. I think there should be an extra function for computing gradient, Hessian, and lambda at the result, independently from the algorithm. Currently, some frontends return a lambda which is not well usable for assessing the influence of constraints onto the result.

Olaf Till <i7tiol>
Project Member
Fri 26 Oct 2018 03:13:48 PM UTC, comment #5: 

Thanks for the info.  I wasn't aware of the capabilities of nonlin_min.

Yes, I understand that fmincon in Matlab provides multiple algorithms to choose from.  My goal was primarily to get something started that would provide a compatible interface, even if only one requested method is implemented.  My idea was that until other methods were implemented, the others could warn and use the only available method and that other issues can be fixed later.

If nonlin_min already provides multiple methods, then we could certainly use that.  I'm not looking to provide an fmincon functoin that competes with anything.  I would just like to have a function with an interface compatible with fmincon, at least as much as possible.

If there are compatibility problems with sqp or other algorithms, then we can address those problems individually.  I'm not expecting this job to be done all at once.  Any help you can offer would be welcome, but I am certainly not expecting you (or anyone else) to do the work.  I asked here to see if I could get some feedback.

John W. Eaton <jwe>
Project Administrator
Fri 26 Oct 2018 09:25:52 AM UTC, comment #4: 

Matlabs fmincon is rather an interface to different algorithms, which one can choose from. There is an alternative to fmincon in the optim package, called nonlin_min (one of its possible algorithms is just a wrapper to Octaves sqp). I valued some details in the design of nonlin_min higher than making an interface compatible to fmincon. If such compatibility is still required, I thought, it can be achieved with a wrapper to nonlin_min.

If wrapping just sqp suffices depends on how much compatibility you want. No choice between algorithms, of course. Returning lambda in a compatible way won't work due to some ordering problem in sqp (fixable in sqp? Asma interfaced Octaves _qp_ directly to work around this problem for quadprogn).

What I wouldn't suggest is trying to make a fully fledged comprehensive implementation of fmincon within Octave, 'competing' with optims nonlin_min. But well...

If you think it's important I could try to complete Asmas nonlin_min wrapper, thereby fixing necessary things in the backends. It'll take some time, since currently I've only 3 days per week when I can spend a little time for Octave. The other possibility (or a preliminary solution?) is to implement only a basic fmincon in Octave, wrapping sqp (or _qp_, for lambda).

Olaf Till <i7tiol>
Project Member
Mon 22 Oct 2018 09:15:56 PM UTC, comment #3: 

I also have a wrapper from some years ago that I was planning to use, but then found this bug report.  Either way, I'd like to get a compatible fmincon function in Octave or the optim package.  I'll take a look at the GSoC work and merge with my code.


John W. Eaton <jwe>
Project Administrator
Fri 18 Nov 2016 10:33:59 PM UTC, comment #2: 

Work for this was done under GSoC 2016, see https://github.com/AsmaAfzal/octave_workspace/blob/master/fmincon.m for the current work done so far. It has not yet been incorporated into the optim package.

Mike Miller <mtmiller>
Project Administrator
Mon 28 Oct 2013 02:45:16 AM UTC, comment #1: 

Recategorizing for Octave Forge, this could be added to the optim package, right?

If the wrapper is simple enough I suppose it could be implemented in Octave itself, feel free to update if that is the case.

Mike Miller <mtmiller>
Project Administrator
Fri 20 Jan 2012 01:56:00 AM UTC, original submission:  

Can an m-file wrapper be written to implement an optimization function that would be compatible with Matlab's fmincon() ?


Ben Abbott <bpabbott>
Project Member


(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 arungiridhar (Posted a comment)
  • -email is unavailable- added by ttl (Posted a comment)
  • -email is unavailable- added by i7tiol (Posted a comment)
  • -email is unavailable- added by jwe (Updated the item)
  • -email is unavailable- added by bpabbott (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 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-05-29 mtmiller Carbon-CopyRemoved 80942 -
    2017-08-13 jwe Summaryoptim package: implement fmincon via a wrapper for sqp [octave forge] (optim) implement fmincon via a wrapper for sqp
    2016-11-18 mtmiller Priority5 - Normal 3 - Low
        Summaryimplement fmincon via a wrapper for sqp optim package: implement fmincon via a wrapper for sqp
    2013-10-28 mtmiller CategoryInterpreter Octave Forge Package
        Severity3 - Normal 1 - Wish
        StatusNone Confirmed

    Back to the top

    Powered by Savane 3.11