Open moorepants opened 2 months ago
Another way to reduce time is to give better initial guesses. We can even store a solution and give that as a guess.
Another way to reduce time is to give better initial guesses. We can even store a solution and give that as a guess.
How can I store a solution, so it does not get lost when the program is closed? I thought about this often, but never came up with an idea... :-( (I mean short of printing the solution and then typüing it into the program...)
You can save any value to a txt file with many different methods. NumPy has builtin ways to do this: https://numpy.org/doc/stable/reference/routines.io.html
You can save any value to a txt file with many different methods. NumPy has builtin ways to do this: https://numpy.org/doc/stable/reference/routines.io.html
Amazing how this works - and it is two lines of code initially, no additional line in the final simulation. (After your hint, chatGPT told me the lines) I once modeled a drone with propellers, the one that wiggled and it cut down the simulation time from over one minute to 16 sec. - still wiggles, though :-)
Here is the output from a recent build on the readthedocs system, which is slower than running it locally:
computation time summary:
- ../examples-gallery/plot_parallel_park.py: 128.56 sec 0.0 MB
- ../examples-gallery/plot_pendulum_swing_up_variable_duration.py: 127.54 sec 0.0 MB
- ../examples-gallery/plot_pendulum_swing_up_fixed_duration.py: 124.13 sec 0.0 MB
- ../examples-gallery/plot_sliding_block.py: 105.60 sec 0.0 MB
- ../examples-gallery/plot_ball_rolling_on_spinning_disc.py: 95.81 sec 0.0 MB
- ../examples-gallery/plot_drone.py: 64.82 sec 0.0 MB
- ../examples-gallery/plot_one_legged_time_trial.py: 63.60 sec 0.0 MB
- ../examples-gallery/plot_two_link_pendulum_on_a_cart.py: 49.41 sec 0.0 MB
- ../examples-gallery/plot_crane_moving_a_load.py: 33.36 sec 0.0 MB
- ../examples-gallery/plot_non_contiguous_parameter_identification.py: 12.81 sec 0.0 MB
- ../examples-gallery/plot_vyasarayani.py: 12.40 sec 0.0 MB
- ../examples-gallery/plot_betts2003.py: 11.66 sec 0.0 MB
If I understand correctly, this is what I tried with the examples that have animations. Should be in the PRs.
Yes, you are. I'm just logging information here on the broader issue. I will get to all your PRs, but it just takes time.
Yes, you are. I'm just logging information here on the broader issue. I will get to all your PRs, but it just takes time.
I am in NO rush, I have time! Just wanted to make sure I understood right - which you confirmed!
NB: now that I know examples-gallery a bit better, I do not think, that my sailboat and my Mississippi steamer contribute much. The Kane part may be interesting - but the opty is standard. My double body skateboard at least shows, that iterating from a simple problem to a harder one can help opty to find a solution - but otherwise it is very contrived. Anyway, you be the judge.
We can add them all as long as we keep the time down and can always delete them later if we every have to replace one.
We can add them all as long as we keep the time down and can always delete them later if we every have to replace one.
makes emminent sense!
Here is the current timing from a clean build:
Reducing the time it takes to create animations is an easy adjusted, for example. We can safely skip generating a frame for every time instance by skipping frames with a minor adjustment to the code. Here is an example:
https://github.com/csu-hmc/opty/blob/master/examples-gallery/plot_drone.py#L299-L300