octave-maintainers
[Top][All Lists]
Advanced

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

Re: lsqnonlin and nonlin_residmin


From: Olaf Till
Subject: Re: lsqnonlin and nonlin_residmin
Date: Wed, 5 Aug 2015 17:31:35 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

On Wed, Aug 05, 2015 at 04:06:41PM +0100, Asma Afzal wrote:
> > 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.

Well, I can't see why this is a reason for a 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)

I never used classes myself, and as yet only informed myself about the
traditional classes, not about classdef, and this seems to need some
classdef knowledge ... . As I said, the dot-notation as a class name
is new to me. I can't even assess at the moment if it's advisable to
adher to Matlabs way of constructing these classes or not.

Either you find someone else to discuss this with, or you can work it
out yourself, or you have to wait until I've caught up with you with
respect of classdef knowledge. Sorry.

Olaf

-- 
public key id EAFE0591, e.g. on x-hkp://pool.sks-keyservers.net

Attachment: signature.asc
Description: Digital signature


reply via email to

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