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

[Dev] Model #14

Open
ocots opened this issue Dec 13, 2024 · 6 comments
Open

[Dev] Model #14

ocots opened this issue Dec 13, 2024 · 6 comments
Assignees

Comments

@ocots
Copy link
Member

ocots commented Dec 13, 2024

  • Make constraints at build
  • Handle labels to get dual variables
@ocots ocots self-assigned this Dec 13, 2024
@PierreMartinon
Copy link
Member

PierreMartinon commented Dec 16, 2024

Hi @ocots,

Tests with the new model:

  • scalar / vector case seems to work fine
  • no more runtime dispatch or allocations from mayer, lagrange and dynamics
  • still some dispatch/allocs for the constraints, I tried to use parametrization but did not manage to get rid of the problem. Maybe building them inside the Model would solve this too ?

Some comparisons vs main branch (NB. these small problems have no path constraints)

problem main new model
simple integrator (energy) 42ms / 44MB 33ms / 29MB
fuller 52ms / 47MB 42ms / 30MB
double integrator (tf) 48ms / 41MB 38ms / 31MB

Definitely some progress. I'll start working on the block structure for the jacobian too.

Remarks:

  • yes, building the constraints functions inside the model will be more convenient.
  • objective functions (lagrange and mayer) always return scalar values, and out of place would be more convenient here than inplace. Done :D
  • variable_constraints is actually redundant with boundary_constraints and variable box constraints, it can be removed from the model !
  • If a user tries to declare explicitely
CTModels.variable!(pre_ocp, 0)

for a variable independent problem, the variable dimension is actually set to 1.
There should probably also be a message saying that the declaration is not needed.

  • I keep getting runtime dispatch warnings when using the getters for initial and final time, even when qualifying the TimesModel. Reverted back to using duplicate variables in DOCP for the fixed / free times for now. Maybe we can discuss this point together ?

@ocots
Copy link
Member Author

ocots commented Dec 17, 2024

This seems to be a good news!

I modify for the dimension 0. For a state and a control, it is forbidden and for a variable it is possible but I will set with an empty variable.

@ocots
Copy link
Member Author

ocots commented Dec 17, 2024

Ok we need to discuss about the times.

@ocots
Copy link
Member Author

ocots commented Dec 17, 2024

For the out-of-place, actually, I have nothing to change :-) It will be at parsing to adapt. Actually, you can already test with out of place for the objective functions.

@ocots
Copy link
Member Author

ocots commented Dec 17, 2024

Up to now:

  • dimension 0 for state, control and variable
  • out of place (up to you)
  • constraints built during model building so it is done once and we have the types.

@ocots
Copy link
Member Author

ocots commented Dec 17, 2024

I have added a function to get the times, with a variable even if the time is fixed.

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

No branches or pull requests

2 participants