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

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

[Octave-bug-tracker] [bug #63286] [octave forge] (optim) fmincon error w


From: Liang Tang
Subject: [Octave-bug-tracker] [bug #63286] [octave forge] (optim) fmincon error with anonymous function
Date: Sat, 29 Oct 2022 06:05:34 -0400 (EDT)

Follow-up Comment #7, bug #63286 (project octave):

There are two items below.  One is about the initial value in my prior comment
and the other is for the 4th argument in fmincon output, OUTP.   


(1) The url is https://www.mathworks.com/help/optim/ug/fmincon.html.  The
exact example is below.  

>> fun = @(x)100*(x(2)-x(1)^2)^2 + (1-x(1))^2;
>> x0 = [-1,2];
>> A = [1,2];
>> b = 1;
>> x = fmincon(fun,x0,A,b)
error: Initial parameters violate constraints.
error: called from
    __lm_feasible__ at line 92 column 5
    fmincon at line 451 column 24

>> x = fmincon(fun,x0=[1 0]',A,b)
x =

   0.5022
   0.2489

(2) The 1.6.2 fmincon also continues to have an issue (in Octave 7.1.0) with
OUTP argument. Output worked in 1.6.0.  What below is from 1.6.2.  1.6.1
produced the same.  

>> fun=@(x) sum(x.^2)
fun =

@(x) sum (x .^ 2)

>> [X, FVAL, CVG, OUTP]=fmincon (OBJF=fun, [0 0], A=[], B=[], AEQ=[], BEQ=[],
LB=[0 0], UB=[1 1])
error: operator *: nonconformant arguments (op1 is 4x2, op2 is 1x2)
error: called from
    __constraints_interface__>@<anonymous> at line 113 column 56
    fmincon at line 466 column 12

>> [X, FVAL, CVG]=fmincon (OBJF=fun, [0 0], A=[], B=[], AEQ=[], BEQ=[], LB=[0
0], UB=[1 1])
X =

   0   0

FVAL = 0
CVG = 2


In Octave 5.3 & optim 1.6.0, 

>>  [X, FVAL, CVG, OUTP]=fmincon (OBJF=fun, [1 1], A=[], B=[], AEQ=[], BEQ=[],
LB=[0 0]', UB=[1 1]')
X =

   0
   0

FVAL = 0
CVG =  2
OUTP =

  scalar structure containing the fields:

    user_interaction =

      scalar structure containing the fields:

        stop = [](0x1)
        info = {}(0x1)

    niter =  2
    nobjf =  2
    constrviolation = -0
 
Thanks,



    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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