[Insight-users] Re: itk Gradient Descent Optimizer

Luis Ibanez luis.ibanez@kitware.com
Wed, 23 Oct 2002 14:26:41 -0400


Hi digvijay

const correctness is good
const correctness is good
const correctness is good
const correctness is good

...

The reason why GetValue() and GetDerivative() must
be const methods in the itk:: cost function is that
the evaluation of a function should *not* make the
function change.

This is particularly important in the framework of
optimization. If your CostFunction keeps changing
every time you evaluate it, how can the optimizer
keep track of the functions behavior ?

It will start looking like quantum mechanics...  :-)


That being said,

If the CostFunction requires internal auxiliary
variables to change *and* you can guarrantee that
these variables do not represent the state of the
cost function, then you can take advantage of the
"mutable" keyword.

Just declare these auxiliary variables "mutable"
in the class declaration. This will enable them
to be modified inside 'const' methods.

Be careful, using "mutable" is not a good practice
in general. You may want to prepare a good explanation
of why do you need to use it.

I would suggest to step back a little bit in your
code, reconsider the design of the classes and
the distribution of responsibilites among them.

As far as I could see from your code, you seem
to be optimizing a redistribution of the image
histogram based in some quality metric. Is that
right ?

Could you describe the top level of what you are
implementing,

The gradient descent optimizer is not implementing
constraints. You could simulate this behavior
by using lagrange multipliers and computing a
contribution of the constrainst to the CostFunction
value.



    Luis


===================================================

digvijay singh wrote:
> hi luis!!
> The declaration of GetValue() and GetDerivative() as
> const imposes limitations on controlling the limits of
> specific parameters. If i need to constraint the
> growth of parameter 1 to say within 15 % of its value
> how could i do that...the trueparameters just seems to
> return the goodness of fit in some way....kindly
> advise..
> thanks
> digvijay
> 
> __________________________________________________
> Do you Yahoo!?
> Y! Web Hosting - Let the expert host your web site
> http://webhosting.yahoo.com/
> 
>