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

Load / save OCP solution moved from CTDirect to CTBase #312

Merged
merged 3 commits into from
Dec 6, 2024

Conversation

PierreMartinon
Copy link
Member

@PierreMartinon PierreMartinon commented Dec 2, 2024

  • new extension CTBaseLoadSave with weakdeps JLD2 and JSON3, adds 2 functions import_ocp_solution and export_ocp_solution that allow to load and save OCP solutions. JLD2 format (binary) uses a functional solution while JSON3 format (text) uses a discrete solution.
  • dummy functions and exports are in optimal-control-solution-types.jl but could be moved anywhere.
  • tests have been added in test-solution.jl. Note that the JSON format requires the OCP solution to have a time grid (there is currently no default grid, just nothing).
  • a new OCS constructor from a discrete solution (ie vectors) has been added in optimal-control-solution-setters.jl. This one is used by CTDirect and the import function when using JSON format. It would also be used to import any solution in vector form. Note: the original is still present in CTDirect and will be removed when this version of CTBase is released.

@github-actions github-actions bot requested a review from ocots December 2, 2024 14:52
Copy link

github-actions bot commented Dec 2, 2024

Breakage test results
Date: 2024-12-06 16:56:00

Package name latest stable
CTDirect.jl compat: v0.14.0 compat: v0.13.1
CTFlows.jl compat: v0.13.1 compat: v0.13.1
OptimalControl.jl compat: v0.13.1 compat: v0.13.1

@@ -79,3 +79,14 @@ $(TYPEDFIELDS)
mult_control_box_lower::Union{Nothing, Function} = nothing
mult_control_box_upper::Union{Nothing, Function} = nothing
end

export export_ocp_solution
Copy link
Member

Choose a reason for hiding this comment

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

Maybe in CTBase.jl.


# placeholders (see extension CTBaseLoadSave)
function export_ocp_solution(args...; kwargs...)
error("Requires JLD2 and JSON3 packages")
Copy link
Member

Choose a reason for hiding this comment

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

Il y a un type pour ça. A voir.

@ocots ocots merged commit 9d7ec29 into main Dec 6, 2024
9 checks passed
@ocots ocots deleted the move_load_save_to_base branch December 6, 2024 14:56
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