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

rewrite optimization tutorial #2916

Merged
merged 2 commits into from
Aug 4, 2024
Merged

Conversation

ArnoStrouwen
Copy link
Member

Turns the optimization tutorial into an actual Documenter example.

However, I'm stuck at the guess metadata.
OptimizationProblem complains that no guess is present for x.

I also think the comma present after x and y looks a bit weird:

@variables begin
    x, [bounds = (-2.0, 2.0), guess = 1.0]
    y, [bounds = (-1.0, 3.0), guess = 3.0]
end

No such comma is present in the examples on:
https://docs.sciml.ai/ModelingToolkit/stable/basics/Variable_metadata/#Additional-functions
Yet deleting them here gives a whitespace error.

@ChrisRackauckas
Copy link
Member

I also think the comma present after x and y looks a bit weird:

It's a detail that comes from Julia's parser.

@ArnoStrouwen
Copy link
Member Author

Apparently, the guess metadata is only compatible with initialization problems for ODE.
I mistakenly thought this would have also transferred to nonlinear problem and optimization problem.
Instead, I had to use the default value.

When this passes tests, it should be good to go.

@ArnoStrouwen ArnoStrouwen marked this pull request as ready for review August 4, 2024 12:59
@ChrisRackauckas ChrisRackauckas merged commit 50a4b12 into SciML:master Aug 4, 2024
4 checks passed
@ChrisRackauckas
Copy link
Member

Yes, guess semantics are for embedded initialization problems. The starting value for an optimization or nonlinear problem is not considered a guess in these semantics, but the initial state.

@ArnoStrouwen ArnoStrouwen deleted the docs branch August 4, 2024 13:58
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