Skip to content

Conversation

@Ipuch
Copy link
Collaborator

@Ipuch Ipuch commented Feb 22, 2023

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? ODE integrator is not node specific as expected #621
  • 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?

This change is Reviewable

adressing node specific dynamics
objective as continuity
fix objective.
black
@Ipuch Ipuch changed the title [WIP] adressing node specific dynamics [RTR] adressing node specific dynamics Feb 23, 2023
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 6 of 6 files at r1, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @Ipuch)


bioptim/dynamics/ode_solver.py line 74 at r1 (raw file):

        if len(nlp.dynamics) != 1 and ocp.n_threads != 1:
            raise NotImplementedError("n_threads > 1 with external_forces is not implemented yet")
        # if len(nlp.dynamics) == 1:

This should be kept

Code quote:

        # if len(nlp.dynamics) == 1:
        #     nlp.dynamics = nlp.dynamics * nlp.ns

bioptim/examples/getting_started/example_external_forces.py line 78 at r1 (raw file):

    external_forces = [[np.array([[0, 0, 0, 0, 0, -2], [0, 0, 0, 0, 0, 5]]).T for _ in range(n_shooting)]]
    external_forces[0][2] = np.array([[0, 0, 0, 0, 0, -22], [0, 0, 0, 0, 0, 52]]).T
    # external_forces[0][5] = np.array([[0, 0, 500, 0, 0, -2], [0, 0, 500, 0, 0, 5]]).T

Don't forget to clean up

Code quote:

    external_forces[0][2] = np.array([[0, 0, 0, 0, 0, -22], [0, 0, 0, 0, 0, 52]]).T
    # external_forces[0][5] = np.array([[0, 0, 500, 0, 0, -2], [0, 0, 500, 0, 0, 5]]).T
    # external_forces[0][8] = np.array([[0, 0, 500, 0, 0, -2], [0, 0, 500, 0, -1000, 5]]).T
    # external_forces[0][11] = np.array([[0, 0, 500, 0, 0, -2], [0, 0, 500, 0, 0, 5]]).T
    external_forces[0][14] = np.array([[0, 0, 0, 0, 0, 100], [0, 0, 0, 0, 0, -6]]).T
    # external_forces[0][17] = np.array([[0, 0, 500, 0, 0, -2], [0, 0, 500, 0, 0, 5]]).T
    # external_forces[0][20] = np.array([[0, 0, 500, 0, 0, -2], [0, 0, 500, 0, -1000, 5]]).T

bioptim/limits/objective_functions.py line 297 at r1 (raw file):

        # Dynamics must be sound within phases
        for nlp in ocp.nlp:
            if len(nlp.dynamics) > 1:

This will always be the case

Code quote:

if len(nlp.dynamics) > 1:

bioptim/optimization/solution.py line 1032 at r1 (raw file):

            else:
                dynamics_func = nlp.dynamics * nlp.ns if len(nlp.dynamics) == 1 else nlp.dynamics

This will not be necessary

all tests works with restored example
review
fix  sol.print
black
@codecov
Copy link

codecov bot commented Feb 23, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.02 🎉

Comparison is base (c3e03b2) 81.67% compared to head (31682be) 81.70%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #624      +/-   ##
==========================================
+ Coverage   81.67%   81.70%   +0.02%     
==========================================
  Files         106      106              
  Lines       11804    11817      +13     
==========================================
+ Hits         9641     9655      +14     
+ Misses       2163     2162       -1     
Impacted Files Coverage Δ
bioptim/dynamics/ode_solver.py 89.25% <100.00%> (+0.56%) ⬆️
...xamples/getting_started/example_external_forces.py 88.23% <100.00%> (+0.35%) ⬆️
bioptim/limits/constraints.py 83.39% <100.00%> (+0.43%) ⬆️
bioptim/limits/objective_functions.py 88.71% <100.00%> (+0.05%) ⬆️
bioptim/limits/penalty.py 91.41% <100.00%> (+0.03%) ⬆️
bioptim/optimization/solution.py 83.65% <100.00%> (+0.07%) ⬆️

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.

irk has to work too
all done, last test fixed ! :)
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: 1 of 7 files reviewed, 4 unresolved discussions (waiting on @pariterre)


bioptim/dynamics/ode_solver.py line 74 at r1 (raw file):

Previously, pariterre (Pariterre) wrote…

This should be kept

Done


bioptim/examples/getting_started/example_external_forces.py line 78 at r1 (raw file):

Previously, pariterre (Pariterre) wrote…

Don't forget to clean up

Done


bioptim/limits/objective_functions.py line 297 at r1 (raw file):

Previously, pariterre (Pariterre) wrote…

This will always be the case

Done


bioptim/optimization/solution.py line 1032 at r1 (raw file):

Previously, pariterre (Pariterre) wrote…

This will not be necessary

Done

linted
@Ipuch
Copy link
Collaborator Author

Ipuch commented Feb 23, 2023

@pariterre PR ready to merge to me.

Ipuch and others added 5 commits February 23, 2023 19:54
print it alll, now continuity is printed for all nodes
test again
hello daft punk ?
praying the god of ci
yo !
don't test rk8 on windows and that's it .
@Ipuch
Copy link
Collaborator Author

Ipuch commented Feb 25, 2023

rk8 didn't fail but test_cyclic_nmpc failed this time .

try to patch
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 3 of 5 files at r2, 2 of 3 files at r3, 1 of 1 files at r4, 1 of 1 files at r5, 2 of 2 files at r6, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Ipuch)


tests/test_global_getting_started.py line 860 at r6 (raw file):

    f = np.array(sol.cost)
    np.testing.assert_equal(f.shape, (1, 1))
    np.testing.assert_almost_equal(f[0, 0], 7067.851604540213)

Is this expected?

Code quote:

7067.851604540213

balck and extra comments
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 3 of 3 files at r7, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Ipuch)

@pariterre pariterre merged commit 76bfa45 into pyomeca:master Mar 2, 2023
@Ipuch Ipuch deleted the node_dynamics branch July 6, 2023 21:05
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

Successfully merging this pull request may close these issues.

2 participants