Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use SII.finalize_parameters_hook! when updating problems #409

Merged
merged 6 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ RecursiveArrayTools = "3.12"
Reexport = "1.0"
SciMLBase = "2.30.1"
StaticArrays = "1.9"
SymbolicIndexingInterface = "0.3.11"
SymbolicIndexingInterface = "0.3.13"
UnPack = "1.0.2"
julia = "1.10"

Expand Down
7 changes: 2 additions & 5 deletions src/problem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,11 @@
end

# for updating parameters in JumpProblems to update MassActionJumps
function SII.set_parameter!(prob::JumpProblem, val, idx)
ans = SII.set_parameter!(SII.parameter_values(prob), val, idx)

function SII.finalize_parameters_hook!(prob::JumpProblem, p)
if using_params(prob.massaction_jump)
update_parameters!(prob.massaction_jump, prob.prob.p)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AayushSabharwal is using prob.prob.p correct here? The argument p is just the newly changed parameters right? (And prob.prob.p should already be updated when this is called?)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. p is the parameter symbol(s) updated by setp. For the parameter values you'd need parameter_values(prob) (or prob.prob.p in this case). If I'm being picky I'd suggest using parameter_values(prob) or parameter_values(prob.prob) at least

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I switched to parameter_values(prob).

end

ans
nothing

Check warning on line 132 in src/problem.jl

View check run for this annotation

Codecov / codecov/patch

src/problem.jl#L132

Added line #L132 was not covered by tests
end

# when getindex is used.
Expand Down
Loading