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

problem 10.7 of Betts' book #256

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

Conversation

Peter230655
Copy link
Contributor

In this example I added one differential equation to the eoms, as opty currently requires at least two scalar DE in the eoms.

@moorepants
Copy link
Member

moorepants commented Oct 31, 2024

The file names have to start with plot_ otherwise they will not run. Sphinx gallery uses file name patterns to detect what files are examples in the gallery.

@moorepants
Copy link
Member

This seems to run as a script but I am not seeing any output in the rendered html version.

prob.plot_constraint_violations(solution)

# Plot the objective function as a function of optimizer iteration.
prob.plot_objective_value()
Copy link
Member

Choose a reason for hiding this comment

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

I think the plots will not show unless you return the axes from this function.

@@ -0,0 +1,123 @@
"""
Copy link
Member

Choose a reason for hiding this comment

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

When you rename a file you need to use git mv old_filename.py new_filename.py, that way the old file doesn't remain.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The old filename does not show when I do "ls" in git. How can I remove it?
Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I somehow seem to have managed to remove the old file...

@Peter230655
Copy link
Contributor Author

Does this show the plots?

@moorepants
Copy link
Member

Yes, it runs and shows the plots. I don't see any errors, as you mentioned in the other issue.

@Peter230655
Copy link
Contributor Author

Peter230655 commented Oct 31, 2024

Yes, it runs and shows the plots. I don't see any errors, as you mentioned in the other issue.

You mean the error when I only have one scalar DE?
In the simulation I added a (mathematically not needed) second DE.
The DE in 10.7 is
$\dot y = -y^3 + u$
I changed this to
$uy = \dot y$
$uy = -y^3 + u$
like this it works fine, no error messages.

NB:
I run the problem twice:

  • first with $t_f = 10000$ as given in the example. opty finds a locally optimum solution, but the value of the objective function is far away from the minimum given in the book.
  • then I set $t_F = 8.0$ as I notived that y(t) $\approx 0$ except at the very beginning and close to the end. This way opty found a value for the objective function much closer to the one given in the book.

@moorepants
Copy link
Member

You wrote "This program runs fine im VSC, but in examples-gallery it looks like it never evewn starts to be exceuted.
Did anything change in examples-gallery lately, or is something wrong with my program below for examples-gallery?"

here: #255 (comment)

@Peter230655
Copy link
Contributor Author

You wrote "This program runs fine im VSC, but in examples-gallery it looks like it never evewn starts to be exceuted. Did anything change in examples-gallery lately, or is something wrong with my program below for examples-gallery?"

here: #255 (comment)

Sorry! This was fixed when I added the prefix "plot" to the name of the file, as you trold me,

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