Skip to content

Optimal control loss#12

Merged
AnasXbouali merged 7 commits intomainfrom
OptimalControl-loss
Aug 19, 2024
Merged

Optimal control loss#12
AnasXbouali merged 7 commits intomainfrom
OptimalControl-loss

Conversation

@AnasXbouali
Copy link
Copy Markdown
Collaborator

@AnasXbouali AnasXbouali commented Aug 19, 2024

Hi @ocots !

I modified the introduction and added a section about the 'PMP with loss control regions', as well as a presentation of the 'direct method'.

I believe the current version is ready to be merged with the main branch.

@ocots
Copy link
Copy Markdown
Member

ocots commented Aug 19, 2024

Just one info. Sometimes in the doc you have an output but you don't want one since it is ugly:

Capture d’écran 2024-08-19 à 20 44 07

To get rid of this output you can add nothing at the end of the code but with the comment# hide to hide nothing:

using JuMP
using Ipopt
using Plots
using Plots.PlotMeasures
using LaTeXStrings
using OptimalControl
using NLPModelsIpopt
include("smooth.jl");
nothing # hide

Project.toml Outdated
uuid = "6a3a0e7e-9c90-4c26-bc64-8dd630726a7b"
authors = ["Olivier Cots <olivier.cots@irit.fr>"]
version = "0.1.1"
version = "0.1.0"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe put the version "0.1.3" and make a new release if you want this to appear in the "stable" documentation.

README.md Outdated

This repo is part of the [control-toolbox ecosystem](https://github.com/control-toolbox).
The control-toolbox ecosystem gathers Julia packages for mathematical control and applications. The root package is [OptimalControl.jl](https://github.com/control-toolbox/OptimalControl.jl) which aims to provide tools to modelise and solve optimal control problems by direct and indirect methods. [![doc OptimalControl.jl](https://img.shields.io/badge/doc-OptimalControl.jl-blue)](http://control-toolbox.org/OptimalControl.jl)
The control-toolbox ecosystem gathers `Julia` packages for mathematical control and applications. The root package is [`OptimalControl.jl`](https://github.com/control-toolbox/OptimalControl.jl) which aims to provide tools to modelise and solve optimal control problems by direct and indirect methods. [![doc OptimalControl.jl](https://img.shields.io/badge/doc-OptimalControl.jl-blue)](http://control-toolbox.org/OptimalControl.jl)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Actually, instead of OptimalControl.jl we simply write OptimalControl.jl.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same for Julia. Be careful since, it seems that you have overwritten corrections I have made before.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This issue is solved.


```@example main
@def ocp begin
@def ocp begin
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

At the end of the code, you can add nothing # hide if you want.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, I used nothing # hide for most of the code and it worked well except in

N = 500
sol = solve(ocp; grid_size=N); 
nothing # hide

where it (still) shows the output.

Copy link
Copy Markdown
Member

@ocots ocots Aug 20, 2024

Choose a reason for hiding this comment

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

@AnasXbouali This is not really an output but a trace during the optimization process. To turn it off you can use the option display:

N = 500
sol = solve(ocp; grid_size=N, display=false)

and if you don't want to print the output, here print sol, then you can add:

N = 500
sol = solve(ocp; grid_size=N, display=false)
nothing # hide

Note. You can remove ";" when using nothing # hide.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Noted, Thanks!

Copy link
Copy Markdown
Member

@ocots ocots Aug 20, 2024

Choose a reason for hiding this comment

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

@AnasXbouali If you want the trace but there are many iterations and you want a shorter display, you can use the print_level option from Ipopt.

sol = solve(ocp; grid_size=N, print_level=4)

See https://control-toolbox.org/OptimalControl.jl/stable/tutorial-double-integrator.html#Solve-and-plot

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice addition!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think when the new release v0.1.3 is out, then we could add a link to this doc in the menu of OptimalControl.jl in the Applications part.

@codecov
Copy link
Copy Markdown

codecov bot commented Aug 19, 2024

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@AnasXbouali AnasXbouali merged commit a4128a0 into main Aug 19, 2024
@ocots
Copy link
Copy Markdown
Member

ocots commented Aug 20, 2024

@AnasXbouali Pense à supprimer la branche une fois le merge fait. Clique sur "Delete branch" en bas, cf image.

Capture d’écran 2024-08-20 à 10 28 44

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