Re: [eigen] Non linear solver questions |

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]

*To*: eigen@xxxxxxxxxxxxxxxxxxx*Subject*: Re: [eigen] Non linear solver questions*From*: Koldo Ramirez <koldo.ramirez@xxxxxxxxx>*Date*: Mon, 13 Jun 2011 08:40:07 +0200*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references :x-goomoji-body:date:message-id:subject:from:to:content-type; bh=wGYMdcW1s2OGVndOMbhKZKoKPHFUkqVumF222Kol5HQ=; b=Kp4qP08xlqV/iyd8GOsIae/y8avAuDYN8AXMmgpdSRA7ouruXbhlXF6DTCZFjQxiD5 +IDb9/EUf84injrJ9BQVDdLY/N7DD7IFSIW3EEuxtSuvmKWnf2u2nITLj9MXVcRI8sZd 6pWD2YLEiODa1IgpXUnWCC9K/eZIkO03zfWUs=*Domainkey-signature*: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:x-goomoji-body:date:message-id :subject:from:to:content-type; b=VD9hXETo1jeAlvn75Ki7ZjsmKcBL6zt+YUrbFJxi7SU8VbqGbtx63lPiYVoVXf/qsy UfWEaT78nu/44sQSlktNFm+yMtGzTxJppoLabfU3hTOXx61zp7Mb1PvelSYd1zzxcytz nmZ7Dyxb+LgTPE7tPHdSK3u/k/adD/GHLhGMI=

Thank you Thomas.

Are there any ODE or DAE solver for the next future?

Best regards

Koldo

On Mon, Jun 13, 2011 at 12:03 AM, Thomas Capricelli <orzel@xxxxxxxxxxxxxxx> wrote:

Hi,

Sorry for the delay, I was away from internet for the whole last week, which is pretty unusual for me. Here are my answers.

On Friday 10 June 2011 09:19:31 Koldo Ramirez wrote:

> For example, look at this code:

>

> VectorXd x(2);

>

> hybrd_functor functor;

> HybridNonLinearSolver<hybrd_functor> solver(functor);

> solver.parameters.nb_of_subdiagonals = 1;

> solver.parameters.nb_of_superdiagonals = 1;

> solver.diag.setConstant(n, 1.);

> solver.useExternalScaling = true;

> if (solver.solveNumericalDiff(x) != 1)

> Cout() << "No convergence!";

>

> Questions:

> - What is the purpose of nb_of_subdiagonals, superdiagonals, setConstant(),

> useExternalScaling and another parameters?

There is an optimization for the case where the jacobian is known to be 'banded' as in http://en.wikipedia.org/wiki/Banded_matrix

You can see the big "if (msum>=n)" in fdjac1.h

The default value (-1) for sub/super diagonals means that the jacobian is dense (not banded).

The optimizer uses weighting (or scaling). It can either use what it thinks is the best (default case), or use scaling values provided by the user (there are cases where the use knows better than the default case).

This is what useExternalScaling does. If it set to False, solve.diag is not used at all. If it is set to True, then solve.diag provides the weighting used by the algorithm.

More information can be found from the two PDFs found on :

http://devernay.free.fr/hacks/cminpack/cminpack..html

> - Are there other parameters to indicate max. number of iterations and

> required precision?

solver.parameters.maxfev can be set to give a maximum number of 'function evaluations', which is as close as possible to "number of iterations". One step of the algorithm can trigger several function evaluation.

solver.parameter.xtol and solver.parameter.epsfcn can be set to tweak the precision parameters. The previous PDF url provide the original documentation about those.

Default values are ok for most cases.

> - If solveNumericalDiff() returns 1 the solver has converged successfully.

> Are there other parameters to check the quality of the results?

It's somewhat more complicated. solveNumericalDiff(), as other methods in this optimizer, returns a 'Status' (described at the very beginning of HybridNonLinearSolver.h).

Running = -1,

ImproperInputParameters = 0,

RelativeErrorTooSmall = 1,

TooManyFunctionEvaluation = 2,

TolTooSmall = 3,

NotMakingProgressJacobian = 4,

NotMakingProgressIterations = 5,

UserAsked = 6

UserAsked means that the functor function returned a negative value (which allow the functor to stop the algorithm, this is mainly used for interactive run of the algorithm).

Running and ImproperInputParameters are easy to understand.

All other values mean that the algorithm stopped, and the value provides detail about the stop criteria that triggered the stop. It provides an information about the quality of result.

> - You use a "functor" struct which calculates the equations and gives the

> Jacobian if available. Could have been possible to use a pointer to a

> function instead?

It could. This is a technical choice. Using a functor is more "c++" and is more coherent with other parts of Eigen..

best wishes,

Thomas

--

Thomas Capricelli <orzel@xxxxxxxxxxxxxxx>

http://www.freehackers.org/thomas

**References**:**[eigen] Non linear solver questions***From:*Koldo Ramirez

**Re: [eigen] Non linear solver questions***From:*Thomas Capricelli

**Messages sorted by:**[ date | thread ]- Prev by Date:
**[eigen] Regression in LDLT** - Next by Date:
**Re: [eigen] Non linear solver questions** - Previous by thread:
**Re: [eigen] Non linear solver questions** - Next by thread:
**Re: [eigen] Non linear solver questions**

Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |