-
-
Notifications
You must be signed in to change notification settings - Fork 683
Process Fucntion refactor to Enforce return_jacp_stacked=True #5006
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
base: develop
Are you sure you want to change the base?
Conversation
@martinjrobins Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @RohitP2005, I think there is much more to do on this (than just removing the arg. Have you run the tests locally?
else: | ||
jac = None | ||
jac_action = None | ||
jac = func.get_jacobian() if use_jacobian else None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the single if statement is less complex then multiple, plus you are removing the report
, so I'd disagree with this change
else: | ||
jacp = None | ||
|
||
if use_jacobian: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same with this one
f"Calculating sensitivities for {name} with respect " | ||
f"to parameters {model.calculate_sensitivities} using " | ||
"CasADi" | ||
report(f"Calculating sensitivities for {name} using CasADi") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its useful to have the printout of model.calculate_sensitivities
here, so keep this
) | ||
# Compute derivate wrt p-stacked (can be passed to solver to | ||
# compute sensitivities online) | ||
if return_jacp_stacked: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removing this if statement is only a small part of this change, you will also need to change the behaviour of the solvers that depend on this functionality (I believe, but I'll run the tests so we can check)
Yes , I ran the tests locally and there are errors that needs to addressed. |
Description
Refactored the process function in
base_solver.py
to simplify its logic and improve maintainability.Fixes #4970
Type of change
Refactor (non-breaking change that improves code structure) to the process function in the base solver to enforce
return_jacp_stacked=True
.Important checks:
Please confirm the following before marking the PR as ready for review:
nox -s pre-commit
nox -s tests
nox -s doctests