bugGNU Octave - Bugs: bug #66421, sqp doesn't accept scalar bounds...

 
 

bug #66421: sqp doesn't accept scalar bounds as suggested in docs

Submitter:  None
Submitted:  Thu 07 Nov 2024 12:13:16 AM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Documentation
Status:  Ready For Test Assigned to:  None
Originator Name:  Jan Behrens Originator Email:  -email is unavailable-
Open/Closed:  * Open Release:  * 9.2.0
Operating System:  * Any Fixed Release:  None
Planned Release:  9.3.0 (current stable)
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 19 Nov 2024 03:27:15 PM UTC, comment #2: 

Thank you for the patch. I pushed a very slightly modified version to the stable branch:
https://hg.savannah.gnu.org/hgweb/octave/rev/59bf75286bae

Marking as ready for test.

Markus Mützel <mmuetzel>
Group administrator
Fri 15 Nov 2024 07:43:19 AM UTC, comment #1: 

I think that the documentation should be updated removing the documented but not implemented behavior/”feature”  that "A bound can also be a scalar in which case all elements of X will share the same bound.":

1) I do not think that this behavior was ever implemented (I only looked at the first sqp.m version available in the current mercurial which is from 2012 and this behavior was not supported as well).

2) Matlab does not offer such a behavior in its fmincon wrapper (analogue to the octave optim package): a bound with less elements (which includes a scalar) than x0 sets only the FIRST dimensional bounds, so a scalar would only bound x(1) with no bound for x(2) … x(n).

3) In reality few multidimensional optimization problems will have identical bounds for all dimensions. So no need to support this and other languages like e.g. Python’s sqp function do not support this as well.

A patch is attached updating the documentation.

(file #56615)

Hendrik K <koerhen>
Thu 07 Nov 2024 12:13:16 AM UTC, original submission:  

Documentation of the sqp function states: "A bound can also be a scalar in which case all elements of X will share the same bound."

However, the following call does not work:


octave:1> sqp([0; 0], @(x) 0, [], [], -1, 1)
error: lb(2,_): out of bound 1 (dimensions are 1x1)
error: called from
    sqp at line 303 column 20


This should be fixed or documentation should be updated accordingly. Apparently it works if the bounds are a vector:


octave:2> sqp([0; 0], @(x) 0, [], [], [-1;-1], [1;1])
ans =

   0
   0


Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #56615:  66421.patch added by koerhen (1KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by nrjank (Updated the item)
  • -email is unavailable- added by koerhen (Updated the item)
  • -email is unavailable- added by None (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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-11-19 mmuetzel StatusPatch Submitted Ready For Test
        Planned ReleaseNone 9.3.0 (current stable)
    2024-11-19 mmuetzel Item GroupUnexpected Error or Warning Documentation
    2024-11-15 nrjank Operating SystemBSD Any
    2024-11-15 nrjank StatusNone Patch Submitted
    2024-11-15 koerhen Attached File- Added 66421.patch, #56615

    Back to the top

    Powered by Savane 3.14-f13d.
    Corresponding source code