OOF2: The Manual
Name
Conditional Iteration (ConditionalIteration) — Iteration stops when a given condition is satisfied.
Synopsis
ConditionalIteration
(condition
,extra
,maximum
)
Details
-
Base class:
IterationManager
-
Parameters:
condition
- Which exit condition to use. Type: An object of the
ConditionSelector
class. extra
- Number of extra steps to take to ensure that the condition is met. Type: Integer.
maximum
- Maximum number of iterations, despite the exit condition. Type: Integer.
Description
When the iteration
parameter of an iterative
SkeletonModifier (such as Anneal or Smooth) is set to
ConditionalIteration
, OOF2 will stop
modifying the Skeleton
when a specified condition is met.
The condition
parameter determines the
stopping criterion. See the ConditionSelector class for the details.
Iteration doesn't necessarily stop immediately when the
condition
is satisfied. If the
extra
parameter is non-zero, OOF2 will
iterate for another extra
iterations, and only
stop if the condition
remains satisfied for all
of them. That is, the Skeleton
modification operation stops after
the condition
is met for
extra+1
consecutive iterations.
To prevent runaway operations, the Skeleton
modification operation
will always stop after maximum
iterations have
been performed.
Here's a sample of the output for an Anneal operation, using
condition
=AcceptanceRate(acceptance_rate
=10
)
and extra
=3
.
Iteration 21: E = 4.2672e+00, deltaE=-1.4758e-02 ( 0.346%), Acceptance Rate = 13.0% Iteration 22: E = 4.2056e+00, deltaE=-7.3972e-03 ( 0.176%), Acceptance Rate = 14.1% Iteration 23: E = 4.1721e+00, deltaE=-4.2731e-03 ( 0.102%), Acceptance Rate = 13.0% Iteration 24: E = 4.1536e+00, deltaE=-5.8492e-03 ( 0.141%), Acceptance Rate = 10.9% Iteration 25: E = 4.1260e+00, deltaE=-8.9829e-04 ( 0.022%), Acceptance Rate = 6.5% The rate is below the threshold... Iteration 26: E = 4.1217e+00, deltaE=-6.1829e-03 ( 0.150%), Acceptance Rate = 4.3% ... but... Iteration 27: E = 4.0965e+00, deltaE=-6.5146e-03 ( 0.159%), Acceptance Rate = 3.3% ... not for long enough Iteration 28: E = 4.0706e+00, deltaE=-1.0707e-03 ( 0.026%), Acceptance Rate = 10.9% ... so iteration continues Iteration 29: E = 4.0651e+00, deltaE=-5.6484e-04 ( 0.014%), Acceptance Rate = 5.4% Iteration 30: E = 4.0625e+00, deltaE=-1.1716e-04 ( 0.003%), Acceptance Rate = 2.2% Iteration 31: E = 4.0620e+00, deltaE=-1.1398e-03 ( 0.028%), Acceptance Rate = 8.7% Iteration 32: E = 4.0565e+00, deltaE=-1.5421e-03 ( 0.038%), Acceptance Rate = 5.4% ... until the rate stays low Annealing done: deltaE = -1.1007e+00 (21.369%)