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

[RTR] Model interface for a wider use of bioptim #581

Merged
merged 98 commits into from
Dec 10, 2022

Conversation

Ipuch
Copy link
Collaborator

@Ipuch Ipuch commented Nov 24, 2022

All Submissions:

  • Have you followed the guidelines in our Contributing document [docs/contribution.md]?
  • Have you checked to ensure there aren't other open [Pull Requests] for the same update/change?
  • Have you opened/linked the issue related to your pull request?
  • Have you used the tag [WIP] for on-going changes, and removed it when the pull request was ready?
  • When ready to merge, have you sent a comment pinging @pariterre in it?

New Feature Submissions:

  1. Does your submission pass the tests (if not please explain why this is intended)?
  2. Did you write a proper documentation (docstrings and ReadMe)
  3. Have you linted your code locally prior to submission (using the command: black . -l120 --exclude "external/*")?

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new examples for your core changes, as applicable?
  • Have you written new tests for your core changes, as applicable?

Tackling #507


This change is Reviewable

@codecov
Copy link

codecov bot commented Nov 24, 2022

Codecov Report

Base: 81.27% // Head: 81.60% // Increases project coverage by +0.32% 🎉

Coverage data is based on head (dffe9eb) compared to base (54404fb).
Patch coverage: 90.78% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #581      +/-   ##
==========================================
+ Coverage   81.27%   81.60%   +0.32%     
==========================================
  Files          99      104       +5     
  Lines       11057    11367     +310     
==========================================
+ Hits         8987     9276     +289     
- Misses       2070     2091      +21     
Impacted Files Coverage Δ
bioptim/examples/__main__.py 0.00% <ø> (ø)
...act/contact_forces_inequality_constraint_muscle.py 13.46% <0.00%> (ø)
...ith_contact/muscle_activations_contacts_tracker.py 22.44% <0.00%> (ø)
bioptim/optimization/solution.py 86.90% <0.00%> (-0.56%) ⬇️
...tim/examples/getting_started/example_multistart.py 24.24% <16.66%> (-2.23%) ⬇️
bioptim/limits/path_conditions.py 86.52% <46.66%> (+0.03%) ⬆️
...les/torque_driven_ocp/track_markers_2D_pendulum.py 53.03% <50.00%> (ø)
bioptim/examples/custom_model/main.py 60.00% <60.00%> (ø)
bioptim/examples/moving_horizon_estimation/mhe.py 50.87% <66.66%> (ø)
...getting_started/example_continuity_as_objective.py 46.75% <70.00%> (-0.69%) ⬇️
... and 65 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Collaborator Author

@Ipuch Ipuch left a comment

Choose a reason for hiding this comment

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

Reviewable status: 85 of 102 files reviewed, 26 unresolved discussions (waiting on @pariterre)


bioptim/__init__.py line 176 at r2 (raw file):

Previously, pariterre (Pariterre) wrote…

Use a Protocol instead?

obsolete


bioptim/dynamics/dynamics_functions.py line 748 at r2 (raw file):

Previously, pariterre (Pariterre) wrote…

Move this to the BioModel (set_excitation(u))

Set Excitation is not possible to move !


bioptim/dynamics/dynamics_functions.py line 785 at r2 (raw file):

Previously, pariterre (Pariterre) wrote…

Move this to the BioModel (set_excitation(u))

But this one yes !


bioptim/dynamics/ode_solver.py line 137 at r13 (raw file):

Previously, pariterre (Pariterre) wrote…

Do not keep numpy dependency

ok,


bioptim/examples/custom_model/main.py line 23 at r2 (raw file):

Previously, pariterre (Pariterre) wrote…

BioModel

MyModel is fine because it made on the custom model.


bioptim/examples/getting_started/custom_constraint.py line 59 at r2 (raw file):

Previously, Ipuch (Pierre Puchaud) wrote…

to modify !

Saved by you


bioptim/interfaces/biomodel.py line 84 at r12 (raw file):

Previously, pariterre (Pariterre) wrote…

Be more precise

node needed anymore.


bioptim/interfaces/biorbd_model.py line 282 at r13 (raw file):

reshape_fext_to_fcontact
removed.


bioptim/limits/constraints.py line 388 at r12 (raw file):

Previously, pariterre (Pariterre) wrote…

This should be done internally

internally done.


bioptim/limits/phase_transition.py line 262 at r12 (raw file):

Previously, pariterre (Pariterre) wrote…

Add a new method in BioModel to load a fresh model when needed

nlp_post.model.copy

Done


bioptim/optimization/optimal_control_program.py line 274 at r12 (raw file):

Previously, pariterre (Pariterre) wrote…

"bio_model_serialized": [m.serialize() for m in bio_model],
with serialize being a tuple[type, dict]

done


bioptim/optimization/optimal_control_program.py line 547 at r12 (raw file):

Previously, pariterre (Pariterre) wrote…

to adjust

done


bioptim/optimization/optimal_control_program.py line 157 at r13 (raw file):

Previously, pariterre (Pariterre) wrote…

Remove the dependency to numpy

Done


bioptim/optimization/receding_horizon_optimization.py line 201 at r12 (raw file):

Previously, pariterre (Pariterre) wrote…

To adjust

done


bioptim/optimization/receding_horizon_optimization.py line 367 at r12 (raw file):

Previously, pariterre (Pariterre) wrote…

To adjust

done


bioptim/optimization/receding_horizon_optimization.py line 507 at r12 (raw file):

Previously, pariterre (Pariterre) wrote…

To adjust

done


bioptim/examples/custom_model/my_model.py line 15 at r2 (raw file):

Previously, pariterre (Pariterre) wrote…

No need if it implements a Protocol

done.


bioptim/examples/custom_model/my_model.py line 51 at r2 (raw file):

Previously, pariterre (Pariterre) wrote…

TODO

done

Copy link
Collaborator Author

@Ipuch Ipuch left a comment

Choose a reason for hiding this comment

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

Reviewable status: 85 of 102 files reviewed, 26 unresolved discussions (waiting on @pariterre)


bioptim/interfaces/custom_model.py line 8 at r12 (raw file):

Previously, pariterre (Pariterre) wrote…

Change this for a set_attr at start of OCP (if not in the class)

Done.

Copy link
Member

@pariterre pariterre left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 6 files at r16, 9 of 13 files at r17, 1 of 4 files at r18, 1 of 1 files at r19, 3 of 6 files at r20, 2 of 3 files at r21, 3 of 3 files at r22, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @Ipuch)

pariterre
pariterre previously approved these changes Dec 9, 2022
Copy link
Member

@pariterre pariterre left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 2 of 2 files at r23, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @Ipuch)

Copy link
Collaborator Author

@Ipuch Ipuch left a comment

Choose a reason for hiding this comment

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

Reviewable status: 94 of 102 files reviewed, 2 unresolved discussions (waiting on @pariterre)


bioptim/examples/custom_model/main.py line 1 at r2 (raw file):

Previously, pariterre (Pariterre) wrote…

Make sure to add in the GUI examples

Done.


bioptim/examples/custom_model/main.py line 8 at r11 (raw file):

Previously, pariterre (Pariterre) wrote…

To verify

Done.


bioptim/limits/constraints.py line 463 at r12 (raw file):

Previously, pariterre (Pariterre) wrote…

This should be done internally

Done.


bioptim/limits/penalty.py line 151 at r12 (raw file):

Previously, pariterre (Pariterre) wrote…

Move this in the actual interface

Done


bioptim/limits/penalty.py line 606 at r12 (raw file):

Previously, pariterre (Pariterre) wrote…

Not sure is it part of the API

Done


bioptim/optimization/optimal_control_program.py line 261 at r12 (raw file):

Done

Copy link
Collaborator Author

@Ipuch Ipuch left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: 94 of 102 files reviewed, 2 unresolved discussions (waiting on @pariterre)

Copy link
Member

@pariterre pariterre left a comment

Choose a reason for hiding this comment

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

Reviewed 8 of 8 files at r24, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Ipuch)

@Ipuch
Copy link
Collaborator Author

Ipuch commented Dec 10, 2022

Should animate be a method of bioModel ?

@pariterre
Copy link
Member

@Ipuch Could be... Add this to a todo!

@pariterre pariterre merged commit 8c1cd1a into pyomeca:master Dec 10, 2022
@Ipuch Ipuch deleted the disconnect_biorbd branch December 12, 2022 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Important
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants