obj_grad function #177
Replies: 4 comments 6 replies
-
In #164 this is the objective and its gradient: def obj(free):
"""Return h (always the last element in the free variables)."""
return free[-1]
def gradient(free):
"""Return the gradient of the objective."""
grad = np.zeros_like(free)
grad[-1] = 1.0
return grad |
Beta Was this translation helpful? Give feedback.
-
Clear, thanks! |
Beta Was this translation helpful? Give feedback.
-
Now I simply bounded h: 1.e-5 < h < 1, and it finds a solution quickly! |
Beta Was this translation helpful? Give feedback.
-
my simulation is a double pendulum attached to a chart, which moves left / right on a horizontal line. The force pushes the chart. |
Beta Was this translation helpful? Give feedback.
-
In the example of the pedalling with variable h you use this gradient function:
The second to last line: grad[-1] = np.sum(T**2) I do not understand.
What is the 'mathematical' background?
Thanks for any explanation!
Beta Was this translation helpful? Give feedback.
All reactions