Skip to content

Some new problems with remake for Catalyst update  #3326

@TorkelE

Description

@TorkelE

We previously had problems that conservation law parameters had he wrong value after remake. However, now it seems remake fails when there are involved entirely:

using Catalyst, OrdinaryDiffEqDefault

# Create model.
rs = @reaction_network begin
    @parameters Y0
    @species Y(t) = Y0
    (p,d), 0 <--> Y
    (k1,k2), X1 <--> X2    
end
osys = complete(convert(ODESystem, rs; remove_conserved = true))

# Create initial `ODEProblem`.
u0 = [osys.X1 => 1.0, osys.X2 => 2.0]
ps = [osys.p => 10.0, osys.d => 5.0, osys.Y0 => 3.0, osys.k1 => 1.0, osys.k2 => 2.0]
oprob = ODEProblem(osys, u0, (0.0, 1.0), ps)

# Try `remake`.
u0_new = [osys.X1 => 0.1]
ps_new = [osys.Y0 => 0.3, osys.p => 100.0]
oprob_new = remake(oprob; u0 = u0_new, p = ps_new) # ERROR: TypeError: in validate_parameter_type, in Parameter Γ[1], expected Real, got a value of type SymbolicUtils.BasicSymbolic{Real}

# Check the types of all 6 parameters (5 declared, plus the conservation law one)
for param in parameters(osys)
    println(typeof(param)) # all are `SymbolicUtils.BasicSymbolic{Real}`
end

As a bonus, for some reason, providing an empty u0 in these cases fail (normally work):

oprob_new = remake(oprob; u0 = [], p = ps_new) # ERROR: BoundsError: attempt to access 0-element Vector{Any} at index [1]

@AayushSabharwal Do you have any idea what might be going on?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions