seacode / gmacs

A generic size-structured stock assessment model
https://seacode.github.io/gmacs
18 stars 14 forks source link

Add iterator to brute force initial conditions #169

Open quantifish opened 8 years ago

quantifish commented 8 years ago

Rather than user specifying the number of iterations could just iterate until the init nums stabilize within some tolerance (using a do/while loop or whatever)

smartell commented 8 years ago

You don't want to do this if it involves dvariables. Reason is that the derivative information will be corrupt if you have a variable number of iterations. Unless you write the associated adjoint code, you'll have to use a fixed number of iterations to preserved the correct derivative information.

quantifish commented 8 years ago

Ah huh makes sense, thanks Steve.

Perhaps I could add a little snippet of code at the end that ensures that the number of iterations used has resulted in equilibrium numbers at length and throws an error code if not.

smartell commented 8 years ago

Or solve the system of linear equations.

On May 9, 2016, at 9:53 AM, Darcy Webber notifications@github.com wrote:

Ah huh makes sense, thanks Steve.

Perhaps I could add a little snippet of code at the end that ensures that the number of iterations used has resulted in equilibrium numbers at length and throws an error code if not. — You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/seacode/gmacs/issues/169#issuecomment-217921959

quantifish commented 8 years ago

Or that. Could be tricky with different things happening in different seasons etc.

On 16-05-09 08:54 AM, Steve Martell wrote:

Or solve the system of linear equations.

On May 9, 2016, at 9:53 AM, Darcy Webber notifications@github.com wrote:

Ah huh makes sense, thanks Steve.

Perhaps I could add a little snippet of code at the end that ensures that the number of iterations used has resulted in equilibrium numbers at length and throws an error code if not. — You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/seacode/gmacs/issues/169#issuecomment-217921959

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/seacode/gmacs/issues/169#issuecomment-217922269


D'Arcy Webber, PhD Quantifish | Quantitative Marine Science Solutions P: +6421 0233 0163 E: darcy@quantifish.co.nz

W: www.quantifish.co.nz

smartell commented 8 years ago

I see your point now. I guess if you want to avoid writing a bunch of basis functions, then a numerical solution is the only alternative. Hmm, you could throw an error code I suppose, but you don’t want it to crash per say. I’d just keep track of the delta’s in each iteration, then print out the value of the delta to the report file, or the screen if it is !=0.

On May 9, 2016, at 9:53 AM, Darcy Webber notifications@github.com wrote:

Ah huh makes sense, thanks Steve.

Perhaps I could add a little snippet of code at the end that ensures that the number of iterations used has resulted in equilibrium numbers at length and throws an error code if not. — You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/seacode/gmacs/issues/169#issuecomment-217921959

quantifish commented 8 years ago

Yah good call, I'll go with that. Cheers mate

On 16-05-09 09:00 AM, Steve Martell wrote:

I see your point now. I guess if you want to avoid writing a bunch of basis functions, then a numerical solution is the only alternative. Hmm, you could throw an error code I suppose, but you don’t want it to crash per say. I’d just keep track of the delta’s in each iteration, then print out the value of the delta to the report file, or the screen if it is !=0.

On May 9, 2016, at 9:53 AM, Darcy Webber notifications@github.com wrote:

Ah huh makes sense, thanks Steve.

Perhaps I could add a little snippet of code at the end that ensures that the number of iterations used has resulted in equilibrium numbers at length and throws an error code if not. — You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/seacode/gmacs/issues/169#issuecomment-217921959

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/seacode/gmacs/issues/169#issuecomment-217923914


D'Arcy Webber, PhD Quantifish | Quantitative Marine Science Solutions P: +6421 0233 0163 E: darcy@quantifish.co.nz

W: www.quantifish.co.nz