Core Tracker
A CoreTracker
is the low-level path tracker. Its job is to track an initial solution x₁
from t₁
to t₀
by following a solution path $x(t)$. For this a predictor-corrector scheme is used. See our introduction guide for a high-level explanation of the predictor corrector scheme
Basic usage
HomotopyContinuation.CoreTracker
— TypeCoreTracker
A CoreTracker
is the low-level path tracker. Its job is to track an initial solution x₁
from t₁
to t₀
by following a solution path $x(t)$. For this a predictor-corrector scheme is used. See our introduction guide for a high-level explanation of the predictor corrector scheme. The CoreTracker
accepts for a value t
a solution $x^*$ if $||x(t) - x^*|| < τ$ where $τ$ is controlled by the accuracy
option.
To interact with a CoreTracker
take a look at track
resp. track!
. You can also use CoreTracker
as an iterator. For this you need to call init!(::CoreTracker, x₁, t₁, t₀)
first. There is also iterator
if you are only interested in pairs (x,t)
.
The CoreTracker
cannot handle singular solutions or divergent paths. For this you have to use a PathTracker
(which uses internally again a CoreTracker
).
The CoreTracker
can track solutions in projective space if the underlying homotopy is homogeneous and the provided start solution is a projective vector (with type PVector
) from the ProjectiveVectors.jl
package.
The CoreTracker
can also perform a reparamterization of the parameter $t$ from $[0,1]$ towards $[0,∞]$ by $t = e^{-s}$. If the homotopy assumes $t ∈ [0,1]$ this can be done by passing the log_transform = true
option. If you already have a homotopy which assumes $s ∈ [0,∞]$ you can use the logarithmic_time_scale = true
to tell the core tracker this. In this case the min_step_size
criterion is still applied to $t$ and not $s$.
Options
CoreTracker
accepts many different options. Here are the options in alphabetic order:
accuracy
(default1e-7
): The maximal acceptable distance to the true solution at a time stept
.auto_scaling
(defaulttrue
): Enables an automatic scaling of the variables by introducing a weighted norm. See alsoWeightedNorm
.initial_step_size
: The size of the first step. By default an automatic estimate is computed but this can be overwritten with this option.max_cond
(default1e10
): The maximal condition number before a path is terminated due to ill-conditioning. This is only applicable ifterminate_ill_conditioned
istrue
.max_corrector_iters (default
2`): The maximal number of Newton iteration steps until which the desired accuracy has to be achieved.max_step_size
(defaultInf
): Limit the path tracker to a maximal step size.max_steps
(default1000
): The maximal number of steps the path tracker makes. Note that this changes to10_000
for parameter homotopies.min_step_size
(default1e-14
): The path tracking is terminated if the step size is smaller than this value.norm
(defaultInfNorm()
): The norm used in the computations. Note that if theauto_scaling
is true, this will automatically be converted to aWeightedNorm
.patch
: It is possible to perform tracking in projective space. For the actual compuations we still need to choose an affine chart. There are multiple charts possible, seeAbstractAffinePatch
. The default isRandomPatch
.precision
(default:double
): This controls the precision used in the computation of $H(x,t)$. If it is set to:double
only double precision arithmetic is used (Complex{Float64}
). If it set to:double_double
double double arithmetic as implemented by theDoubleFloats
package is always used. The option:adaptive
changes adaptively the precision.predictor
(defaultPade21
): The predictor used.simple_step_size_alg
(defaultfalse
): By default the step size algorithm presented in arXiv:1902.02968 is used. If this option is true a more simple step size algorithm is used which doubles the step size after 5 consecutive successive steps and halfes the step size after a failed step.terminate_ill_conditioned
(defaulttrue
): Indicates whether the path tracking should be terminated for ill-conditioned paths. A path is considered ill-conditioned if the desirable accuracy is no more achievable or if the condition number of the Jacobian is larger than1e14
.
The easiest way to construct a CoreTracker
is to use coretracker
and coretracker_startsolutions
.
HomotopyContinuation.coretracker_startsolutions
— Functioncoretracker_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.
HomotopyContinuation.coretracker
— Functioncoretracker(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 parametrized system f
with parameters p
from the parameters a
to b
.
tracker = coretracker(f; parameters = p, start_parameters = a, target_parameters = 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, start_parameters = a, target_parameters = b)
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, max_step_size = 0.01,
start_parameters = a, target_parameters = b)
for (x, t) in iterator(tracker, x₁)
@show (x,t)
end
Result and Status
HomotopyContinuation.CoreTrackerResult
— Type CoreTrackerResult{V<:AbstractVector}
The result of track(::CoreTracker, x₁, t₁, t₀)
. You can use is_success
to check whether the tracking was successfull and solution
to obtain the solution.
Fields
returncode
TheCoreTrackerStatus.states
enum.x::V
The solution att
.t::ComplexF64
The timet
when the path tracker stopped.accuracy::Float64
: The estimated accuracy ofx
.accepted_steps::Int
: The number of accepted steps during the tracking.rejected_steps::Int
: The number of rejected_steps steps during the tracking.
HomotopyContinuation.is_success
— Methodis_success(result::CoreTrackerResult)
Returns true
if the path tracking was successfull.
HomotopyContinuation.solution
— Methodsolution(result::CoreTrackerResult)
Returns the solutions obtained by the CoreTracker
.
HomotopyContinuation.CoreTrackerStatus.states
— TypeCoreTrackerStatus.states
The possible states a CoreTracker
can have are
CoreTrackerStatus.success
: Indicates a successfull completed trackingCoreTrackerStatus.tracking
: The tracking is still in progressCoreTrackerStatus.terminated_maximal_iterations
: Tracking terminated since maximal iterations reached.CoreTrackerStatus.terminated_ill_conditioned
: Tracking terminated since the path was too ill-conditioned.CoreTrackerStatus.terminated_invalid_startvalue
: Tracking terminated since the provided start value was invalid.CoreTrackerStatus.terminated_step_size_too_small
HomotopyContinuation.is_success
— Methodis_success(S::CoreTrackerStatus.states)
Returns true
if S
indicates a success in the path tracking.
HomotopyContinuation.is_terminated
— Methodis_terminated(S::CoreTrackerStatus.states)
Returns true
if S
indicates that the path tracking got terminated. This is not true
if is_success(S)
is true
.
HomotopyContinuation.is_tracking
— Methodis_tracking(S::CoreTrackerStatus.states)
Returns true
if S
indicates that the path tracking is not yet finished.
HomotopyContinuation.is_invalid_startvalue
— Methodis_invalid_startvalue(S::CoreTrackerStatus.states)
Returns true
if S
indicates that the path tracking got terminated since the start value was not a zero.
Methods
To track from a start to an endpoint with the CoreTracker
we provide the following routines.
HomotopyContinuation.track
— FunctionHomotopyContinuation.track!
— Methodtrack!(tracker::CoreTracker, x₁, t₁=1.0, t₀=0.0)::CoreTrackerStatus.states
Track a value x₁
from t₁
to t₀
using the given CoreTracker
tracker
. Returns one of the enum values of CoreTrackerStatus
indicating the status. Check is_success
and is_terminated
to test for the status.
If setup_patch
is true
then init!
is called at the beginning of the tracking.
track!(x₀, tracker::CoreTracker, x₁, t₁=1.0, t₀=0.0)::CoreTrackerStatus.states
Additionally also stores the result in x₀
if the tracking was successfull.
HomotopyContinuation.init!
— Methodinit!(tracker::CT, x₁, t₁, t₀;
setup_patch::Bool = tracker.options.update_patch,
loop::Bool = false,
check_start_value::Bool = !loop)
Setup tracker
to track x₁
from t₁
to t₀
. Use this if you want to use the tracker
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 to simply use iterator
.
HomotopyContinuation.iterator
— Functioniterator(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: ", status(tracker) == CoreTrackerStatus.success)
Introspecting the current state
To introspect the current state we provide the following routines.
HomotopyContinuation.current_x
— Functioncurrent_x(tracker::CoreTracker)
Return the current value of x
.
HomotopyContinuation.current_t
— Functioncurrent_t(tracker::CoreTracker)
Current t
.
HomotopyContinuation.current_Δt
— Functioncurrent_Δt(tracker::CoreTracker)
Current step_size Δt
.
HomotopyContinuation.steps
— Functionsteps(tracker::CoreTracker)
Current number of steps.
HomotopyContinuation.status
— Functionstatus(tracker::CoreTracker)
Current status.
LinearAlgebra.cond
— MethodLinearAlgebra.cond(tracker::CoreTracker)
Returns the currently computed approximation of the condition number of the Jacobian.
HomotopyContinuation.options
— Functionoptions(tracker::CoreTracker)
Returns the options used in the tracker.
Changing options
To change settings
HomotopyContinuation.accuracy
— Methodaccuracy(tracker::CoreTracker)
Current accuracy.
HomotopyContinuation.set_accuracy!
— Functionset_accuracy!(tracker::CoreTracker, accuracy)
Set the current accuracy to accuracy
.
HomotopyContinuation.max_corrector_iters
— Functionmax_corrector_iters(tracker::CoreTracker)
Current correction max_steps.
HomotopyContinuation.set_max_corrector_iters!
— Functionsetmaxcorrector_iters!(tracker::CoreTracker, n)
Set the correction max_steps to n
.
HomotopyContinuation.max_step_size
— Functionmax_step_size (tracker::CoreTracker)
Current maximal step size.
HomotopyContinuation.set_max_step_size!
— Functionset_max_corrector_iters!(tracker::CoreTracker, Δs)
Set the maximal step size to Δs
.
Deprecated
The following functions are deprecated.
HomotopyContinuation.max_refinement_iters
— Functionmax_refinement_iters(tracker::CoreTracker)
Current refinement max_steps.
HomotopyContinuation.set_max_refinement_iters!
— Functionset_max_refinement_iters!(tracker::CoreTracker, n)
Set the current refinement max_steps to n
.
HomotopyContinuation.refinement_accuracy
— Functionrefinement_accuracy(tracker::CoreTracker)
Current refinement accuracy.
HomotopyContinuation.set_refinement_accuracy!
— Functionset_max_refinement_iters!(tracker::CoreTracker, accuracy)
Set the current refinement accuracy to accuracy
.