octave-maintainers
[Top][All Lists]
Advanced

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

Re: lsqnonlin and nonlin_residmin


From: Asma Afzal
Subject: Re: lsqnonlin and nonlin_residmin
Date: Wed, 5 Aug 2015 16:06:41 +0100

> I have no Matlab installed, and I'm not sure if we can use information
> on implementation details from its inbuilt help for coding.
>
> I thought you could implement a class, as documented in current stable
> Octave, for options objects. I didn't think it's necessary that the
> implementation details are similar to what Matlab does. But I seem to
> be missing something.

Implementation does not have to be exactly same but if we use
optimoptions for updating options or transferring default options of
some other solver, for eg:

oldopts = optimoptions ('fmincon', 'TolX', 1e-10)
opts = optimoptions ('fmincon', oldopts, 'TolFun', 1e-10 )

the object oldopts belongs to class optim.options.Fmincon.
If I try to pass a random object then Matlab gives an error. It only
accepts objects from class optim.options.SolverName.

That is where I thought we needed similar implementation.

> You seem to talk of 'optim.options.Fmincon' as being a function call
> which is not associated to a variable. If so, this syntax is unknown
> to me and I can't help, sorry. Or is 'optim' an ordinary structure
> variable and its subfield 'options.Fmincon' an options object? But
> then you couldn't access it whithin called functions without making
> 'optim' global...

I don't really know what it is internally. But the closest
implementation I could think of was to have a static method "Fmincon"
(in class options) instantiating a class Fmicnonopts containing
default opts. Example:

*********
classdef options

  methods (Static)
    ##All solvers Fmincon, Lsqnonlin, quardprog, etc.
    function obj1 = Fmincon (varargin) % input name-value pairs
       obj1 = fminconopts(varargin);
    endfunction
  end

end

************
classdef fminconopts
  properties %defaults for fmincon
    TolX;
    TolFun;
    .
    .
    .
  end

  methods
     val = Fmincon(varargin)
         ## Compare fields (case-insensitive) and set applicable
         ##fields as in optimset.
     endfunction

     function disp(val)
        ## Fucntionality to display the
        printf('TolX: %d \n',val.TolX)
        printf('TolFun: %d \n',val.TolFun)
     endfunction
  end
end
**********************
Running options.Fmincon generates an object of class fminconopts which
is understandable (unlike Matlab where running optim.options.Fmincon
generates an object of class optim.options.Fmincon)


Kind Regards,
Asma.



reply via email to

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