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


bug #64500: [octave forge] (optim) fmincon equality constraint handling - nz

Submitter:  Liang Tang <lt1234>
Submitted:  Mon 31 Jul 2023 10:23:31 PM UTC
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Feature Request
Status:  None Assigned to:  None
Originator Name:  lt1234 Open/Closed:  * Open
Release:  * 8.2.0 Operating System:  * Microsoft Windows
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Sun 06 Aug 2023 11:15:47 PM UTC, comment #1: 

I looked up matlab document on-line.  This tolerance appears to be option field TolCon in matlab.  Thanks.

Liang Tang <lt1234>
Mon 31 Jul 2023 10:23:31 PM UTC, original submission:  

This line below occurs six times in optim 1.6.2

nz = 200 * eps; # This is arbitrary. Accuracy of equality constraints.

I recommend that nz be controlled by the user through options.

To see the effect of nz, an example is provided.

fun=@(x) sum(x.^2); X0=[10 11]';
Aeq=[1 -1]; Beq=[0]; % X(1)-X(2)=0
Aieq=[]; Bieq=[];
lb=[1 1]'; ub=[12 12]';
[X, FVAL, CVG,  outp]= fmincon (fun, X0, Aieq, Bieq, Aeq, Beq, lb, ub, nonlcon=[]);

error: Initial parameters violate constraints.
error: called from
    _lm_feasible_ at line 93 column 5
    fmincon at line 456 column 24

% try to satisfy the constraint (it works this time but it is not always true)

fcn=@(x) Aeq*x-Beq;
[X0, FVAL, INFO, OUTPUT, FJAC] = fsolve(fcn, X0);
[X, FVAL, CVG,  outp]= fmincon (fun, X0, Aieq, Bieq, Aeq, Beq, lb, ub, nonlcon=[])

Depending on the complexity of fcn and options, fsolve may not result in a solution that will meet 200*eps (4e-16) in fmincon.  We can continue to reduce TolX & TolFun for fdolve.  But a possible approach seems to be to relax nz or allow users to adjust nz as they wish (like TolX & TolFun).  I recommend the latter.  Thanks.   

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 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 group members can vote.


    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-08-01 mmuetzel Carbon-CopyRemoved 102357 -
    2023-08-01 mmuetzel Summaryfmincon equality constraint handling - nz [octave forge] (optim) fmincon equality constraint handling - nz

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code