-
-
Notifications
You must be signed in to change notification settings - Fork 235
Add tune_parameters for dynamic optimization #4017
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
Open
SebastianM-C
wants to merge
15
commits into
SciML:master
Choose a base branch
from
SebastianM-C:smc/dynopt
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
take the MTKParameters values into account and substitute the tunable parameters with the appropriate symbolic expression
Co-authored-by: Claude <[email protected]>
…ameters in the system
Co-authored-by: Claude <[email protected]>
24a225f to
a57a464
Compare
When we have more collocation points than expected the constraints are wrong
…face Co-authored-by: Claude <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Checklist
contributor guidelines, in particular the SciML Style Guide and
COLPRAC.
Additional context
This fixes #3939 by adding the
tune_parametersoption for all dynamic optimization extensions. I also did fix some existing issues with the interface, such as the fact that it was ignoring any defaults in the model and added error handling for JuMPDynamicOptProblem in the case where the cost function evaluated variables at points that were not in the support (in that case InfiniteOpt automatically adds new points, which breaks the way we set the constraints for U, as we have completely different time steps).In terms of support, I'd say the best extension is the
InfiniteOptDynamicOptProblem, since it directly uses the InfiniteOpt representation and can automatically handle non-uniform data evaluation. TheJuMPDynamicOptProblem&CasADiDynamicOptProblemwould be next, where CasADi gets ranked lower because for some reason it doesn't work when used in the VS Code REPL. This also happens forPyomoDynamicOptProblem, but that one also has the issue that it crashes julia if it tries to evaluate a variable at a point that's not in the collocation points.Another issue that I noticed is that
solve(jprob, JuMPCollocation(Ipopt.Optimizer, constructTsitouras5()))takes very long if we increase the number of collocation points by decreasingdt. I haven't profiled yet, but I think it might be in the way we are adding the constraints based on the tableau & RGF tracing.One thing that's missing in the interface is the ability to set box constraints on the parameters that we tune, but I think that should go in a separate PR, as there are some more interface questions that I have related to that. In particular, how does one set the bounds after model creation? In most cases, if you want to reuse a model, you would only know the bounds on the parameters to optimize when you are building the dynamic optimization problem. We can change the values of the bounds for a parameter in an out of place way, but as far as I can tell, there's no way of putting the parameter back into the system after we changed its bounds. We can't use
extendeither, since the base system has priority.In a similar note, we also only know the tunable parameters & the cost function after system construction, so the process of setting up the dynamic optimization problem is a bit involved. Would it make sense to have some utility functions that set up the search space in an easier manner from a vector of pairs (i.e. something like
[sys.x=>(1,2), sys.y=>(2,3)]would set the tunables to[x, y]and set the bounds to the appropriate values).Also, regarding the interface, it's a bit strange that the solution does not look like any other SciML solution in that it does have 2 separate solutions and it doesn't have retcodes or parameters directly accessible at the top level.
Other missing things include more solver options that can be passed to the underlying optimizer, but that can be added after the more important aspects are clarified.
cc @baggepinnen