@@ -13,9 +13,9 @@ mutable struct EquilibrateContent
13
13
end
14
14
15
15
function EquilibrateContent (make_polynomial,n_vars,n_params)
16
- pvus = (@polyvar internal___polyvar___u[1 : n_vars])[1 ]
17
- pvps = (@polyvar internal___polyvar___p[1 : n_params])[1 ]
18
- pvt = (@polyvar internal___polyvar___t)[1 ]
16
+ pvus = (HomotopyContinuation . @polyvar internal___polyvar___u[1 : n_vars])[1 ]
17
+ pvps = (HomotopyContinuation . @polyvar internal___polyvar___p[1 : n_params])[1 ]
18
+ pvt = (HomotopyContinuation . @polyvar internal___polyvar___t)[1 ]
19
19
is_polynomial_system = try
20
20
make_polynomial (pvus,pvt,pvps,internal___var___paramvals= fill (1 ,length (pvps)))
21
21
true
@@ -197,7 +197,7 @@ function make_hc_template!(rn::DiffEqBase.AbstractReactionNetwork)
197
197
check_has_polynomial (rn)
198
198
p_template = randn (ComplexF64, length (rn. params))
199
199
f_template = DynamicPolynomials. subs .(get_equi_poly (rn), Ref (get_polyvars (rn). p => p_template))
200
- solution_template = solutions (HomotopyContinuation. solve (f_template, show_progress= false ))
200
+ solution_template = HomotopyContinuation . solutions (HomotopyContinuation. solve (f_template, show_progress= false ))
201
201
reset_hc_templates! (rn)
202
202
push_hc_template! (rn,p_template,solution_template)
203
203
end
213
213
function add_hc_template! (rn:: DiffEqBase.AbstractReactionNetwork )
214
214
p_template = randn (ComplexF64, length (rn. params))
215
215
f_template = DynamicPolynomials. subs .(get_equi_poly (rn), Ref (get_polyvars (rn). p => p_template))
216
- solution_template = solutions (HomotopyContinuation. solve (f_template, show_progress= false ))
216
+ solution_template = HomotopyContinuation . solutions (HomotopyContinuation. solve (f_template, show_progress= false ))
217
217
if (isempty (get_hc_templates (rn))) || (length (solution_template) == length (get_hc_templates (rn)[1 ]))
218
218
push_hc_template! (rn,p_template,solution_template)
219
219
elseif length (solution_template) > length (get_hc_templates (rn)[1 ])
@@ -272,21 +272,21 @@ end
272
272
# Finds steady states of a system using homotopy continuation.
273
273
function steady_states (rn:: DiffEqBase.AbstractReactionNetwork , solver:: HCSteadyStateSolver , p= Vector {Float64} ())
274
274
using_temp_poly = initialise_solver! (rn,p)
275
- (length (p)== 0 ) && (return positive_real_solutions (solutions (HomotopyContinuation. solve (get_equi_poly (rn),show_progress= false ))))
275
+ (length (p)== 0 ) && (return positive_real_solutions (HomotopyContinuation . solutions (HomotopyContinuation. solve (get_equi_poly (rn),show_progress= false ))))
276
276
result = hc_solve_at (rn,p)
277
277
using_temp_poly && finalise_solver! (rn)
278
278
return positive_real_solutions (result)
279
279
end
280
280
# Solves the reaction networks at the specific parameter values using Homotopy Continuation.
281
281
function hc_solve_at (rn:: DiffEqBase.AbstractReactionNetwork ,p:: Vector{Float64} )
282
282
for hc_template in get_hc_templates (rn)
283
- result = solutions (HomotopyContinuation. solve (get_equi_poly (rn), hc_template. sol, parameters= get_polyvars (rn). p, p₁= hc_template. p, p₀= p, show_progress= false ))
283
+ result = HomotopyContinuation . solutions (HomotopyContinuation. solve (get_equi_poly (rn), hc_template. sol, parameters= get_polyvars (rn). p, p₁= hc_template. p, p₀= p, show_progress= false ))
284
284
(length (result) == length (hc_template. sol)) && (return result)
285
285
end
286
286
@warn " While solving the system using homotopy continuation some solutions were lost."
287
287
best_length = 0 ; best_solution = [];
288
288
for hc_template in get_hc_templates (rn)
289
- result = solutions (HomotopyContinuation. solve (get_equi_poly (rn), hc_template. sol, parameters= get_polyvars (rn). p, p₁= hc_template. p, p₀= p, show_progress= false ))
289
+ result = HomotopyContinuation . solutions (HomotopyContinuation. solve (get_equi_poly (rn), hc_template. sol, parameters= get_polyvars (rn). p, p₁= hc_template. p, p₀= p, show_progress= false ))
290
290
(length (result) > best_length) && (best_length = length (result); best_solution = result;)
291
291
end
292
292
return best_solution
@@ -560,7 +560,7 @@ function solve_bifurcation(
560
560
paths_incomplete = Vector{NamedTuple{(:p , :u ),Tuple{Vector{Float64},Vector{Vector{Complex{Float64}}}}}}()
561
561
for sol in sol1
562
562
path = track_path (sol,tracker1,range... )
563
- if (tracker1. state. status == CoreTrackerStatus. success)
563
+ if (tracker1. state. status == HomotopyContinuation . CoreTrackerStatus. success)
564
564
remove_sol! (sol2,path. u[end ],d_sol)
565
565
push! (paths_complete,path)
566
566
else
@@ -569,7 +569,7 @@ function solve_bifurcation(
569
569
end
570
570
for sol in sol2
571
571
path = track_path (sol,tracker2,reverse (range)... )
572
- (tracker2. state. status == CoreTrackerStatus. success) && remove_path! (paths_incomplete,path. u[end ],d_sol)
572
+ (tracker2. state. status == HomotopyContinuation . CoreTrackerStatus. success) && remove_path! (paths_incomplete,path. u[end ],d_sol)
573
573
push! (paths_complete,path)
574
574
end
575
575
append! (paths_complete,paths_incomplete)
@@ -663,12 +663,12 @@ end
663
663
# --- Bifurcation functions used by both solvers ---#
664
664
# Makes a coretracker from the given information
665
665
function make_coretracker (rn,sol,p1,p2,Δt)
666
- return coretracker (get_equi_poly (rn), sol, parameters= get_polyvars (rn). p, p₁= p1, p₀= p2, max_step_size= Δt)
666
+ return HomotopyContinuation . coretracker (get_equi_poly (rn), sol, parameters= get_polyvars (rn). p, p₁= p1, p₀= p2, max_step_size= Δt)
667
667
end
668
668
# Tracks a path for the given coretracker, returns the path.
669
669
function track_path (solution,coretracker,p_start,p_end)
670
670
P = Vector {Float64} (); U = Vector {Vector{ComplexF64}} ();
671
- for (u,t) in iterator (coretracker, solution)
671
+ for (u,t) in HomotopyContinuation . iterator (coretracker, solution)
672
672
push! (P,t2p (t,p_start,p_end)); push! (U,u);
673
673
end
674
674
return (p= P,u= U)
0 commit comments