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

better initial guess and fps = 20 for reduced running time #239

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Peter230655
Copy link
Contributor

@Peter230655 Peter230655 commented Sep 17, 2024

By giving better initial guesses and reducing fps to 20 from 30 running time reduced from 47 sec to 38 sec on my PC.
Are such improvements worth doing them? If yes, I will have a look at other simu,ations in examples-gallery, too. II have time and Betts' book has not arrived, yet)

@moorepants
Copy link
Member

Yes, basically there will be an upper limit of examples we can include as the times all add up. It is always helpful to redeuce their running time.

solution, info = prob.solve(initial_guess)
print('message from optimizer:', info['status_msg'])
print('Iterations needed', len(prob.obj_value))
print(f'Optimal h = {solution[-1]:.3e} sec')
np.save('ball_rolling_on_spinning_disc_solution.npy', solution)
Copy link
Member

Choose a reason for hiding this comment

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

This will now show up in the docs directory every time you build locally and will have to be manually removed. Either remove this line or include it in a comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will now show up in the docs directory every time you build locally and will have to be manually removed. Either remove this line or include it in a comment.

I simply forgot to remove it. I wil include in a comment, so people can see how to save a good initial guess for later use.

@Peter230655
Copy link
Contributor Author

Yes, basically there will be an upper limit of examples we can include as the times all add up. It is always helpful to redeuce their running time.

I will look at them one by one. Hopefully I can shave off a few seconds on some oth them.

# final_state_constraints[y], num_nodes)
# -i1 = -i3 / par_map[r]
# -i4 = np.zeros(8*num_nodes)
# -initial_guess = np.hstack((i1,i1a, i1b, i2, i3, i4, 0.01))
Copy link
Member

Choose a reason for hiding this comment

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

Also, for examples it is best not to have commented code. You can create this initial guess and then overwrite it with the npy file just like you did in the other.

fig1, ax1 = plt.subplots(14, 1, figsize=(7.25, 0.75*14), sharex=True,
layout='constrained')
prob.plot_trajectories(initial_guess, ax1)

Copy link
Member

@moorepants moorepants Sep 17, 2024

Choose a reason for hiding this comment

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

If you delete a figure, then the thumbnail figure may change, have you checked that? There will no longer be a figure 7, right?

I don't see any reason to delete the figure.

Copy link
Contributor Author

@Peter230655 Peter230655 Sep 17, 2024

Choose a reason for hiding this comment

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

If you delete a figure, then the thumbnail figure may change, have you checked that? There will no longer by a figure 7, right?

I don't see any reason to delete the figure. Is this related the the mixed up PRs?

I did not intentionally delete this. No idea what happened. Is this related to the mixed up PRs?
I will check and push again.

@@ -349,8 +349,10 @@ def obj_grad(free):
)

# %%
# The initial guess should meet the configuration constrains. It will be
# plotted below.
# The initial guess should meet the configuration constrains. Those below are
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# The initial guess should meet the configuration constrains. Those below are
# The initial guess should meet the configuration constraints. Those below are

@Peter230655
Copy link
Contributor Author

I do not know, why it failed a test before, do not understand the message.

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