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

Python Static Optimization #2405

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

pariterre
Copy link
Contributor

@pariterre pariterre commented Jan 22, 2019

New feature

Brief summary of changes

This is a Python implementation of the Static Optimization. One can use this example as template to perform their own static optimization in Python.

Testing I've completed

This gives similar results as the implementation of the Static Optimization that uses muscle equilibrium

CHANGELOG.md (choose one)

  • updated the python interface section with the following:
  • Added an example of Static optimization performed in Python 3.

The Doxygen for this PR can be viewed at http://myosin.sourceforge.net/?C=N;O=D; click the folder whose name is this PR's number.


This change is Reviewable

@pariterre pariterre changed the title Python static optim [WIP] Python Static Optimization Jan 22, 2019
@aymanhab
Copy link
Member

Thanks for this valuable contribution. Will review and respond on the PR. :+1

@pariterre pariterre changed the title [WIP] Python Static Optimization Python Static Optimization Mar 18, 2019
@pariterre
Copy link
Contributor Author

pariterre commented Apr 4, 2019

I was finishing to implement an improved linear approximation of the constraints in the StaticOptimization of the C++ code, when I noticed that sometimes, for no apparent reason, the muscles equilibrium failed. The work-around (in C++ code) is basically to modify ever so slightly the values of the activations (+0.1%) hoping this solves the equilibrium issues.

However, since it throws an error if it fails, right now it is impossible to do the same trick in Python (right now, the C++ throw by-passes the try-catch of python, crashing anyway). Is there a way to "try-catch" this error in python? If it is not possible, I don't think it is useful in any way to implement a full in-depth example of the Static Optimization in Python as the one proposed in this PR since the chances of success are very slim!

@pariterre
Copy link
Contributor Author

Or, if I am allowed, I would add the exceptions in the swig files so we can catch them :)

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