Core tracker

Core Tracker

We also export the path tracking primitive to make the core path tracking routine available for other applications. At the heart is a CoreTracker object which holds all the state. The easiest way to construct a CoreTracker is to use the coretracker_startsolutions routine.

coretracker_startsolutions(args...; kwargs...)

Construct a CoreTracker and startsolutions in the same way solve does it. This also takes the same input arguments as solve. This is convenient if you want to investigate single paths.

coretracker(args...; kwargs...)

Construct a CoreTracker in the same way solve does it. This also takes the same input arguments as solve with the exception that you do not need to specify startsolutions. This is convenient if you want to investigate single paths.

Examples

Obtain single solution

We want to construct a path tracker to track a parameterized system f with parameters p from the parameters a to b.

tracker = coretracker(f, parameters=p, p₁=a, p₀=b)

You then can obtain a single solution at b by using

x_b = track(tracker, x_a).x

Trace a path

To trace a path you can use the iterator method.

tracker = coretracker(f, parameters=p, p₁=a, p₀=b, max_step_size =0.01)
for (x, t) in iterator(tracker, x₁)
    @show (x,t)
end

If we want to guarantee smooth traces we can limit the maximal step size.

tracker = coretracker(f, parameters=p, p₁=a, p₀=b, max_step_size =0.01)
for (x, t) in iterator(tracker, x₁)
    @show (x,t)
end

Types

 CoreTracker(H::AbstractHomotopy, x₁, t₁, t₀; options...)::CoreTracker

Create a CoreTracker to track x₁ from t₁ to t₀. The homotopy H needs to be homogeneous. Note that a CoreTracker is also a (mutable) iterator.

CoreTrackerOptions

  • corrector::AbstractCorrector: The corrector used during in the predictor-corrector scheme. The default is NewtonCorrector.
  • max_corrector_iters=3: The maximal number of correction steps in a single step.
  • initial_step_size=0.1: The step size of the first step.
  • max_steps=1_000: The maximal number of iterations the path tracker has available.
  • min_step_size=1e-14: The minimal step size.
  • max_step_size=Inf: The maximal step size.
  • maximal_lost_digits::Real=-(log₁₀(eps) + 3): The tracking is terminated if we estimate that we loose more than maximal_lost_digits in the linear algebra steps.
  • predictor::AbstractPredictor: The predictor used during in the predictor-corrector scheme. The default is Heun()`.
  • max_refinement_iters=10: The maximal number of correction steps used to refine the final value.
  • refinement_accuracy=1e-8: The precision used to refine the final value.
  • accuracy=1e-7: The precision used to track a value.
  • auto_scaling=true: This only applies if we track in affine space. Automatically regauges the variables to effectively compute with a relative accuracy instead of an absolute one.
 CoreTrackerResult{V<:AbstractVector}

Containing the result of a tracked path. The fields are

  • returncode::CoreTrackerStatus.states If the tracking was successfull then it is CoreTrackerStatus.success.
  • x::V The result.
  • t::ComplexF64 The t when the path tracker stopped.
  • accuracy::Float64: The estimated accuracy of x.
CoreTrackerStatus.states

The possible states the coretracker can achieve are

  • CoreTrackerStatus.success
  • CoreTrackerStatus.tracking
  • CoreTrackerStatus.terminated_maximal_iterations
  • CoreTrackerStatus.terminated_invalid_startvalue
  • CoreTrackerStatus.terminated_step_size_too_small
  • CoreTrackerStatus.terminated_singularity
  • CoreTrackerStatus.terminated_ill_conditioned
source

Methods

To track from a start to an endpoint with the CoreTracker we provide the following routines.

track(tracker, x₁, t₁=1.0, t₀=0.0; options...)::CoreTrackerResult

Track a value x₁ from t₁ to t₀ using the given CoreTracker tracker. This returns a CoreTrackerResult. This modifies tracker. See track! for the possible options.

 track!(tracker, x₁, t₁=1.0, t₀=0.0; setup_patch=true, checkstartvalue=true, compute_ẋ=true)

Track a value x₁ from t₁ to t₀ using the given CoreTracker tracker. Returns one of the enum values of CoreTrackerStatus.states indicating the status. If the tracking was successfull it is CoreTrackerStatus.success. If setup_patch is true then setup! is called at the beginning of the tracking.

track!(x₀, tracker, x₁, t₁=1.0, t₀=0.0; options...)

Additionally also stores the result in x₀ if the tracking was successfull.

setup!(::AbstractAffinePatchState, x::AbstractVector)

Setup the affine patch depending on x and modify x if necessary. This is only called once at the beginning of a tracked path.

setup!(cache::AbstractStatefulPredictorCache, H, x, ẋ, t, Jac)

Setup the cache. x is the new path value at t and is the derivative at t. fac is a factorization of the Jacobian at (x,t). This falls back to calling update.

setup!(coretracker, x₁, t₁=1.0, t₀=0.0, setup_patch=coretracker.options.update_patch, checkstartvalue=true, compute_ẋ=true)

Setup coretracker to track x₁ from t₁ to t₀. Use this if you want to use the coretracker as an iterator.

It is also possible to use a CoreTracker as an iterator. This can either be done by the high level iterator method or by directly using a CoreTracker as an iterator. The recommend approach is simply using iterator.

iterator(tracker::CoreTracker, x₁, t₁=1.0, t₀=0.0; affine=true)

Prepare a tracker to make it usable as a (stateful) iterator. Use this if you want to inspect a specific path. In each iteration the tuple (x,t) is returned. If affine == true then x is the affine solution (internally we compute in projective space).

Example

Assume you have CoreTracker tracker and you wan to track x₁ from 1.0 to 0.25:

for (x,t) in iterator(tracker, x₁, 1.0, 0.25)
    println("x at t=$t:")
    println(x)
end

Note that this is a stateful iterator. You can still introspect the state of the tracker. For example to check whether the tracker was successfull (and did not terminate early due to some problem) you can do

println("Success: ", currstatus(tracker) == CoreTrackerStatus.success)

Introspecting the current state

To introspect the current state we provide the following routines.

currx(tracker::CoreTracker)

Return the current value of x.

 currt(tracker::CoreTracker)

Current t.

 currΔt(tracker::CoreTracker)

Current step_size Δt.

 curriters(tracker::CoreTracker)

Current number of iterations.

 currstatus(tracker::CoreTracker)

Current status.

Changing options

To change settings

 accuracy(tracker::CoreTracker)

Current accuracy.

accuracy(pathresult)

Get the accuracy of the solution $x$ of the path, i.e., $||H(x, 0)||₂$.

 set_accuracy!(tracker::CoreTracker, accuracy)

Set the current accuracy to accuracy.

 max_corrector_iters(tracker::CoreTracker)

Current correction max_steps.

 set_max_corrector_iters!(tracker::CoreTracker, n)

Set the correction max_steps to n.

 max_step_size (tracker::CoreTracker)

Current maximal step size.

 set_max_corrector_iters!(tracker::CoreTracker, Δs)

Set the maximal step size to Δs.

 max_refinement_iters(tracker::CoreTracker)

Current refinement max_steps.

 set_max_refinement_iters!(tracker::CoreTracker, n)

Set the current refinement max_steps to n.

 refinement_accuracy(tracker::CoreTracker)

Current refinement accuracy.

 set_max_refinement_iters!(tracker::CoreTracker, accuracy)

Set the current refinement accuracy to accuracy.