Skip to content

Commit 923f8d9

Browse files
Merge pull request #143 from JuliaDiffEq/solve
Remove solve warning
2 parents 3a726dd + 195c006 commit 923f8d9

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

src/DiffEqBiological.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ module DiffEqBiological
55
using Compat, DataStructures, MacroTools, Parameters, Reexport, SparseArrays, SymEngine
66
using DiffEqBase, DiffEqJump
77
@reexport using DiffEqBase, DiffEqJump
8-
using HomotopyContinuation, DynamicPolynomials, LinearAlgebra, RecipesBase
8+
using DynamicPolynomials, LinearAlgebra, RecipesBase
9+
10+
import HomotopyContinuation
911

1012
import Base: (==)
1113

src/equilibrate_utils.jl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ mutable struct EquilibrateContent
1313
end
1414

1515
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]
1919
is_polynomial_system = try
2020
make_polynomial(pvus,pvt,pvps,internal___var___paramvals=fill(1,length(pvps)))
2121
true
@@ -197,7 +197,7 @@ function make_hc_template!(rn::DiffEqBase.AbstractReactionNetwork)
197197
check_has_polynomial(rn)
198198
p_template = randn(ComplexF64, length(rn.params))
199199
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))
201201
reset_hc_templates!(rn)
202202
push_hc_template!(rn,p_template,solution_template)
203203
end
@@ -213,7 +213,7 @@ end
213213
function add_hc_template!(rn::DiffEqBase.AbstractReactionNetwork)
214214
p_template = randn(ComplexF64, length(rn.params))
215215
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))
217217
if (isempty(get_hc_templates(rn))) || (length(solution_template) == length(get_hc_templates(rn)[1]))
218218
push_hc_template!(rn,p_template,solution_template)
219219
elseif length(solution_template) > length(get_hc_templates(rn)[1])
@@ -272,21 +272,21 @@ end
272272
#Finds steady states of a system using homotopy continuation.
273273
function steady_states(rn::DiffEqBase.AbstractReactionNetwork, solver::HCSteadyStateSolver, p=Vector{Float64}())
274274
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))))
276276
result = hc_solve_at(rn,p)
277277
using_temp_poly && finalise_solver!(rn)
278278
return positive_real_solutions(result)
279279
end
280280
# Solves the reaction networks at the specific parameter values using Homotopy Continuation.
281281
function hc_solve_at(rn::DiffEqBase.AbstractReactionNetwork,p::Vector{Float64})
282282
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))
284284
(length(result) == length(hc_template.sol)) && (return result)
285285
end
286286
@warn "While solving the system using homotopy continuation some solutions were lost."
287287
best_length = 0; best_solution = [];
288288
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))
290290
(length(result) > best_length) && (best_length = length(result); best_solution = result;)
291291
end
292292
return best_solution
@@ -560,7 +560,7 @@ function solve_bifurcation(
560560
paths_incomplete = Vector{NamedTuple{(:p, :u),Tuple{Vector{Float64},Vector{Vector{Complex{Float64}}}}}}()
561561
for sol in sol1
562562
path = track_path(sol,tracker1,range...)
563-
if (tracker1.state.status == CoreTrackerStatus.success)
563+
if (tracker1.state.status == HomotopyContinuation.CoreTrackerStatus.success)
564564
remove_sol!(sol2,path.u[end],d_sol)
565565
push!(paths_complete,path)
566566
else
@@ -569,7 +569,7 @@ function solve_bifurcation(
569569
end
570570
for sol in sol2
571571
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)
573573
push!(paths_complete,path)
574574
end
575575
append!(paths_complete,paths_incomplete)
@@ -663,12 +663,12 @@ end
663663
#--- Bifurcation functions used by both solvers ---#
664664
#Makes a coretracker from the given information
665665
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)
667667
end
668668
#Tracks a path for the given coretracker, returns the path.
669669
function track_path(solution,coretracker,p_start,p_end)
670670
P = Vector{Float64}(); U = Vector{Vector{ComplexF64}}();
671-
for (u,t) in iterator(coretracker, solution)
671+
for (u,t) in HomotopyContinuation.iterator(coretracker, solution)
672672
push!(P,t2p(t,p_start,p_end)); push!(U,u);
673673
end
674674
return (p=P,u=U)

0 commit comments

Comments
 (0)