Re: Iteration Interupt
- To: mathgroup at smc.vnet.net
- Subject: [mg43347] Re: Iteration Interupt
- From: Robert Knapp <rknapp at wolfram.com>
- Date: Tue, 26 Aug 2003 07:13:20 -0400 (EDT)
- Organization: Wolfram Research, Inc.
- References: <bi7meb$osm$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Jason Sidabras wrote: > Hello, > I was wondering if anyone knew a way to interrupt a calculation that would > produce an answer. > > More specifically, I am currently running a FindMinimum calculation with > MaxIterations -> 3000 and WorkingPrecision -> 32. With the complexity of my > problem this takes quite a long time. When my MaxIterations were lower it > would fail out with a 'failed to converge after 30 iterations' error and > produce the last iteration. Is there a way to produce the last fully solved > iteration the FindMinimum has found? I'm pretty sure my solution will not > fully converge but I would like to see where it is at so I can do some more > calculations. > In Mathematica 5, you can use the StepMonitor option to keep track of the position of the iterations. To get a result, you will probably want to use it inside of CheckAbort, as in slowf[x_?NumberQ, y_] := CompoundExpression[Pause[1], (x - 1)^2 + (x^2 - y)^2] CheckAbort[ FindMinimum[f[x, y], {{x, -1.2}, {y, 1}}, StepMonitor :> (laststep = {x, y})], laststep] If the problem runs to completion, you'll get the result from FindMinimum, or if you abort the computation, you will get the position at the last step taken in the iteration. Rob Knapp Wolfram Research