Solving homotopies
The solve function
The solve function solves homotopies with given starting values.
HomotopyContinuation.solve — Function. solve(H::AbstractHomotopy, startvalues_s, [algorithm]; kwargs...)Solve the homotopy H via homotopy continuation with the given startvalues_s and the given algorithm.
kwargs are the keyword arguments for the solver options.
The default pathtracking algorithm is SphericalPredictorCorrector().
To specify another pathracking algorithm, e.g.AffinePredictorCorrector(), write
solve(H::AbstractHomotopy, startvalues_s, AffinePredictorCorrector(); kwargs...)The function also takes polynomials as inputs:
solve(f::Vector{<:MP.AbstractPolynomial{T}})solves the polynomial system f via a totaldegree homotopy of type StraightLineHomotopy and the SphericalPredictorCorrector pathtracking routine.
To specify homotopy and pathtracker, use
solve(f::Vector{<:MP.AbstractPolynomial{T}}, [homotopy], [algorithm]; kwargs...)Default is homotopy = StraightLineHomotopy and algorithm = SphericalPredictorCorrector. For instance,
solve(f, GeodesicOnTheSphere, AffinePredictorCorrector())solves $f=0$ with a GeodesicOnTheSphere homotopy and the AffinePredictorCorrector pathtracking routine.
Solver options
HomotopyContinuation.Solver — Type.Solver(homotopy, pathtracking_algorithm=SphericalPredictorCorrector(), endgame=CauchyEndgame(); kwargs...)Create a mutable Solver struct. This contains a Pathtracker and an Endgamer, everything you need to solve the given homotopy. Solver supports the following options:
endgame_start=0.1: Where the endgame startsabstol=1e-12: The desired accuracy of the final rootsat_infinity_tol=1e-10: An point is at infinity if the maginitude of the homogenous variable
is less than at_infinity_tol.
singular_tol=1e4: If the winding number is 1 but the condition number is larger than
singular_tol then the root is declared as singular.
refinement_maxiters=100: The maximal number of newton iterations to achieveabstol.verbose=false: Print additional warnings / informationsapply_gammatrick=true: This modifies the start system to make it generic.gamma=apply_gammatrick ? exp(im*2π*rand()) : complex(1.0): You can overwrite the default gamma. This is useful if you want to rerun only some paths.pathcrossing_tolerance=1e-8: The tolerance for when two paths are considered to be crossed.pathcrossing_check=true: Enable the pathcrossing check.parallel_type=:pmap: Currently there are two modes::pmapwill usepmapfor parallelism
and :none will use the standard map. :pmap is by defautl enabled since it works reliable, but if you develop new algorithms you probably want to disable parallelism.
batch_size=1: Thebatch_sizeforpmapifparallel_typeis:pmap.
For instance, to solve the homotopy H with starting values s with no endgame and a singular tolerance of 1e5, write
solve(H, s, endgame_start=0.0, singular_tol=1e5)To solve the polynomial system $f$ with the same options write
solve(f, endgame_start=0.0, singular_tol=1e5)Result
The solve function returns a Result struct:
HomotopyContinuation.Result — Type.Result(pathresults, solver)A thin wrapper around the PathResults of the Solver instance. Result behaves like an array of PathResults but also contains some additional informations. For example you can obtain the γ which was used for the gammatrick.
PathResult
For each tracked path there is a PathResult:
HomotopyContinuation.PathResult — Type.PathResult(startvalue, pathtracker_result, endgamer_result, solver)Construct a PathResult for a given startvalue. pathtracker_result is the PathtrackerResult until the endgame radius is reached. endgamer_result is the EndgamerResult resulting from the corresponding endgame.
A PathResult contains:
returncode: One of:success,:at_infinityor any error code from theEndgamerResultsolution::Vector{T}: The solution vector. If the algorithm computed in projective space
and the solution is at infinity then the projective solution is given. Otherwise an affine solution is given if the startvalue was affine and a projective solution is given if the startvalue was projective.
residual::Float64: The value of the infinity norm ofH(solution, 0).newton_residual: The value of the 2-norm of $J_H(\text{solution})^{-1}H(\text{solution}, 0)$log10_condition_number: A high condition number indicates singularty. SeeHomotopies.κfor details. The value is the logarithmic condition number (with base 10).windingnumber: The estimated winding numberangle_to_infinity: The angle to infinity is the angle of the solution to the hyperplane where the homogenizing coordinate is $0$.real_solution: Indicates whether the solution is real given the defined toleranceat_infinity_tol(from the solver options).startvalue: The startvalue of the pathiterations: The number of iterations the pathtracker needed.endgame_iterations: The number of steps in the geometric series the endgamer did.npredictions: The number of predictions the endgamer did.predictions: The predictions of the endgamer.
The solutions function
The solution function helps to extract information from a Result:
HomotopyContinuation.solutions — Function.solutions(r::Result; success=true, at_infnity=true, only_real=false, singular=true)Filters the solutions which satisfy the constraints.