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

Improve @def #206

Closed
jbcaillau opened this issue Aug 1, 2024 · 3 comments · Fixed by #233
Closed

Improve @def #206

jbcaillau opened this issue Aug 1, 2024 · 3 comments · Fixed by #233
Assignees
Labels
enhancement New feature or request

Comments

@jbcaillau
Copy link
Member

  • o = @def expr in addition to @def o expr
  • @def! o expr to update (add feature) existing o
@jbcaillau jbcaillau self-assigned this Aug 1, 2024
@jbcaillau jbcaillau added the enhancement New feature or request label Aug 1, 2024
@jbcaillau jbcaillau linked a pull request Aug 9, 2024 that will close this issue
@jbcaillau
Copy link
Member Author

@ocots side notes:

  • would be possible to provide an @def! macro to add things to a previously created ocp (with the correct type according to time / variable dependences)
  • not completely coherent with the fact that with the current global (= all at once definition) we infer these dependences (hence the type)

@ocots
Copy link
Member

ocots commented Aug 10, 2024

@ocots side notes:

  • would be possible to provide an @def! macro to add things to a previously created ocp (with the correct type according to time / variable dependences)
  • not completely coherent with the fact that with the current global (= all at once definition) we infer these dependences (hence the type)

You could simply redo all the parsing since you have the model in ocp.model_expression.

https://github.com/control-toolbox/CTBase.jl/blob/main/src%2Ftypes.jl#L1157

We could use this here: https://control-toolbox.org/OptimalControl.jl/dev/tutorial-basic-example.html#State-constraint

@jbcaillau
Copy link
Member Author

You could simply redo all the parsing since you have the model in ocp.model_expression.

https://github.com/control-toolbox/CTBase.jl/blob/main/src%2Ftypes.jl#L1157

right, as you did for the REPL. but this only works for an ocp first defined abstractly, while it could be first defined using the functional API. BTW, I more and more think that we should keep the functional API more or less internal.

We could use this here: https://control-toolbox.org/OptimalControl.jl/dev/tutorial-basic-example.html#State-constraint

Yes. Always nice to avoid code duplication. There are other ways, though (working on expressions, strings, then parsing...) Keeping hereafter for further reference #235

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants