From 4cf512922a4d6c39962223beb7397104745c6a96 Mon Sep 17 00:00:00 2001 From: Aayush Sabharwal Date: Thu, 25 Jan 2024 18:18:59 +0530 Subject: [PATCH] fix: remove implicit dependency on MTK --- src/remake.jl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/remake.jl b/src/remake.jl index a03c11ec5..9605a5d1a 100644 --- a/src/remake.jl +++ b/src/remake.jl @@ -69,10 +69,10 @@ function remake(prob::ODEProblem; f = missing, u0 = prob.u0 end if (eltype(p) <: Pair && !isempty(p)) || (eltype(u0) <: Pair && !isempty(u0)) # one is a non-empty symbolic map - hasproperty(prob.f, :sys) && hasfield(typeof(prob.f.sys), :ps) || + isempty(parameter_symbols(prob)) && throw(ArgumentError("This problem does not support symbolic maps with `remake`, i.e. it does not have a symbolic origin." * " Please use `remake` with the `p` keyword argument as a vector of values, paying attention to parameter order.")) - hasproperty(prob.f, :sys) && hasfield(typeof(prob.f.sys), :states) || + isempty(variable_symbols(prob)) && throw(ArgumentError("This problem does not support symbolic maps with `remake`, i.e. it does not have a symbolic origin." * " Please use `remake` with the `u0` keyword argument as a vector of values, paying attention to state order.")) p, u0 = process_p_u0_symbolic(prob, p, u0) @@ -273,10 +273,10 @@ function remake(prob::OptimizationProblem; u0 = prob.u0 end if (eltype(p) <: Pair && !isempty(p)) || (eltype(u0) <: Pair && !isempty(u0)) # one is a non-empty symbolic map - hasproperty(prob.f, :sys) && hasfield(typeof(prob.f.sys), :ps) || + isempty(parameter_symbols(prob)) && throw(ArgumentError("This problem does not support symbolic maps with `remake`, i.e. it does not have a symbolic origin." * " Please use `remake` with the `p` keyword argument as a vector of values, paying attention to parameter order.")) - hasproperty(prob.f, :sys) && hasfield(typeof(prob.f.sys), :states) || + isempty(variable_symbols(prob)) && throw(ArgumentError("This problem does not support symbolic maps with `remake`, i.e. it does not have a symbolic origin." * " Please use `remake` with the `u0` keyword argument as a vector of values, paying attention to state order.")) p, u0 = process_p_u0_symbolic(prob, p, u0) @@ -342,10 +342,10 @@ function remake(prob::NonlinearProblem; u0 = prob.u0 end if (eltype(p) <: Pair && !isempty(p)) || (eltype(u0) <: Pair && !isempty(u0)) # one is a non-empty symbolic map - hasproperty(prob.f, :sys) && hasfield(typeof(prob.f.sys), :ps) || + isempty(parameter_symbols(prob)) && throw(ArgumentError("This problem does not support symbolic maps with `remake`, i.e. it does not have a symbolic origin." * " Please use `remake` with the `p` keyword argument as a vector of values, paying attention to parameter order.")) - hasproperty(prob.f, :sys) && hasfield(typeof(prob.f.sys), :states) || + isempty(variable_symbols(prob)) && throw(ArgumentError("This problem does not support symbolic maps with `remake`, i.e. it does not have a symbolic origin." * " Please use `remake` with the `u0` keyword argument as a vector of values, paying attention to state order.")) p, u0 = process_p_u0_symbolic(prob, p, u0)