octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #59166] Error in function fmincon (package opt


From: anonymous
Subject: [Octave-bug-tracker] [bug #59166] Error in function fmincon (package optim)
Date: Tue, 22 Sep 2020 16:40:43 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0

URL:
  <https://savannah.gnu.org/bugs/?59166>

                 Summary: Error in function fmincon (package optim)
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Tue 22 Sep 2020 08:40:41 PM UTC
                Category: Octave Forge Package
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Unexpected Error or Warning
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: 5.2.0
         Discussion Lock: Any
        Operating System: GNU/Linux

    _______________________________________________________

Details:

Hello all,


the function *fmincon* (package optim, version 1.6) throws an error and also
gives wrong results when using nonlinear inequality constraints in the shape
of a function handle as the variable _nonlcon_. The error is "Initial
parameters violate constraints." in the function __lm_feasible__ at line 92
column 5, although the constraints are not violated. The responsible line of
code, 

any(abs (pin_cstr.equ.gen) >= nz))

does not make sense to me because the inequality should be permissible on one
side, which however is denied by the absolute value.

The same error has been reported here:
https://octave.discourse.group/t/problem-with-fmincon-package-optim/84


Furthermore, if I change line 92 of lm_feasible to not throw an error, the
optimization is actually not performed. Sometimes, the solution exactly
corresponds to the inequality constraints.


Minimal example:


pkg load optim

t = (400:10:570)';
y = [.02;.1;.05;.2;.4;1;1.2;1.4;1.8;
       2.2;2.1;1.7;1.5;1.1;.8;.3;.01;.2;];

F_error = @(L,A,R,W) sum(abs((A.*exp(-(L-R).^2 / W.^2) - y).^2))
objective_function = @(z) F_error(t,z(1),z(2),z(3))

pin = [2.1;494;sqrt(140)];
constraint_function = @ (p) [p(1)-2.2;-p(2)+490];  % p(1) smaller than 2.2 and
p(2) larger than 490
constraint_function(pin)   % 

% unconstrained solution
p_unconstrained = fminsearch(objective_function,pin)

clear p
[p, objf, cvg, outp] = fmincon (objective_function, pin, [], [], [], [], [],
[], @ (p) {[], constraint_function(p)}{:})






    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?59166>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]