From 25450fb64dd89ba0418962fca27a7fe739bd91f8 Mon Sep 17 00:00:00 2001 From: Youri Date: Wed, 18 Jun 2025 10:14:13 +0200 Subject: [PATCH 1/9] start of regularization tutorial --- docs/src/tutorial-regularization.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 docs/src/tutorial-regularization.md diff --git a/docs/src/tutorial-regularization.md b/docs/src/tutorial-regularization.md new file mode 100644 index 0000000..e69de29 From 0c6f749796769abc169d1e94251e7c9a7bfb6518 Mon Sep 17 00:00:00 2001 From: Youri Date: Thu, 19 Jun 2025 15:27:51 +0200 Subject: [PATCH 2/9] Definition of orbital transfer problem with regalarization --- docs/Project.toml | 1 + docs/make.jl | 3 +- docs/src/assets/Manifest.toml | 292 ++++++++++++---------------- docs/src/assets/Project.toml | 6 +- docs/src/tutorial-regularization.md | 150 ++++++++++++++ 5 files changed, 285 insertions(+), 167 deletions(-) diff --git a/docs/Project.toml b/docs/Project.toml index 8fe9d0e..0cc8353 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -15,6 +15,7 @@ OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb" +Tutorials = "cb10daa6-a5e5-4c25-a171-ae181b8ea3c9" [compat] BenchmarkTools = "1.6" diff --git a/docs/make.jl b/docs/make.jl index 93aeb96..09e2375 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -8,7 +8,7 @@ cp("./docs/Project.toml", "./docs/src/assets/Project.toml"; force=true) repo_url = "github.com/control-toolbox/Tutorials.jl" makedocs(; - draft=false, # if draft is true, then the julia code from .md is not executed + draft=true, # if draft is true, then the julia code from .md is not executed warnonly=[:cross_references, :autodocs_block], sitename="Tutorials", format=Documenter.HTML(; @@ -31,6 +31,7 @@ makedocs(; "Linear–quadratic regulator" => "tutorial-lqr.md", "Minimal action" => "tutorial-mam.md", "Model Predictive Control" => "tutorial-mpc.md", + "Regularization methods" => "tutorial-regularization.md", ], ], ) diff --git a/docs/src/assets/Manifest.toml b/docs/src/assets/Manifest.toml index f31f319..e323262 100644 --- a/docs/src/assets/Manifest.toml +++ b/docs/src/assets/Manifest.toml @@ -2,7 +2,7 @@ julia_version = "1.11.5" manifest_format = "2.0" -project_hash = "a0f7a38986e41d62db81da09b6b12da3c238b679" +project_hash = "e7183c2ad8bb7ad385c3187377b285a34e621395" [[deps.ADNLPModels]] deps = ["ADTypes", "ForwardDiff", "LinearAlgebra", "NLPModels", "Requires", "ReverseDiff", "SparseArrays", "SparseConnectivityTracer", "SparseMatrixColorings"] @@ -88,12 +88,6 @@ version = "1.1.3" uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f" version = "1.1.2" -[[deps.ArnoldiMethod]] -deps = ["LinearAlgebra", "Random", "StaticArrays"] -git-tree-sha1 = "d57bd3762d308bded22c3b82d033bff85f6195c6" -uuid = "ec485272-7323-5ecc-a04f-4719b315124d" -version = "0.4.0" - [[deps.ArrayInterface]] deps = ["Adapt", "LinearAlgebra"] git-tree-sha1 = "9606d7832795cbef89e06a550475be300364a8aa" @@ -150,6 +144,12 @@ version = "1.1.0" uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" version = "1.11.0" +[[deps.BenchmarkTools]] +deps = ["Compat", "JSON", "Logging", "Printf", "Profile", "Statistics", "UUIDs"] +git-tree-sha1 = "e38fbc49a620f5d0b660d7f543db1009fe0f8336" +uuid = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" +version = "1.6.0" + [[deps.BitFlags]] git-tree-sha1 = "0691e34b3bb8be9307330f88d1a3c3f25466c24d" uuid = "d1d4a3ce-64b1-5f1a-9ba4-7e7e69966f35" @@ -163,12 +163,13 @@ version = "0.1.6" [[deps.BracketingNonlinearSolve]] deps = ["CommonSolve", "ConcreteStructs", "NonlinearSolveBase", "PrecompileTools", "Reexport", "SciMLBase"] -git-tree-sha1 = "637ebe439ba587828fd997b7810d8171eed2ea1b" +git-tree-sha1 = "a9014924595b7a2c1dd14aac516e38fa10ada656" uuid = "70df07ce-3d50-431d-a3e7-ca6ddb60ac1e" -version = "1.2.0" -weakdeps = ["ForwardDiff"] +version = "1.3.0" +weakdeps = ["ChainRulesCore", "ForwardDiff"] [deps.BracketingNonlinearSolve.extensions] + BracketingNonlinearSolveChainRulesCoreExt = ["ChainRulesCore", "ForwardDiff"] BracketingNonlinearSolveForwardDiffExt = "ForwardDiff" [[deps.Bzip2_jll]] @@ -185,9 +186,9 @@ version = "0.2.6" [[deps.CTBase]] deps = ["DocStringExtensions"] -git-tree-sha1 = "715a4381eb5e1d11ee92d86759ada1c27689345f" +git-tree-sha1 = "1e0fb19f883cda373412fd40f2ccad71758cb876" uuid = "54762871-cc72-4466-b8e8-f6c8b58076cd" -version = "0.16.0" +version = "0.16.1" [[deps.CTDirect]] deps = ["ADNLPModels", "CTBase", "CTModels", "CTParser", "DocStringExtensions", "HSL", "MKL", "NLPModelsIpopt", "SparseArrays"] @@ -238,9 +239,9 @@ version = "0.2.5" [[deps.Cairo_jll]] deps = ["Artifacts", "Bzip2_jll", "CompilerSupportLibraries_jll", "Fontconfig_jll", "FreeType2_jll", "Glib_jll", "JLLWrappers", "LZO_jll", "Libdl", "Pixman_jll", "Xorg_libXext_jll", "Xorg_libXrender_jll", "Zlib_jll", "libpng_jll"] -git-tree-sha1 = "2ac646d71d0d24b44f3f8c84da8c9f4d70fb67df" +git-tree-sha1 = "fde3bf89aead2e723284a8ff9cdf5b551ed700e8" uuid = "83423d85-b0ee-5818-9007-b63ccbeb887a" -version = "1.18.4+0" +version = "1.18.5+0" [[deps.ChainRulesCore]] deps = ["Compat", "LinearAlgebra"] @@ -292,9 +293,9 @@ weakdeps = ["SpecialFunctions"] [[deps.Colors]] deps = ["ColorTypes", "FixedPointNumbers", "Reexport"] -git-tree-sha1 = "64e15186f0aa277e174aa81798f7eb8598e0157e" +git-tree-sha1 = "37ea44092930b1811e666c3bc38065d7d87fcc74" uuid = "5ae59095-9a9b-59fe-a467-6f913c188581" -version = "0.13.0" +version = "0.13.1" [[deps.CommonSolve]] git-tree-sha1 = "0eee5eb66b1cf62cd6ad1b460238e60e4b09400c" @@ -419,9 +420,9 @@ version = "1.9.1" [[deps.DiffEqBase]] deps = ["ArrayInterface", "ConcreteStructs", "DataStructures", "DocStringExtensions", "EnumX", "EnzymeCore", "FastBroadcast", "FastClosures", "FastPower", "FunctionWrappers", "FunctionWrappersWrappers", "LinearAlgebra", "Logging", "Markdown", "MuladdMacro", "Parameters", "PrecompileTools", "Printf", "RecursiveArrayTools", "Reexport", "SciMLBase", "SciMLOperators", "SciMLStructures", "Setfield", "Static", "StaticArraysCore", "Statistics", "SymbolicIndexingInterface", "TruncatedStacktraces"] -git-tree-sha1 = "1bcd3a5c585c477e5d0595937ea7b5adcda6c621" +git-tree-sha1 = "a0e5b5669df9465bc3dd32ea4a8ddeefbc0f7b5c" uuid = "2b5f629d-d688-5b77-993f-72d75c75574e" -version = "6.174.0" +version = "6.175.0" [deps.DiffEqBase.extensions] DiffEqBaseCUDAExt = "CUDA" @@ -434,6 +435,7 @@ version = "6.174.0" DiffEqBaseMPIExt = "MPI" DiffEqBaseMeasurementsExt = "Measurements" DiffEqBaseMonteCarloMeasurementsExt = "MonteCarloMeasurements" + DiffEqBaseMooncakeExt = "Mooncake" DiffEqBaseReverseDiffExt = "ReverseDiff" DiffEqBaseSparseArraysExt = "SparseArrays" DiffEqBaseTrackerExt = "Tracker" @@ -450,6 +452,7 @@ version = "6.174.0" MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195" Measurements = "eff96d63-e80a-5855-80a2-b1b0885c5ab7" MonteCarloMeasurements = "0987c9cc-fe09-11e8-30f0-b96dd679fdca" + Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6" ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267" SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c" @@ -523,15 +526,15 @@ uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b" version = "1.11.0" [[deps.DocStringExtensions]] -git-tree-sha1 = "e7b7e6f178525d17c720ab9c081e4ef04429f860" +git-tree-sha1 = "7442a5dfe1ebb773c29cc2962a8980f47221d76c" uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" -version = "0.9.4" +version = "0.9.5" [[deps.Documenter]] deps = ["ANSIColoredPrinters", "AbstractTrees", "Base64", "CodecZlib", "Dates", "DocStringExtensions", "Downloads", "Git", "IOCapture", "InteractiveUtils", "JSON", "Logging", "Markdown", "MarkdownAST", "Pkg", "PrecompileTools", "REPL", "RegistryInstances", "SHA", "TOML", "Test", "Unicode"] -git-tree-sha1 = "6c182d0bd94142d7cbc3ae8a1e74668f15d0dd65" +git-tree-sha1 = "0ef76e54dfe9d736350a79334dc66236598c8d38" uuid = "e30172f5-a6a5-5a46-863b-614d45cd2de4" -version = "1.11.4" +version = "1.12.0" [[deps.Downloads]] deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"] @@ -544,9 +547,9 @@ uuid = "4e289a0a-7415-4d19-859d-a7e5c4648b56" version = "1.0.5" [[deps.EnzymeCore]] -git-tree-sha1 = "1eb59f40a772d0fbd4cb75e00b3fa7f5f79c975a" +git-tree-sha1 = "7d7822a643c33bbff4eab9c87ca8459d7c688db0" uuid = "f151be2c-9106-41f4-ab19-57ee4f262869" -version = "0.8.9" +version = "0.8.11" weakdeps = ["Adapt"] [deps.EnzymeCore.extensions] @@ -783,9 +786,9 @@ version = "2.49.0+0" [[deps.Glib_jll]] deps = ["Artifacts", "Gettext_jll", "JLLWrappers", "Libdl", "Libffi_jll", "Libiconv_jll", "Libmount_jll", "PCRE2_jll", "Zlib_jll"] -git-tree-sha1 = "b0036b392358c80d2d2124746c2bf3d48d457938" +git-tree-sha1 = "fee60557e4f19d0fe5cd169211fdda80e494f4e8" uuid = "7746bdde-850d-59dc-9ae8-88ece973131d" -version = "2.82.4+0" +version = "2.84.0+0" [[deps.Graphite2_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] @@ -793,12 +796,6 @@ git-tree-sha1 = "8a6dbda1fd736d60cc477d99f2e7a042acfa46e8" uuid = "3b182d85-2403-5c21-9c21-1e1f0cc25472" version = "1.3.15+0" -[[deps.Graphs]] -deps = ["ArnoldiMethod", "Compat", "DataStructures", "Distributed", "Inflate", "LinearAlgebra", "Random", "SharedArrays", "SimpleTraits", "SparseArrays", "Statistics"] -git-tree-sha1 = "3169fd3440a02f35e549728b0890904cfd4ae58a" -uuid = "86223c79-3864-5bf0-83f7-82e725a168b6" -version = "1.12.1" - [[deps.Grisu]] git-tree-sha1 = "53bb909d1151e57e2484c3d1b53e19552b887fb2" uuid = "42e2da0e-8278-4e71-bc24-59509adca0fe" @@ -824,9 +821,9 @@ version = "1.10.16" [[deps.HarfBuzz_jll]] deps = ["Artifacts", "Cairo_jll", "Fontconfig_jll", "FreeType2_jll", "Glib_jll", "Graphite2_jll", "JLLWrappers", "Libdl", "Libffi_jll"] -git-tree-sha1 = "55c53be97790242c29031e5cd45e8ac296dadda3" +git-tree-sha1 = "f923f9a774fcf3f5cb761bfa43aeadd689714813" uuid = "2e76f6c2-a576-52d4-95c1-20adfe4de566" -version = "8.5.0+0" +version = "8.5.1+0" [[deps.Hwloc_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] @@ -845,11 +842,6 @@ git-tree-sha1 = "debdd00ffef04665ccbb3e150747a77560e8fad1" uuid = "615f187c-cbe4-4ef1-ba3b-2fcf58d6d173" version = "0.1.1" -[[deps.Inflate]] -git-tree-sha1 = "d1b1b796e47d94588b3757fe84fbf65a5ec4a80d" -uuid = "d25df0c9-e2be-5dd7-82c8-3ad0b3e990b9" -version = "0.1.5" - [[deps.InlineStrings]] git-tree-sha1 = "6a9fde685a7ac1eb3495f8e812c5a7c3711c2d5e" uuid = "842dd82b-1e85-43dc-bf29-5d0ee9dffc48" @@ -901,9 +893,9 @@ version = "1.3.1" [[deps.Ipopt]] deps = ["Ipopt_jll", "LinearAlgebra", "OpenBLAS32_jll", "PrecompileTools"] -git-tree-sha1 = "100030874c53b61d8c21d1bcb725265555d146ff" +git-tree-sha1 = "4ad0d2dea51e5d49866b40a2d2521da6a1be7097" uuid = "b6b21f68-93f8-5de0-b562-5493be1d77c9" -version = "1.10.3" +version = "1.10.6" [deps.Ipopt.extensions] IpoptMathOptInterfaceExt = "MathOptInterface" @@ -913,9 +905,9 @@ version = "1.10.3" [[deps.Ipopt_jll]] deps = ["ASL_jll", "Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl", "MUMPS_seq_jll", "SPRAL_jll", "libblastrampoline_jll"] -git-tree-sha1 = "4f55ad688c698a4f77d892a1cb673f7e8a30f178" +git-tree-sha1 = "1bb978524c2837be596aeb2b69951feb6b9822f8" uuid = "9cc047cb-c261-5740-88fc-0cf96f7bdcc7" -version = "300.1400.1700+0" +version = "300.1400.1701+0" [[deps.IrrationalConstants]] git-tree-sha1 = "e2222959fbc6c19554dc15174c81bf7bf3aa691c" @@ -1000,19 +992,21 @@ version = "1.4.0" [[deps.Latexify]] deps = ["Format", "InteractiveUtils", "LaTeXStrings", "MacroTools", "Markdown", "OrderedCollections", "Requires"] -git-tree-sha1 = "cd10d2cc78d34c0e2a3a36420ab607b611debfbb" +git-tree-sha1 = "4f34eaabe49ecb3fb0d58d6015e32fd31a733199" uuid = "23fbe1c1-3f47-55db-b15f-69d7ec21a316" -version = "0.16.7" +version = "0.16.8" [deps.Latexify.extensions] DataFramesExt = "DataFrames" SparseArraysExt = "SparseArrays" SymEngineExt = "SymEngine" + TectonicExt = "tectonic_jll" [deps.Latexify.weakdeps] DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" SymEngine = "123dc426-2d89-5057-bbad-38513e3affd8" + tectonic_jll = "d7dd28d6-a5e6-559c-9131-7eb760cdacc5" [[deps.LayoutPointers]] deps = ["ArrayInterface", "LinearAlgebra", "ManualMemory", "SIMDTypes", "Static", "StaticArrayInterface"] @@ -1078,10 +1072,10 @@ uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" version = "1.11.0" [[deps.Libffi_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] -git-tree-sha1 = "27ecae93dd25ee0909666e6835051dd684cc035e" +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "c8da7e6a91781c41a863611c7e966098d783c57a" uuid = "e9f186c6-92d2-5b65-8a66-fee21dc1b490" -version = "3.2.2+2" +version = "3.4.7+0" [[deps.Libglvnd_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Xorg_libX11_jll", "Xorg_libXext_jll"] @@ -1158,9 +1152,9 @@ version = "2.10.0" [[deps.LinearSolve]] deps = ["ArrayInterface", "ChainRulesCore", "ConcreteStructs", "DocStringExtensions", "EnumX", "GPUArraysCore", "InteractiveUtils", "Krylov", "LazyArrays", "Libdl", "LinearAlgebra", "MKL_jll", "Markdown", "PrecompileTools", "Preferences", "RecursiveArrayTools", "Reexport", "SciMLBase", "SciMLOperators", "Setfield", "StaticArraysCore", "UnPack"] -git-tree-sha1 = "6cc433e4e8cf070fc54bf29f620685d21890fe07" +git-tree-sha1 = "c0d1a91a50af6778863d320761f807f641f74935" uuid = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae" -version = "3.14.1" +version = "3.17.0" [deps.LinearSolve.extensions] LinearSolveBandedMatricesExt = "BandedMatrices" @@ -1255,9 +1249,9 @@ version = "0.4.17" [[deps.MUMPS_seq_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl", "METIS_jll", "libblastrampoline_jll"] -git-tree-sha1 = "0eab12f94948ca67908aec14b9f2ebefd17463fe" +git-tree-sha1 = "196f61d99adc06f32c32bc4afe5298d9b1e862c8" uuid = "d7ed1dd3-d0ae-5e8e-bfb4-87a502085b8d" -version = "500.700.301+0" +version = "500.800.0+0" [[deps.MacroTools]] git-tree-sha1 = "1e0228a030642014fe5cfe68c2c0a818f9e3f522" @@ -1356,10 +1350,10 @@ uuid = "f4238b75-b362-5c4c-b852-0801c9a21d71" version = "0.10.4" [[deps.NLSolversBase]] -deps = ["DiffResults", "Distributed", "FiniteDiff", "ForwardDiff"] -git-tree-sha1 = "a0b464d183da839699f4c79e7606d9d186ec172c" +deps = ["ADTypes", "DifferentiationInterface", "Distributed", "FiniteDiff", "ForwardDiff"] +git-tree-sha1 = "25a6638571a902ecfb1ae2a18fc1575f86b1d4df" uuid = "d41bc354-129a-5804-8e4c-c37616107c6c" -version = "7.8.3" +version = "7.10.0" [[deps.NaNMath]] deps = ["OpenLibm_jll"] @@ -1405,9 +1399,9 @@ version = "4.9.0" [[deps.NonlinearSolveBase]] deps = ["ADTypes", "Adapt", "ArrayInterface", "CommonSolve", "Compat", "ConcreteStructs", "DifferentiationInterface", "EnzymeCore", "FastClosures", "LinearAlgebra", "Markdown", "MaybeInplace", "Preferences", "Printf", "RecursiveArrayTools", "SciMLBase", "SciMLJacobianOperators", "SciMLOperators", "StaticArraysCore", "SymbolicIndexingInterface", "TimerOutputs"] -git-tree-sha1 = "1a6f6b161a644beac3c46a46f9bbb830c24abffb" +git-tree-sha1 = "404d71dd057759f4d590191a643113485c4a482a" uuid = "be0214bd-f91f-a760-ac4e-3421ce2b2da0" -version = "1.8.0" +version = "1.12.0" [deps.NonlinearSolveBase.extensions] NonlinearSolveBaseBandedMatricesExt = "BandedMatrices" @@ -1435,9 +1429,9 @@ version = "1.5.0" [[deps.NonlinearSolveQuasiNewton]] deps = ["ArrayInterface", "CommonSolve", "ConcreteStructs", "DiffEqBase", "LinearAlgebra", "LinearSolve", "MaybeInplace", "NonlinearSolveBase", "PrecompileTools", "Reexport", "SciMLBase", "SciMLOperators", "StaticArraysCore"] -git-tree-sha1 = "b69a68ef3a7bba7ab1d5ef6321ed6d9a613142b0" +git-tree-sha1 = "e3888bdbab6e0bfadbc3164ef4595e40e7b7e954" uuid = "9a2c21bd-3a47-402d-9113-8faf9a0ee114" -version = "1.5.0" +version = "1.6.0" weakdeps = ["ForwardDiff"] [deps.NonlinearSolveQuasiNewton.extensions] @@ -1527,9 +1521,9 @@ version = "1.8.1" [[deps.OrdinaryDiffEq]] deps = ["ADTypes", "Adapt", "ArrayInterface", "DataStructures", "DiffEqBase", "DocStringExtensions", "EnumX", "ExponentialUtilities", "FastBroadcast", "FastClosures", "FillArrays", "FiniteDiff", "ForwardDiff", "FunctionWrappersWrappers", "InteractiveUtils", "LineSearches", "LinearAlgebra", "LinearSolve", "Logging", "MacroTools", "MuladdMacro", "NonlinearSolve", "OrdinaryDiffEqAdamsBashforthMoulton", "OrdinaryDiffEqBDF", "OrdinaryDiffEqCore", "OrdinaryDiffEqDefault", "OrdinaryDiffEqDifferentiation", "OrdinaryDiffEqExplicitRK", "OrdinaryDiffEqExponentialRK", "OrdinaryDiffEqExtrapolation", "OrdinaryDiffEqFIRK", "OrdinaryDiffEqFeagin", "OrdinaryDiffEqFunctionMap", "OrdinaryDiffEqHighOrderRK", "OrdinaryDiffEqIMEXMultistep", "OrdinaryDiffEqLinear", "OrdinaryDiffEqLowOrderRK", "OrdinaryDiffEqLowStorageRK", "OrdinaryDiffEqNonlinearSolve", "OrdinaryDiffEqNordsieck", "OrdinaryDiffEqPDIRK", "OrdinaryDiffEqPRK", "OrdinaryDiffEqQPRK", "OrdinaryDiffEqRKN", "OrdinaryDiffEqRosenbrock", "OrdinaryDiffEqSDIRK", "OrdinaryDiffEqSSPRK", "OrdinaryDiffEqStabilizedIRK", "OrdinaryDiffEqStabilizedRK", "OrdinaryDiffEqSymplecticRK", "OrdinaryDiffEqTsit5", "OrdinaryDiffEqVerner", "Polyester", "PreallocationTools", "PrecompileTools", "Preferences", "RecursiveArrayTools", "Reexport", "SciMLBase", "SciMLOperators", "SciMLStructures", "SimpleNonlinearSolve", "SimpleUnPack", "SparseArrays", "Static", "StaticArrayInterface", "StaticArrays", "TruncatedStacktraces"] -git-tree-sha1 = "56d5500e9970f0112a4e1ab6474d6fedde61ef64" +git-tree-sha1 = "1c2b2df870944e0dc01454fd87479847c55fa26c" uuid = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" -version = "6.97.0" +version = "6.98.0" [[deps.OrdinaryDiffEqAdamsBashforthMoulton]] deps = ["DiffEqBase", "FastBroadcast", "MuladdMacro", "OrdinaryDiffEqCore", "OrdinaryDiffEqLowOrderRK", "Polyester", "RecursiveArrayTools", "Reexport", "Static"] @@ -1539,9 +1533,9 @@ version = "1.2.0" [[deps.OrdinaryDiffEqBDF]] deps = ["ADTypes", "ArrayInterface", "DiffEqBase", "FastBroadcast", "LinearAlgebra", "MacroTools", "MuladdMacro", "OrdinaryDiffEqCore", "OrdinaryDiffEqDifferentiation", "OrdinaryDiffEqNonlinearSolve", "OrdinaryDiffEqSDIRK", "PrecompileTools", "Preferences", "RecursiveArrayTools", "Reexport", "StaticArrays", "TruncatedStacktraces"] -git-tree-sha1 = "970ac761ae1c4249fc70d75760c328269a518585" +git-tree-sha1 = "9124a686af119063bb4d3a8f87044a8f312fcad9" uuid = "6ad6398a-0878-4a85-9266-38940aa047c8" -version = "1.3.0" +version = "1.6.0" [[deps.OrdinaryDiffEqCore]] deps = ["ADTypes", "Accessors", "Adapt", "ArrayInterface", "DataStructures", "DiffEqBase", "DocStringExtensions", "EnumX", "FastBroadcast", "FastClosures", "FastPower", "FillArrays", "FunctionWrappersWrappers", "InteractiveUtils", "LinearAlgebra", "Logging", "MacroTools", "MuladdMacro", "Polyester", "PrecompileTools", "Preferences", "RecursiveArrayTools", "Reexport", "SciMLBase", "SciMLOperators", "SciMLStructures", "SimpleUnPack", "Static", "StaticArrayInterface", "StaticArraysCore", "SymbolicIndexingInterface", "TruncatedStacktraces"] @@ -1560,10 +1554,10 @@ uuid = "50262376-6c5a-4cf5-baba-aaf4f84d72d7" version = "1.4.0" [[deps.OrdinaryDiffEqDifferentiation]] -deps = ["ADTypes", "ArrayInterface", "DiffEqBase", "FastBroadcast", "FiniteDiff", "ForwardDiff", "FunctionWrappersWrappers", "LinearAlgebra", "LinearSolve", "OrdinaryDiffEqCore", "SciMLBase", "SparseArrays", "SparseDiffTools", "StaticArrayInterface", "StaticArrays"] -git-tree-sha1 = "9a535370247496c1375ba6d08b0493c0d856d25b" +deps = ["ADTypes", "ArrayInterface", "ConcreteStructs", "ConstructionBase", "DiffEqBase", "DifferentiationInterface", "FastBroadcast", "FiniteDiff", "ForwardDiff", "FunctionWrappersWrappers", "LinearAlgebra", "LinearSolve", "OrdinaryDiffEqCore", "SciMLBase", "SciMLOperators", "SparseArrays", "SparseMatrixColorings", "StaticArrayInterface", "StaticArrays"] +git-tree-sha1 = "efecf0c4cc44e16251b0e718f08b0876b2a82b80" uuid = "4302a76b-040a-498a-8c04-15b101fed76b" -version = "1.4.0" +version = "1.10.0" [[deps.OrdinaryDiffEqExplicitRK]] deps = ["DiffEqBase", "FastBroadcast", "LinearAlgebra", "MuladdMacro", "OrdinaryDiffEqCore", "RecursiveArrayTools", "Reexport", "TruncatedStacktraces"] @@ -1585,9 +1579,9 @@ version = "1.5.0" [[deps.OrdinaryDiffEqFIRK]] deps = ["ADTypes", "DiffEqBase", "FastBroadcast", "FastGaussQuadrature", "FastPower", "LinearAlgebra", "LinearSolve", "MuladdMacro", "OrdinaryDiffEqCore", "OrdinaryDiffEqDifferentiation", "OrdinaryDiffEqNonlinearSolve", "Polyester", "RecursiveArrayTools", "Reexport", "SciMLBase", "SciMLOperators"] -git-tree-sha1 = "588f454cc1c48c20a32f03838af4983053a1d3ae" +git-tree-sha1 = "0da8ec3491821262a3d2828e6370e76b51a770a3" uuid = "5960d6e9-dd7a-4743-88e7-cf307b64f125" -version = "1.9.0" +version = "1.12.0" [[deps.OrdinaryDiffEqFeagin]] deps = ["DiffEqBase", "FastBroadcast", "MuladdMacro", "OrdinaryDiffEqCore", "Polyester", "RecursiveArrayTools", "Reexport", "Static"] @@ -1633,9 +1627,9 @@ version = "1.3.0" [[deps.OrdinaryDiffEqNonlinearSolve]] deps = ["ADTypes", "ArrayInterface", "DiffEqBase", "FastBroadcast", "FastClosures", "ForwardDiff", "LinearAlgebra", "LinearSolve", "MuladdMacro", "NonlinearSolve", "OrdinaryDiffEqCore", "OrdinaryDiffEqDifferentiation", "PreallocationTools", "RecursiveArrayTools", "SciMLBase", "SciMLOperators", "SciMLStructures", "SimpleNonlinearSolve", "StaticArrays"] -git-tree-sha1 = "1b89e3e84752a3cbd2c94db565e6ea7acb5279b2" +git-tree-sha1 = "ffdb0f5207b0e30f8b1edf99b3b9546d9c48ccaf" uuid = "127b3ac7-2247-4354-8eb6-78cf4e7c58e8" -version = "1.5.0" +version = "1.10.0" [[deps.OrdinaryDiffEqNordsieck]] deps = ["DiffEqBase", "FastBroadcast", "LinearAlgebra", "MuladdMacro", "OrdinaryDiffEqCore", "OrdinaryDiffEqTsit5", "Polyester", "RecursiveArrayTools", "Reexport", "Static"] @@ -1645,9 +1639,9 @@ version = "1.1.0" [[deps.OrdinaryDiffEqPDIRK]] deps = ["ADTypes", "DiffEqBase", "FastBroadcast", "MuladdMacro", "OrdinaryDiffEqCore", "OrdinaryDiffEqDifferentiation", "OrdinaryDiffEqNonlinearSolve", "Polyester", "Reexport", "StaticArrays"] -git-tree-sha1 = "f74b27b8b811a83d77a9cad6293e793ab0804cdc" +git-tree-sha1 = "ab9897e4bc8e3cf8e15f1cf61dbdd15d6a2341d7" uuid = "5dd0a6cf-3d4b-4314-aa06-06d4e299bc89" -version = "1.3.0" +version = "1.3.1" [[deps.OrdinaryDiffEqPRK]] deps = ["DiffEqBase", "FastBroadcast", "MuladdMacro", "OrdinaryDiffEqCore", "Polyester", "Reexport"] @@ -1668,10 +1662,10 @@ uuid = "af6ede74-add8-4cfd-b1df-9a4dbb109d7a" version = "1.1.0" [[deps.OrdinaryDiffEqRosenbrock]] -deps = ["ADTypes", "DiffEqBase", "FastBroadcast", "FiniteDiff", "ForwardDiff", "LinearAlgebra", "LinearSolve", "MacroTools", "MuladdMacro", "OrdinaryDiffEqCore", "OrdinaryDiffEqDifferentiation", "Polyester", "PrecompileTools", "Preferences", "RecursiveArrayTools", "Reexport", "Static"] -git-tree-sha1 = "bede3226fd485741e364239e23236e07ace77639" +deps = ["ADTypes", "DiffEqBase", "DifferentiationInterface", "FastBroadcast", "FiniteDiff", "ForwardDiff", "LinearAlgebra", "LinearSolve", "MacroTools", "MuladdMacro", "OrdinaryDiffEqCore", "OrdinaryDiffEqDifferentiation", "Polyester", "PrecompileTools", "Preferences", "RecursiveArrayTools", "Reexport", "Static"] +git-tree-sha1 = "1ce0096d920e95773220e818f29bf4b37ea2bb78" uuid = "43230ef6-c299-4910-a778-202eb28ce4ce" -version = "1.8.0" +version = "1.11.0" [[deps.OrdinaryDiffEqSDIRK]] deps = ["ADTypes", "DiffEqBase", "FastBroadcast", "LinearAlgebra", "MacroTools", "MuladdMacro", "OrdinaryDiffEqCore", "OrdinaryDiffEqDifferentiation", "OrdinaryDiffEqNonlinearSolve", "RecursiveArrayTools", "Reexport", "SciMLBase", "TruncatedStacktraces"] @@ -1720,17 +1714,11 @@ deps = ["Artifacts", "Libdl"] uuid = "efcefdf7-47ab-520b-bdef-62a2eaa19f15" version = "10.42.0+1" -[[deps.PackageExtensionCompat]] -git-tree-sha1 = "fb28e33b8a95c4cee25ce296c817d89cc2e53518" -uuid = "65ce6f38-6b18-4e1d-a461-8949797d7930" -version = "1.0.2" -weakdeps = ["Requires", "TOML"] - [[deps.Pango_jll]] deps = ["Artifacts", "Cairo_jll", "Fontconfig_jll", "FreeType2_jll", "FriBidi_jll", "Glib_jll", "HarfBuzz_jll", "JLLWrappers", "Libdl"] -git-tree-sha1 = "3b31172c032a1def20c98dae3f2cdc9d10e3b561" +git-tree-sha1 = "275a9a6d85dc86c24d03d1837a0010226a96f540" uuid = "36c8627f-9965-5494-a995-c6b170f724f3" -version = "1.56.1+0" +version = "1.56.3+0" [[deps.Parameters]] deps = ["OrderedCollections", "UnPack"] @@ -1793,9 +1781,9 @@ version = "1.40.13" [[deps.Polyester]] deps = ["ArrayInterface", "BitTwiddlingConvenienceFunctions", "CPUSummary", "IfElse", "ManualMemory", "PolyesterWeave", "Static", "StaticArrayInterface", "StrideArraysCore", "ThreadingUtilities"] -git-tree-sha1 = "2082cc4be5e765bd982ed04ea06c068f4f702410" +git-tree-sha1 = "6f7cd22a802094d239824c57d94c8e2d0f7cfc7d" uuid = "f517fe37-dbe3-4b94-8317-1923a5111588" -version = "0.7.17" +version = "0.7.18" [[deps.PolyesterWeave]] deps = ["BitTwiddlingConvenienceFunctions", "CPUSummary", "IfElse", "Static", "ThreadingUtilities"] @@ -1843,6 +1831,10 @@ deps = ["Unicode"] uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" version = "1.11.0" +[[deps.Profile]] +uuid = "9abbd945-dff8-562f-b5e8-e1ebf5ef1b79" +version = "1.11.0" + [[deps.PtrArrays]] git-tree-sha1 = "1d36ef11a9aaf1e8b74dacc6a731dd1de8fd493d" uuid = "43287f4e-b6f4-7ad1-bb20-aadabca52c3d" @@ -1969,9 +1961,9 @@ version = "1.16.1" [[deps.RuntimeGeneratedFunctions]] deps = ["ExprTools", "SHA", "Serialization"] -git-tree-sha1 = "7cb9d10026d630ce2dd2a1fc6006a3d5041b34c0" +git-tree-sha1 = "86a8a8b783481e1ea6b9c91dd949cb32191f8ab4" uuid = "7e49a35a-f44a-4d26-94aa-eba1b4ca6b47" -version = "0.5.14" +version = "0.5.15" [[deps.SHA]] uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" @@ -1984,15 +1976,15 @@ version = "0.1.0" [[deps.SPRAL_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "Hwloc_jll", "JLLWrappers", "Libdl", "METIS_jll", "libblastrampoline_jll"] -git-tree-sha1 = "11f3da4b25efacd1cec8e263421f2a9003a5e8e0" +git-tree-sha1 = "4f9833187a65ead66ed1907b44d5f20606282e3f" uuid = "319450e9-13b8-58e8-aa9f-8fd1420848ab" -version = "2024.5.8+0" +version = "2025.5.20+0" [[deps.SciMLBase]] -deps = ["ADTypes", "Accessors", "ArrayInterface", "CommonSolve", "ConstructionBase", "Distributed", "DocStringExtensions", "EnumX", "FunctionWrappersWrappers", "IteratorInterfaceExtensions", "LinearAlgebra", "Logging", "Markdown", "Moshi", "PrecompileTools", "Preferences", "Printf", "RecipesBase", "RecursiveArrayTools", "Reexport", "RuntimeGeneratedFunctions", "SciMLOperators", "SciMLStructures", "StaticArraysCore", "Statistics", "SymbolicIndexingInterface"] -git-tree-sha1 = "2fd047893cb0089b180fcbb7e8434ba15dcc2841" +deps = ["ADTypes", "Accessors", "Adapt", "ArrayInterface", "CommonSolve", "ConstructionBase", "Distributed", "DocStringExtensions", "EnumX", "FunctionWrappersWrappers", "IteratorInterfaceExtensions", "LinearAlgebra", "Logging", "Markdown", "Moshi", "PrecompileTools", "Preferences", "Printf", "RecipesBase", "RecursiveArrayTools", "Reexport", "RuntimeGeneratedFunctions", "SciMLOperators", "SciMLStructures", "StaticArraysCore", "Statistics", "SymbolicIndexingInterface"] +git-tree-sha1 = "d7bef263e23c7f5392071e4538b1949cee7ae458" uuid = "0bca4576-84f4-4d90-8ffe-ffa030f20462" -version = "2.87.0" +version = "2.99.0" [deps.SciMLBase.extensions] SciMLBaseChainRulesCoreExt = "ChainRulesCore" @@ -2017,15 +2009,15 @@ version = "2.87.0" [[deps.SciMLJacobianOperators]] deps = ["ADTypes", "ArrayInterface", "ConcreteStructs", "ConstructionBase", "DifferentiationInterface", "FastClosures", "LinearAlgebra", "SciMLBase", "SciMLOperators"] -git-tree-sha1 = "d563758f3ce5153810adebc534d88e24d34eeb95" +git-tree-sha1 = "7da1216346ad79499d08d7e2a3dbf297dc80c829" uuid = "19f34311-ddf3-4b8b-af20-060888a46c0e" -version = "0.1.5" +version = "0.1.6" [[deps.SciMLOperators]] deps = ["Accessors", "ArrayInterface", "DocStringExtensions", "LinearAlgebra", "MacroTools"] -git-tree-sha1 = "1c4b7f6c3e14e6de0af66e66b86d525cae10ecb4" +git-tree-sha1 = "d82853c515a8d9d42c1ab493a2687a37f1e26c91" uuid = "c0aeaf25-5076-4817-a8d5-81caf7dfa961" -version = "0.3.13" +version = "0.4.0" weakdeps = ["SparseArrays", "StaticArraysCore"] [deps.SciMLOperators.extensions] @@ -2094,12 +2086,6 @@ version = "2.5.0" ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267" Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c" -[[deps.SimpleTraits]] -deps = ["InteractiveUtils", "MacroTools"] -git-tree-sha1 = "5d7e3f4e11935503d3ecaf7186eac40602e7d231" -uuid = "699a6c99-e7fa-54fc-8d76-47d257e15c1d" -version = "0.9.4" - [[deps.SimpleUnPack]] git-tree-sha1 = "58e6353e72cde29b90a69527e56df1b5c3d8c437" uuid = "ce78b400-467f-4804-87d8-8f486da07d0a" @@ -2128,9 +2114,9 @@ version = "1.11.0" [[deps.SparseConnectivityTracer]] deps = ["ADTypes", "DocStringExtensions", "FillArrays", "LinearAlgebra", "Random", "SparseArrays"] -git-tree-sha1 = "fadb2d7010dd92912e5eb31a493613ad4b8c9583" +git-tree-sha1 = "2c3cbb3703f77045d4eb891b2831ca132ef4183c" uuid = "9f842d2f-2579-4b1d-911e-f412cf18a3f5" -version = "0.6.18" +version = "0.6.19" [deps.SparseConnectivityTracer.extensions] SparseConnectivityTracerDataInterpolationsExt = "DataInterpolations" @@ -2146,31 +2132,11 @@ version = "0.6.18" NaNMath = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3" SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b" -[[deps.SparseDiffTools]] -deps = ["ADTypes", "Adapt", "ArrayInterface", "Compat", "DataStructures", "FiniteDiff", "ForwardDiff", "Graphs", "LinearAlgebra", "PackageExtensionCompat", "Random", "Reexport", "SciMLOperators", "Setfield", "SparseArrays", "StaticArrayInterface", "StaticArrays", "UnPack", "VertexSafeGraphs"] -git-tree-sha1 = "ccbf06a08573200853b1bd06203d8ccce8449578" -uuid = "47a9eef4-7e08-11e9-0b38-333d64bd3804" -version = "2.26.0" - - [deps.SparseDiffTools.extensions] - SparseDiffToolsEnzymeExt = "Enzyme" - SparseDiffToolsPolyesterExt = "Polyester" - SparseDiffToolsPolyesterForwardDiffExt = "PolyesterForwardDiff" - SparseDiffToolsSymbolicsExt = "Symbolics" - SparseDiffToolsZygoteExt = "Zygote" - - [deps.SparseDiffTools.weakdeps] - Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9" - Polyester = "f517fe37-dbe3-4b94-8317-1923a5111588" - PolyesterForwardDiff = "98d1487c-24ca-40b6-b7ab-df2af84e126b" - Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7" - Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" - [[deps.SparseMatrixColorings]] -deps = ["ADTypes", "DocStringExtensions", "LinearAlgebra", "Random", "SparseArrays"] -git-tree-sha1 = "76e9564f0de0d1d7a46095e758ae13ceba680cfb" +deps = ["ADTypes", "DocStringExtensions", "LinearAlgebra", "PrecompileTools", "Random", "SparseArrays"] +git-tree-sha1 = "ab958b4fec46d1f1d057bb8e2a99bfdb90744646" uuid = "0a514795-09f3-496d-8182-132a7b665d35" -version = "0.4.19" +version = "0.4.20" [deps.SparseMatrixColorings.extensions] SparseMatrixColoringsCliqueTreesExt = "CliqueTrees" @@ -2241,9 +2207,9 @@ weakdeps = ["SparseArrays"] [[deps.StatsAPI]] deps = ["LinearAlgebra"] -git-tree-sha1 = "1ff449ad350c9c4cbc756624d6f8a8c3ef56d3ed" +git-tree-sha1 = "9d72a13a3f4dd3795a195ac5a44d7d6ff5f552ff" uuid = "82ae8749-77ed-4fe6-ae5f-f523153014b0" -version = "1.7.0" +version = "1.7.1" [[deps.StatsBase]] deps = ["AliasTables", "DataAPI", "DataStructures", "LinearAlgebra", "LogExpFunctions", "Missings", "Printf", "Random", "SortingAlgorithms", "SparseArrays", "Statistics", "StatsAPI"] @@ -2301,9 +2267,9 @@ version = "1.0.1" [[deps.Tables]] deps = ["DataAPI", "DataValueInterfaces", "IteratorInterfaceExtensions", "OrderedCollections", "TableTraits"] -git-tree-sha1 = "598cd7c1f68d1e205689b1c2fe65a9f85846f297" +git-tree-sha1 = "f2c1efbc8f3a609aadf318094f8fc5204bdaf344" uuid = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" -version = "1.12.0" +version = "1.12.1" [[deps.Tar]] deps = ["ArgTools", "SHA"] @@ -2351,9 +2317,9 @@ uuid = "781d530d-4396-4725-bb49-402e4bee1e77" version = "1.4.0" [[deps.Tutorials]] -path = "/Users/ocots/Research/logiciels/dev/control-toolbox/Tutorials" +path = "C:\\Users\\youri\\Desktop\\ENSEEIHT\\Stage\\Tutorials.jl" uuid = "cb10daa6-a5e5-4c25-a171-ae181b8ea3c9" -version = "0.1.3" +version = "0.1.4" [[deps.URIs]] git-tree-sha1 = "cbbebadbcc76c5ca1cc4b4f3b0614b3e603b5000" @@ -2382,32 +2348,28 @@ version = "0.4.1" [[deps.Unitful]] deps = ["Dates", "LinearAlgebra", "Random"] -git-tree-sha1 = "d62610ec45e4efeabf7032d67de2ffdea8344bed" +git-tree-sha1 = "02c1ac8104c9cf941395db79c611483909c04c7d" uuid = "1986cc42-f94f-5a68-af5c-568840ba703d" -version = "1.22.1" -weakdeps = ["ConstructionBase", "InverseFunctions"] +version = "1.23.0" +weakdeps = ["ConstructionBase", "ForwardDiff", "InverseFunctions", "Printf"] [deps.Unitful.extensions] ConstructionBaseUnitfulExt = "ConstructionBase" + ForwardDiffExt = "ForwardDiff" InverseFunctionsUnitfulExt = "InverseFunctions" + PrintfExt = "Printf" [[deps.UnitfulLatexify]] deps = ["LaTeXStrings", "Latexify", "Unitful"] -git-tree-sha1 = "975c354fcd5f7e1ddcc1f1a23e6e091d99e99bc8" +git-tree-sha1 = "af305cc62419f9bd61b6644d19170a4d258c7967" uuid = "45397f5d-5981-4c77-b2b3-fc36d6e9b728" -version = "1.6.4" +version = "1.7.0" [[deps.Unzip]] git-tree-sha1 = "ca0969166a028236229f63514992fc073799bb78" uuid = "41fe7b60-77ed-43a1-b4f0-825fd5a5650d" version = "0.2.0" -[[deps.VertexSafeGraphs]] -deps = ["Graphs"] -git-tree-sha1 = "8351f8d73d7e880bfc042a8b6922684ebeafb35c" -uuid = "19fa3120-7c27-5ec5-8db8-b0b0aa330d6f" -version = "0.2.0" - [[deps.Vulkan_Loader_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Wayland_jll", "Xorg_libX11_jll", "Xorg_libXrandr_jll", "xkbcommon_jll"] git-tree-sha1 = "2f0486047a07670caad3a81a075d2e518acc5c59" @@ -2415,10 +2377,10 @@ uuid = "a44049a8-05dd-5a78-86c9-5fde0876e88c" version = "1.3.243+0" [[deps.Wayland_jll]] -deps = ["Artifacts", "EpollShim_jll", "Expat_jll", "JLLWrappers", "Libdl", "Libffi_jll", "Pkg", "XML2_jll"] -git-tree-sha1 = "85c7811eddec9e7f22615371c3cc81a504c508ee" +deps = ["Artifacts", "EpollShim_jll", "Expat_jll", "JLLWrappers", "Libdl", "Libffi_jll", "XML2_jll"] +git-tree-sha1 = "49be0be57db8f863a902d59c0083d73281ecae8e" uuid = "a2964d1f-97da-50d4-b82a-358c7fce9d89" -version = "1.21.0+2" +version = "1.23.1+0" [[deps.Wayland_protocols_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] @@ -2541,28 +2503,28 @@ uuid = "12413925-8142-5f55-bb0e-6d7ca50bb09b" version = "0.4.0+1" [[deps.Xorg_xcb_util_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_libxcb_jll"] -git-tree-sha1 = "e7fd7b2881fa2eaa72717420894d3938177862d1" +deps = ["Artifacts", "JLLWrappers", "Libdl", "Xorg_libxcb_jll"] +git-tree-sha1 = "68da27247e7d8d8dafd1fcf0c3654ad6506f5f97" uuid = "2def613f-5ad1-5310-b15b-b15d46f528f5" -version = "0.4.0+1" +version = "0.4.1+0" [[deps.Xorg_xcb_util_keysyms_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_xcb_util_jll"] -git-tree-sha1 = "d1151e2c45a544f32441a567d1690e701ec89b00" +deps = ["Artifacts", "JLLWrappers", "Libdl", "Xorg_xcb_util_jll"] +git-tree-sha1 = "44ec54b0e2acd408b0fb361e1e9244c60c9c3dd4" uuid = "975044d2-76e6-5fbe-bf08-97ce7c6574c7" -version = "0.4.0+1" +version = "0.4.1+0" [[deps.Xorg_xcb_util_renderutil_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_xcb_util_jll"] -git-tree-sha1 = "dfd7a8f38d4613b6a575253b3174dd991ca6183e" +deps = ["Artifacts", "JLLWrappers", "Libdl", "Xorg_xcb_util_jll"] +git-tree-sha1 = "5b0263b6d080716a02544c55fdff2c8d7f9a16a0" uuid = "0d47668e-0667-5a69-a72c-f761630bfb7e" -version = "0.3.9+1" +version = "0.3.10+0" [[deps.Xorg_xcb_util_wm_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_xcb_util_jll"] -git-tree-sha1 = "e78d10aab01a4a154142c5006ed44fd9e8e31b67" +deps = ["Artifacts", "JLLWrappers", "Libdl", "Xorg_xcb_util_jll"] +git-tree-sha1 = "f233c83cad1fa0e70b7771e0e21b061a116f2763" uuid = "c22f9ab0-d5fe-5066-847c-f4bb1cd4e361" -version = "0.4.1+1" +version = "0.4.2+0" [[deps.Xorg_xkbcomp_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Xorg_libxkbfile_jll"] @@ -2641,10 +2603,10 @@ uuid = "1183f4f0-6f2a-5f1a-908b-139f9cdfea6f" version = "0.2.2+0" [[deps.libevdev_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] -git-tree-sha1 = "141fe65dc3efabb0b1d5ba74e91f6ad26f84cc22" +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "56d643b57b188d30cccc25e331d416d3d358e557" uuid = "2db6ffa8-e38f-5e21-84af-90c45d0032cc" -version = "1.11.0+0" +version = "1.13.4+0" [[deps.libfdk_aac_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] @@ -2671,10 +2633,10 @@ uuid = "f27f6e37-5d2b-51aa-960f-b287f2bc3b7a" version = "1.3.7+2" [[deps.mtdev_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] -git-tree-sha1 = "814e154bdb7be91d78b6802843f76b6ece642f11" +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "b4d631fd51f2e9cdd93724ae25b2efc198b059b1" uuid = "009596ad-96f7-51b1-9f1b-5ce2d5e8a71e" -version = "1.1.6+0" +version = "1.1.7+0" [[deps.nghttp2_jll]] deps = ["Artifacts", "Libdl"] diff --git a/docs/src/assets/Project.toml b/docs/src/assets/Project.toml index ef12086..0cc8353 100644 --- a/docs/src/assets/Project.toml +++ b/docs/src/assets/Project.toml @@ -1,4 +1,5 @@ [deps] +BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" DifferentiationInterface = "a0c0ee7d-e4b9-4e03-894e-1c5f64a51d63" Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" @@ -12,10 +13,12 @@ NonlinearSolve = "8913a72c-1f9b-4ce2-8d82-65094dcecaec" OptimalControl = "5f98b655-cc9a-415a-b60e-744165666948" OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" +Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb" Tutorials = "cb10daa6-a5e5-4c25-a171-ae181b8ea3c9" [compat] +BenchmarkTools = "1.6" DataFrames = "1.7" DifferentiationInterface = "0.7" Documenter = "1.8" @@ -29,5 +32,6 @@ NonlinearSolve = "4.6" OptimalControl = "1.0" OrdinaryDiffEq = "6.93" Plots = "1.40" +Printf = "1" Suppressor = "0.2" -julia = "1" +julia = "1.10" diff --git a/docs/src/tutorial-regularization.md b/docs/src/tutorial-regularization.md index e69de29..36a3fb9 100644 --- a/docs/src/tutorial-regularization.md +++ b/docs/src/tutorial-regularization.md @@ -0,0 +1,150 @@ +```@meta + draft=false +``` +## Regularization method application : + +Regularization in optimal control helps to smooth discontinuous or “bang-bang” control laws, making the problem more numerically tractable. It improves the convergence of solvers by ensuring differentiability. Regularization also avoids issues like singularities or ill-conditioned Jacobians in shooting methods. A common technique is to penalize controls near their bounds using barrier or penalty functions. This allows gradually approaching the true optimal solution while maintaining stability during computation. + +## Regularization of an Orbital Transfer with Logarithmic Barrier + +# Introduction + +This tutorial demonstrates how to regularize a bounded-thrust orbital transfer optimal control problem, typically of "bang-bang" type, using a logarithmic barrier on the control. We will use Gauss coordinates, which simplify the equations of orbital motion. + +The problem will be solved using two approaches: + + - a direct method (NLP formulation + Ipopt solver), + + - an indirect method (shooting with a regularized Hamiltonian). + +Problem data and constants : + +```@example orbit +using OptimalControl +using NLPModelsIpopt +using BenchmarkTools +using DataFrames +using Plots +using Printf +using LinearAlgebra + +const Tmax = 60 # Maximum thrust (N) +const cTmax = 3600^2 / 1e6; const T = Tmax * cTmax # Conversion N → kg*Mm/h² +const mass0 = 1500 # Initial mass (kg) +const β = 1.42e-2 # Specific impulse +const μ = 5165.8620912 # Gravitational constant + +const P0 = 11.625 +const ex0, ey0 = 0.75, 0 +const hx0, hy0 = 6.12e-2, 0 +const L0 = π +const Pf = 42.165 +const exf, eyf = 0.0, 0.0 +const hxf, hyf = 0.0, 0.0 +const ε = 1e-2 # Regularization parameter + +x0 = [P0, ex0, ey0, hx0, hy0, L0] +xf = [Pf, exf, eyf, hxf, hyf] +``` + +Dynamic functions in Gauss coordinates : + +```@example orbit +asqrt(x; ε=1e-9) = sqrt(sqrt(x^2 + ε^2)) + +function F0(x) + P, ex, ey, hx, hy, L = x + pdm = asqrt(P / μ) + cl = cos(L); sl = sin(L) + w = 1 + ex * cl + ey * sl + F = zeros(eltype(x), 6) + F[6] = w^2 / (P * pdm) + return F +end + +function F1(x) + P, ex, ey, hx, hy, L = x + pdm = asqrt(P / μ) + cl = cos(L); sl = sin(L) + F = zeros(eltype(x), 6) + F[2] = pdm * sl + F[3] = pdm * (-cl) + return F +end + +function F2(x) + P, ex, ey, hx, hy, L = x + pdm = asqrt(P / μ) + cl = cos(L); sl = sin(L) + w = 1 + ex * cl + ey * sl + F = zeros(eltype(x), 6) + F[1] = pdm * 2 * P / w + F[2] = pdm * (cl + (ex + cl) / w) + F[3] = pdm * (sl + (ey + sl) / w) + return F +end + +function F3(x) + P, ex, ey, hx, hy, L = x + pdm = asqrt(P / μ) + cl = cos(L); sl = sin(L) + w = 1 + ex * cl + ey * sl + pdmw = pdm / w + zz = hx * sl - hy * cl + uh = (1 + hx^2 + hy^2) / 2 + F = zeros(eltype(x), 6) + F[2] = pdmw * (-zz * ey) + F[3] = pdmw * (zz * ex) + F[4] = pdmw * uh * cl + F[5] = pdmw * uh * sl + F[6] = pdmw * zz + return F +end +``` + +Optimal control problem with regularization : + +```@example orbit +@def ocp begin + tf ∈ R, variable + t ∈ [0, tf], time + x = (P, ex, ey, hx, hy, L) ∈ R⁶, state + u ∈ R³, control + x(0) == x0 + x[1:5](tf) == xf[1:5] + mass = mass0 - β * T * t + ẋ(t) == F0(x(t)) + (T / mass) * (u₁(t) * F1(x(t)) + u₂(t) * F2(x(t)) + u₃(t) * F3(x(t))) + u₁(t)^2 + u₂(t)^2 + u₃(t)^2 < 1 + tf → min + ε * ∫(log(1 - (u₁(t)^2 + u₂(t)^2 + u₃(t)^2))) +end +``` + +# Direct numerical solution + +```@example orbit +using NLPModelsIpopt + +u0 = [0.1, 0.5, 0.0] +xguess(t) = x0 + (xf - x0) * t / 15 +nlp_init = (state=xguess, control=u0, variable=15.0) +nlp_sol = solve(ocp; init=nlp_init, grid_size=100) +plot(nlp_sol) +``` + +# Indirect solution (Regularized shooting) + + + +# Conclusion + +This tutorial shows how to solve a minimum-time orbital transfer with bounded thrust using a logarithmic barrier to regularize the problem. This approach facilitates the numerical solution by avoiding "bang-bang" control profiles. + +The use of Gauss coordinates enables a simpler and more efficient modeling of orbital dynamics. + +## References + +Epenoy & Bertrand (CNES) "Optimal control and smoothing techniques..." + +OptimalControl.jl Tutorial: Kepler minimum time + +Cots Olivier, Contrôle optimal géométrique : méthodes homotopiques et applications (2012) \ No newline at end of file From be2641b68d77056fd53bcca670526bf4cb718ff6 Mon Sep 17 00:00:00 2001 From: Youri Date: Fri, 20 Jun 2025 15:34:35 +0200 Subject: [PATCH 3/9] Minimal consumption problem error with a negative log ?? --- docs/src/tutorial-regularization.md | 126 ++++++++++++++-------------- 1 file changed, 63 insertions(+), 63 deletions(-) diff --git a/docs/src/tutorial-regularization.md b/docs/src/tutorial-regularization.md index 36a3fb9..f8cca6d 100644 --- a/docs/src/tutorial-regularization.md +++ b/docs/src/tutorial-regularization.md @@ -1,5 +1,5 @@ ```@meta - draft=false +Draft=false ``` ## Regularization method application : @@ -28,95 +28,93 @@ using Plots using Printf using LinearAlgebra -const Tmax = 60 # Maximum thrust (N) -const cTmax = 3600^2 / 1e6; const T = Tmax * cTmax # Conversion N → kg*Mm/h² -const mass0 = 1500 # Initial mass (kg) -const β = 1.42e-2 # Specific impulse -const μ = 5165.8620912 # Gravitational constant - -const P0 = 11.625 -const ex0, ey0 = 0.75, 0 -const hx0, hy0 = 6.12e-2, 0 -const L0 = π -const Pf = 42.165 -const exf, eyf = 0.0, 0.0 -const hxf, hyf = 0.0, 0.0 -const ε = 1e-2 # Regularization parameter - -x0 = [P0, ex0, ey0, hx0, hy0, L0] -xf = [Pf, exf, eyf, hxf, hyf] +const μ = 5.1658620912e12 # Constante gravitationnelle +const Tmax = 100.0 # Poussée max +const γmax = Tmax * 3600^2 / (2000 * 1e3) # Contrôle max +const ε = 1e-2 # Paramètre de régularisation + +# État initial en coordonnées de Gauss 2D : (P, ex, ey, L) +x0 = [10000.0, 0.01, 0.0, 0.0] + +# État final en coordonnées de Gauss 2D +xf = [42164.0, 0.0, 0.0, π] + +T_min_100 = 13.4 # Temps minimal avec Tmax=100 (donné) +tf = 1.5 * T_min_100 # Temps final (à ajuster) ``` Dynamic functions in Gauss coordinates : ```@example orbit -asqrt(x; ε=1e-9) = sqrt(sqrt(x^2 + ε^2)) +asqrt(x; ε=1e-9) = sqrt(sqrt(x^2 + ε^2)) # sqrt lissée pour AD function F0(x) - P, ex, ey, hx, hy, L = x + P, ex, ey, L = x pdm = asqrt(P / μ) - cl = cos(L); sl = sin(L) + cl = cos(L) + sl = sin(L) w = 1 + ex * cl + ey * sl - F = zeros(eltype(x), 6) - F[6] = w^2 / (P * pdm) + F = zeros(eltype(x), 4) + F[4] = w^2 / (P * pdm) # dérivée de L (anomalie vraie) return F end function F1(x) - P, ex, ey, hx, hy, L = x + # Direction de contrôle u₁ (dans le plan) + P, ex, ey, L = x pdm = asqrt(P / μ) - cl = cos(L); sl = sin(L) - F = zeros(eltype(x), 6) - F[2] = pdm * sl - F[3] = pdm * (-cl) + cl = cos(L) + sl = sin(L) + F = zeros(eltype(x), 4) + F[2] = pdm * sl # dérivée de ex + F[3] = -pdm * cl # dérivée de ey return F end function F2(x) - P, ex, ey, hx, hy, L = x + # Direction de contrôle u₂ (dans le plan) + P, ex, ey, L = x pdm = asqrt(P / μ) - cl = cos(L); sl = sin(L) + cl = cos(L) + sl = sin(L) w = 1 + ex * cl + ey * sl - F = zeros(eltype(x), 6) - F[1] = pdm * 2 * P / w + F = zeros(eltype(x), 4) + F[1] = pdm * 2 * P / w # dérivée de P F[2] = pdm * (cl + (ex + cl) / w) F[3] = pdm * (sl + (ey + sl) / w) return F end - -function F3(x) - P, ex, ey, hx, hy, L = x - pdm = asqrt(P / μ) - cl = cos(L); sl = sin(L) - w = 1 + ex * cl + ey * sl - pdmw = pdm / w - zz = hx * sl - hy * cl - uh = (1 + hx^2 + hy^2) / 2 - F = zeros(eltype(x), 6) - F[2] = pdmw * (-zz * ey) - F[3] = pdmw * (zz * ex) - F[4] = pdmw * uh * cl - F[5] = pdmw * uh * sl - F[6] = pdmw * zz - return F -end ``` Optimal control problem with regularization : ```@example orbit -@def ocp begin - tf ∈ R, variable - t ∈ [0, tf], time - x = (P, ex, ey, hx, hy, L) ∈ R⁶, state - u ∈ R³, control - x(0) == x0 - x[1:5](tf) == xf[1:5] - mass = mass0 - β * T * t - ẋ(t) == F0(x(t)) + (T / mass) * (u₁(t) * F1(x(t)) + u₂(t) * F2(x(t)) + u₃(t) * F3(x(t))) - u₁(t)^2 + u₂(t)^2 + u₃(t)^2 < 1 - tf → min + ε * ∫(log(1 - (u₁(t)^2 + u₂(t)^2 + u₃(t)^2))) +function min_conso() + @def ocp begin + t ∈ [0, tf], time + x = (P, ex, ey, L) ∈ R⁴, state + u ∈ R², control + + # Conditions initiales et finales + x(0) == x0 + x[1:3](tf) == xf[1:3] # P, ex, ey à l'arrivée + x[4](tf) == xf[4] # anomalie vraie à l'arrivée + + # Dynamique + ẋ(t) == F0(x(t)) + Tmax * (u₁(t) * F1(x(t)) + u₂(t) * F2(x(t))) + + norm = sqrt(u₁(t)^2 + u₂(t)^2) + + # Contrôle borné + norm^2 ≤ γmax^2 + + # Coût avec barrière logarithmique pour régularisation + ∫(norm - ε * (log(norm) + log(γmax - norm))) → min + end + + return ocp end +nothing # hide ``` # Direct numerical solution @@ -124,9 +122,11 @@ end ```@example orbit using NLPModelsIpopt -u0 = [0.1, 0.5, 0.0] -xguess(t) = x0 + (xf - x0) * t / 15 -nlp_init = (state=xguess, control=u0, variable=15.0) +u0 = [0.1, 0.0] +xguess(t) = x0 + (xf - x0) * t / tf + +ocp = min_conso() +nlp_init = (state = xguess, control = u0) nlp_sol = solve(ocp; init=nlp_init, grid_size=100) plot(nlp_sol) ``` From c713145a74c4e424d7e1989618ff4f060625210e Mon Sep 17 00:00:00 2001 From: Youri Date: Mon, 23 Jun 2025 16:45:14 +0200 Subject: [PATCH 4/9] tried different init method + start of indirect resolution --- docs/src/tutorial-regularization.md | 95 ++++++++++++++++++++++++++--- 1 file changed, 88 insertions(+), 7 deletions(-) diff --git a/docs/src/tutorial-regularization.md b/docs/src/tutorial-regularization.md index f8cca6d..714ca4c 100644 --- a/docs/src/tutorial-regularization.md +++ b/docs/src/tutorial-regularization.md @@ -29,7 +29,7 @@ using Printf using LinearAlgebra const μ = 5.1658620912e12 # Constante gravitationnelle -const Tmax = 100.0 # Poussée max +const Tmax = 60.0 # Poussée max const γmax = Tmax * 3600^2 / (2000 * 1e3) # Contrôle max const ε = 1e-2 # Paramètre de régularisation @@ -40,7 +40,7 @@ x0 = [10000.0, 0.01, 0.0, 0.0] xf = [42164.0, 0.0, 0.0, π] T_min_100 = 13.4 # Temps minimal avec Tmax=100 (donné) -tf = 1.5 * T_min_100 # Temps final (à ajuster) +# tf = 1.5 * T_min_100 # Temps final (à ajuster) ``` Dynamic functions in Gauss coordinates : @@ -95,36 +95,78 @@ function min_conso() x = (P, ex, ey, L) ∈ R⁴, state u ∈ R², control - # Conditions initiales et finales + # Constrains x(0) == x0 x[1:3](tf) == xf[1:3] # P, ex, ey à l'arrivée x[4](tf) == xf[4] # anomalie vraie à l'arrivée - # Dynamique + norm = sqrt(u₁(t)^2 + u₂(t)^2) + + # Control limit + norm^2 ≤ γmax^2 + + # Dynamic ẋ(t) == F0(x(t)) + Tmax * (u₁(t) * F1(x(t)) + u₂(t) * F2(x(t))) + # Regularization with logarithmic barrier + ∫(norm - ε * (log(norm) + log(γmax - norm))) → min + end + + return ocp +end +nothing # hide +``` + +Initialisation avec le problème à temps min + +```@example orbit +function min_tf() + @def ocp begin + tf ∈ R, variable + t ∈ [0, tf], time + x = (P, ex, ey, L) ∈ R⁴, state + u ∈ R², control + + # Constrains + x(0) == x0 + x[1:3](tf) == xf[1:3] # P, ex, ey à l'arrivée + x[4](tf) == xf[4] # anomalie vraie à l'arrivée + 0.05 ≤ tf ≤ Inf + norm = sqrt(u₁(t)^2 + u₂(t)^2) - # Contrôle borné + # Control limit norm^2 ≤ γmax^2 - # Coût avec barrière logarithmique pour régularisation - ∫(norm - ε * (log(norm) + log(γmax - norm))) → min + # Dynamic + ẋ(t) == F0(x(t)) + Tmax * (u₁(t) * F1(x(t)) + u₂(t) * F2(x(t))) + + # Regularization with logarithmic barrier + tf → min end return ocp end nothing # hide + +ocp1 = min_tf() +sol = solve(ocp1, grid_size=100) ``` + # Direct numerical solution ```@example orbit using NLPModelsIpopt +const Tmax = 100.0 # Poussée max +const γmax = Tmax * 3600^2 / (2000 * 1e3) # Contrôle max + u0 = [0.1, 0.0] xguess(t) = x0 + (xf - x0) * t / tf +tf = variable(sol) + ocp = min_conso() nlp_init = (state = xguess, control = u0) nlp_sol = solve(ocp; init=nlp_init, grid_size=100) @@ -133,7 +175,46 @@ plot(nlp_sol) # Indirect solution (Regularized shooting) +```@example orbit +function ur(x, p) + H1 = p' * F1(x) + H2 = p' * F2(x) + normH = sqrt(H1^2 + H2^2) + if normH < 1e-8 + return [0.0, 0.0] + end + γ = γmax + u_norm = normH + + # optimal control with logarithm barrier + u = [H1, H2] / u_norm + return u +end + + +fr = Flow(ocp, ur) # Regular flow (first version) + +function shoot(ξ::Vector) + tf = ξ[1] + p0 = ξ[2:end] + xsol, psol = fr(0.0, x0, p0) + xT = xsol[end] + pT = psol[end] + + s = zeros(5) + s[1:4] .= xT .- xf # Conditions sur (P, ex, ey, L) + s[5] = norm(p0)^2 - 1 # Normalisation du co-état + return s +end + +ξ = [T_min_100 * 1.5; randn(4)] +ξ[2:end] ./= norm(ξ[2:end]) # Normalisation initiale de p0 +jshoot(ξ) = ForwardDiff.jacobian(shoot, ξ) +shoot!(s, ξ) = (s[:] = shoot(ξ); nothing) +jshoot!(js, ξ) = (js[:] = jshoot(ξ); nothing) +bvp_sol = fsolve(shoot!, jshoot!, ξ; show_trace=true); println(bvp_sol) +``` # Conclusion From 4abf459c961c1549421c881eb49a645f922191c5 Mon Sep 17 00:00:00 2001 From: Youri Date: Thu, 3 Jul 2025 16:53:34 +0200 Subject: [PATCH 5/9] No negative log but convergence problems --- docs/src/tutorial-regularization.md | 90 +++++++++++++++-------------- 1 file changed, 47 insertions(+), 43 deletions(-) diff --git a/docs/src/tutorial-regularization.md b/docs/src/tutorial-regularization.md index 714ca4c..1386554 100644 --- a/docs/src/tutorial-regularization.md +++ b/docs/src/tutorial-regularization.md @@ -22,25 +22,26 @@ Problem data and constants : ```@example orbit using OptimalControl using NLPModelsIpopt -using BenchmarkTools -using DataFrames +using OrdinaryDiffEq using Plots -using Printf +using MINPACK +using ForwardDiff using LinearAlgebra -const μ = 5.1658620912e12 # Constante gravitationnelle -const Tmax = 60.0 # Poussée max -const γmax = Tmax * 3600^2 / (2000 * 1e3) # Contrôle max -const ε = 1e-2 # Paramètre de régularisation -# État initial en coordonnées de Gauss 2D : (P, ex, ey, L) -x0 = [10000.0, 0.01, 0.0, 0.0] +γ_max = 0.1 # maximal thrust norm +const ε = 0.5 # Regularization parameter +const μ = 5.1658620912*1e12 # gravitational parameter +const P0 = 11625 # Initial semilatus rectum +const ex0, ey0 = 0.75, 0 # Initial eccentricity +const L0 = π # Initial longitude +const Pf = 42165 # Final semilatus rectum +const exf, eyf = 0, 0 # Final eccentricity -# État final en coordonnées de Gauss 2D -xf = [42164.0, 0.0, 0.0, π] - -T_min_100 = 13.4 # Temps minimal avec Tmax=100 (donné) -# tf = 1.5 * T_min_100 # Temps final (à ajuster) +tf = 30 # Estimation of final time +const Lf = 3π # Estimation of final longitude +const x0 = [P0, ex0, ey0, L0] # Initial state +const xf = [Pf, exf, eyf, Lf] # Final state ``` Dynamic functions in Gauss coordinates : @@ -100,16 +101,17 @@ function min_conso() x[1:3](tf) == xf[1:3] # P, ex, ey à l'arrivée x[4](tf) == xf[4] # anomalie vraie à l'arrivée - norm = sqrt(u₁(t)^2 + u₂(t)^2) + u_norm = sqrt(u₁(t)^2 + u₂(t)^2) + 1e-4 # Control limit - norm^2 ≤ γmax^2 + 0.01 ≤ u_norm ≤ γmax - 0.01 + u_gamma = max(1e-10, γmax - u_norm) # Dynamic ẋ(t) == F0(x(t)) + Tmax * (u₁(t) * F1(x(t)) + u₂(t) * F2(x(t))) # Regularization with logarithmic barrier - ∫(norm - ε * (log(norm) + log(γmax - norm))) → min + ∫(u_norm - ε * (log(u_norm) + log(u_gamma))) → min end return ocp @@ -124,52 +126,54 @@ function min_tf() @def ocp begin tf ∈ R, variable t ∈ [0, tf], time - x = (P, ex, ey, L) ∈ R⁴, state + x = (P, ex, ey, L) ∈ R^4, state u ∈ R², control - - # Constrains + x(0) == x0 - x[1:3](tf) == xf[1:3] # P, ex, ey à l'arrivée - x[4](tf) == xf[4] # anomalie vraie à l'arrivée - 0.05 ≤ tf ≤ Inf - - norm = sqrt(u₁(t)^2 + u₂(t)^2) - - # Control limit - norm^2 ≤ γmax^2 - - # Dynamic - ẋ(t) == F0(x(t)) + Tmax * (u₁(t) * F1(x(t)) + u₂(t) * F2(x(t))) - - # Regularization with logarithmic barrier + x(tf) == xf + 0.05 ≤ tf + + ẋ(t) == F0(x(t)) + γ_max * (u₁(t) * F1(x(t)) + u₂(t) * F2(x(t))) + u₁(t)^2 + u₂(t)^2 ≤ γ_max^2 + tf → min end return ocp end nothing # hide - -ocp1 = min_tf() -sol = solve(ocp1, grid_size=100) ``` # Direct numerical solution ```@example orbit -using NLPModelsIpopt +x(t) = x0 + (xf - x0) * t / tf # Linear interpolation +u = [0.01, 0.05] # Initial guess for the control +init = (state=x, control=u, variable=tf) # Initial guess for the NLP +ocp_tf = min_tf() +sol = solve(ocp_tf; init=init, grid_size=100) -const Tmax = 100.0 # Poussée max -const γmax = Tmax * 3600^2 / (2000 * 1e3) # Contrôle max - -u0 = [0.1, 0.0] -xguess(t) = x0 + (xf - x0) * t / tf +Tmax = 100.0 # Poussée max +γmax = Tmax * 3600^2 / 1e6 # Contrôle max tf = variable(sol) +u0(t) = [0.05, 0.0] # meilleur contrôle initial : norme non-nulle, mais pas au bord +function xguess(t) + # Initialisation douce en évitant w ≈ 0 + α(t) = t / tf + P = x0[1] + (xf[1] - x0[1]) * α(t) + ex = (1 - α(t)) * x0[2] # ex va vers 0 mais lentement + ey = (1 - α(t)^2) * x0[3] # idem + L = α(t) * 2π + 0.1 # éviter cos(L) = -1 + return [P, ex, ey, L] +end + ocp = min_conso() nlp_init = (state = xguess, control = u0) -nlp_sol = solve(ocp; init=nlp_init, grid_size=100) + +nlp_sol = solve(ocp; init=nlp_init, grid_size=100, max_iter = 3000) plot(nlp_sol) ``` From ba09d36334d17f003ee7046ea600c2148f852f54 Mon Sep 17 00:00:00 2001 From: Youri Date: Fri, 4 Jul 2025 17:28:23 +0200 Subject: [PATCH 6/9] problem in 3D --- docs/src/tutorial-regularization.md | 164 ++++++++++++++-------------- 1 file changed, 83 insertions(+), 81 deletions(-) diff --git a/docs/src/tutorial-regularization.md b/docs/src/tutorial-regularization.md index 1386554..897b017 100644 --- a/docs/src/tutorial-regularization.md +++ b/docs/src/tutorial-regularization.md @@ -29,19 +29,20 @@ using ForwardDiff using LinearAlgebra -γ_max = 0.1 # maximal thrust norm -const ε = 0.5 # Regularization parameter -const μ = 5.1658620912*1e12 # gravitational parameter -const P0 = 11625 # Initial semilatus rectum -const ex0, ey0 = 0.75, 0 # Initial eccentricity -const L0 = π # Initial longitude -const Pf = 42165 # Final semilatus rectum -const exf, eyf = 0, 0 # Final eccentricity - -tf = 30 # Estimation of final time -const Lf = 3π # Estimation of final longitude -const x0 = [P0, ex0, ey0, L0] # Initial state -const xf = [Pf, exf, eyf, Lf] # Final state +Tmax = 60 # Maximum thrust in Newtons +cTmax = 3600^2 / 1e6; T = Tmax * cTmax # Conversion from Newtons to kg x Mm / h² +mass0 = 1500 # Initial mass of the spacecraft +β = 1.42e-02 # Engine specific impulsion +μ = 5165.8620912 # Earth gravitation constant +P0 = 11.625 # Initial semilatus rectum +ex0, ey0 = 0.75, 0 # Initial eccentricity +hx0, hy0 = 6.12e-2, 0 # Initial ascending node and inclination +L0 = π # Initial longitude +Pf = 42.165 # Final semilatus rectum +exf, eyf = 0, 0 # Final eccentricity +hxf, hyf = 0, 0 # Final ascending node and inclination + +ε = 1e-1 # Regularization parameter for logarithmic barrier ``` Dynamic functions in Gauss coordinates : @@ -50,130 +51,131 @@ Dynamic functions in Gauss coordinates : asqrt(x; ε=1e-9) = sqrt(sqrt(x^2 + ε^2)) # sqrt lissée pour AD function F0(x) - P, ex, ey, L = x + P, ex, ey, hx, hy, L = x pdm = asqrt(P / μ) cl = cos(L) sl = sin(L) w = 1 + ex * cl + ey * sl - F = zeros(eltype(x), 4) - F[4] = w^2 / (P * pdm) # dérivée de L (anomalie vraie) + F = zeros(eltype(x), 6) # Use eltype to allow overloading for AD + F[6] = w^2 / (P * pdm) return F end function F1(x) - # Direction de contrôle u₁ (dans le plan) - P, ex, ey, L = x + P, ex, ey, hx, hy, L = x pdm = asqrt(P / μ) cl = cos(L) sl = sin(L) - F = zeros(eltype(x), 4) - F[2] = pdm * sl # dérivée de ex - F[3] = -pdm * cl # dérivée de ey + F = zeros(eltype(x), 6) + F[2] = pdm * sl + F[3] = pdm * (-cl) return F end function F2(x) - # Direction de contrôle u₂ (dans le plan) - P, ex, ey, L = x + P, ex, ey, hx, hy, L = x pdm = asqrt(P / μ) cl = cos(L) sl = sin(L) w = 1 + ex * cl + ey * sl - F = zeros(eltype(x), 4) - F[1] = pdm * 2 * P / w # dérivée de P + F = zeros(eltype(x), 6) + F[1] = pdm * 2 * P / w F[2] = pdm * (cl + (ex + cl) / w) F[3] = pdm * (sl + (ey + sl) / w) return F end + +function F3(x) + P, ex, ey, hx, hy, L = x + pdm = asqrt(P / μ) + cl = cos(L) + sl = sin(L) + w = 1 + ex * cl + ey * sl + pdmw = pdm / w + zz = hx * sl - hy * cl + uh = (1 + hx^2 + hy^2) / 2 + F = zeros(eltype(x), 6) + F[2] = pdmw * (-zz * ey) + F[3] = pdmw * zz * ex + F[4] = pdmw * uh * cl + F[5] = pdmw * uh * sl + F[6] = pdmw * zz + return F +end ``` -Optimal control problem with regularization : +Initialisation with minimal time problem ```@example orbit -function min_conso() +tf = 15 # Estimation of final time +Lf = 3π # Estimation of final longitude +x0 = [P0, ex0, ey0, hx0, hy0, L0] # Initial state +xf = [Pf, exf, eyf, hxf, hyf, Lf] # Final state +x(t) = x0 + (xf - x0) * t / tf # Linear interpolation +u = [0.1, 0.5, 0.] # Initial guess for the control +nlp_init = (state=x, control=u, variable=tf) # Initial guess for the NLP + +function min_tf() @def ocp begin + tf ∈ R, variable t ∈ [0, tf], time - x = (P, ex, ey, L) ∈ R⁴, state - u ∈ R², control - - # Constrains + x = (P, ex, ey, hx, hy, L) ∈ R⁶, state + u ∈ R³, control x(0) == x0 - x[1:3](tf) == xf[1:3] # P, ex, ey à l'arrivée - x[4](tf) == xf[4] # anomalie vraie à l'arrivée - - u_norm = sqrt(u₁(t)^2 + u₂(t)^2) + 1e-4 - - # Control limit - 0.01 ≤ u_norm ≤ γmax - 0.01 - u_gamma = max(1e-10, γmax - u_norm) - - # Dynamic - ẋ(t) == F0(x(t)) + Tmax * (u₁(t) * F1(x(t)) + u₂(t) * F2(x(t))) - - # Regularization with logarithmic barrier - ∫(u_norm - ε * (log(u_norm) + log(u_gamma))) → min + x[1:5](tf) == xf[1:5] + mass = mass0 - β * T * t + ẋ(t) == F0(x(t)) + T / mass * (u₁(t) * F1(x(t)) + u₂(t) * F2(x(t)) + u₃(t) * F3(x(t))) + u₁(t)^2 + u₂(t)^2 + u₃(t)^2 ≤ 1 + tf → min end - return ocp end -nothing # hide ``` -Initialisation avec le problème à temps min +Optimal control problem with regularization : + ```@example orbit -function min_tf() +function min_conso() @def ocp begin - tf ∈ R, variable t ∈ [0, tf], time - x = (P, ex, ey, L) ∈ R^4, state - u ∈ R², control - + x = (P, ex, ey, hx, hy, L) ∈ R⁶, state + u ∈ R³, control x(0) == x0 - x(tf) == xf - 0.05 ≤ tf - - ẋ(t) == F0(x(t)) + γ_max * (u₁(t) * F1(x(t)) + u₂(t) * F2(x(t))) - u₁(t)^2 + u₂(t)^2 ≤ γ_max^2 - - tf → min + x[1:5](tf) == xf[1:5] + mass = mass0 - β * T * t + + u_norm = sqrt(u₁(t)^2 + u₂(t)^2 + u₃(t)^2) + + # Dynamic + ẋ(t) == F0(x(t)) + T / mass * (u₁(t) * F1(x(t)) + u₂(t) * F2(x(t)) + u₃(t) * F3(x(t))) + 1e-3 ≤ u_norm^2 ≤ 1 + u_g = max(1e-10, 1 - u_norm) + + + # Regularization with logarithmic barrier + ∫(u_norm - ε * (log(u_norm) + log(u_g))) → min end return ocp end -nothing # hide ``` - # Direct numerical solution ```@example orbit -x(t) = x0 + (xf - x0) * t / tf # Linear interpolation -u = [0.01, 0.05] # Initial guess for the control -init = (state=x, control=u, variable=tf) # Initial guess for the NLP -ocp_tf = min_tf() -sol = solve(ocp_tf; init=init, grid_size=100) +ocp1 = min_tf() # Define the optimal control problem +sol = solve(ocp1; init=nlp_init, grid_size=100) Tmax = 100.0 # Poussée max -γmax = Tmax * 3600^2 / 1e6 # Contrôle max +T = Tmax * cTmax tf = variable(sol) -u0(t) = [0.05, 0.0] # meilleur contrôle initial : norme non-nulle, mais pas au bord -function xguess(t) - # Initialisation douce en évitant w ≈ 0 - α(t) = t / tf - P = x0[1] + (xf[1] - x0[1]) * α(t) - ex = (1 - α(t)) * x0[2] # ex va vers 0 mais lentement - ey = (1 - α(t)^2) * x0[3] # idem - L = α(t) * 2π + 0.1 # éviter cos(L) = -1 - return [P, ex, ey, L] -end - ocp = min_conso() -nlp_init = (state = xguess, control = u0) +nlp_init = (state = state(sol), control = control(sol)) -nlp_sol = solve(ocp; init=nlp_init, grid_size=100, max_iter = 3000) +nlp_sol = solve(ocp; init=nlp_init, grid_size=500) plot(nlp_sol) ``` From 178bbe4d0747232d68826b7fe41a7538404bda12 Mon Sep 17 00:00:00 2001 From: Youri Date: Mon, 7 Jul 2025 16:07:28 +0200 Subject: [PATCH 7/9] direct resolution with plots + start of indirect resolution --- docs/Project.toml | 1 - docs/src/tutorial-regularization.md | 84 ++++++++++++++++++++++------- 2 files changed, 65 insertions(+), 20 deletions(-) diff --git a/docs/Project.toml b/docs/Project.toml index 0cc8353..8fe9d0e 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -15,7 +15,6 @@ OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb" -Tutorials = "cb10daa6-a5e5-4c25-a171-ae181b8ea3c9" [compat] BenchmarkTools = "1.6" diff --git a/docs/src/tutorial-regularization.md b/docs/src/tutorial-regularization.md index 897b017..f457040 100644 --- a/docs/src/tutorial-regularization.md +++ b/docs/src/tutorial-regularization.md @@ -176,26 +176,71 @@ ocp = min_conso() nlp_init = (state = state(sol), control = control(sol)) nlp_sol = solve(ocp; init=nlp_init, grid_size=500) -plot(nlp_sol) +plot(nlp_sol; control=:norm, size=(800, 300), layout=:group) ``` -# Indirect solution (Regularized shooting) +Plot in 3D : ```@example orbit +xsol = state(nlp_sol) +t = time_grid(nlp_sol) +N = size(t, 1) +nx = length(state(nlp_sol)(t[1])) # nombre de variables d'état, par ex 6 ici + +# Construire une matrice (nx x N) en évaluant xsol en chaque instant +X = zeros(nx, N) +for i in 1:N + X[:, i] = xsol(t[i]) +end + +# Maintenant on peut accéder aux lignes comme prévu +P = X[1, :] +ex = X[2, :] +ey = X[3, :] +hx = X[4, :] +hy = X[5, :] +L = X[6, :] + +cL = cos.(L) +sL = sin.(L) +w = @. 1 + ex * cL + ey * sL +Z = @. hx * sL - hy * cL +C = @. 1 + hx^2 + hy^2 + +q1 = @. P *((1 + hx^2 - hy^2) * cL + 2 * hx * hy * sL) / (C * w) +q2 = @. P *((1 - hx^2 + hy^2) * sL + 2 * hx * hy * cL) / (C * w) +q3 = @. 2 * P * Z / (C * w) + +plt1 = plot3d(1; xlim = (-60, 60), ylim = (-60, 60), zlim = (-5, 5), title = "Orbit transfer (direct)", legend=false) +@gif for i = 1:N + push!(plt1, q1[i], q2[i], q3[i]) +end every N ÷ min(N, 100) +``` + +# Indirect solution (Regularized shooting) +```@math function ur(x, p) H1 = p' * F1(x) H2 = p' * F2(x) + H3 = p' * F3(x) - normH = sqrt(H1^2 + H2^2) - if normH < 1e-8 - return [0.0, 0.0] + grad_H = [H1, H2, H3] + normH = norm(grad_H) + + function φ(α) + if α <= 1e-8 || α >= 1 - 1e-8 + return -Inf + end + return α * normH - ε * (log(α) + log(1 - α)) end - γ = γmax - u_norm = normH - # optimal control with logarithm barrier - u = [H1, H2] / u_norm - return u + # Maximize φ(α) on [0,1] + αs = range(1e-3, 1 - 1e-3, length=200) + vals = φ.(αs) + i = argmax(vals) + αopt = αs[i] + + return αopt * grad_H / normH end @@ -204,22 +249,23 @@ fr = Flow(ocp, ur) # Regular flow (first version) function shoot(ξ::Vector) tf = ξ[1] p0 = ξ[2:end] - xsol, psol = fr(0.0, x0, p0) - xT = xsol[end] - pT = psol[end] + xf_, pf = fr(0, x0, p0, tf) + + s = [xf_[1:5] .- xf[1:5]; norm(p0)^2 - 1] - s = zeros(5) - s[1:4] .= xT .- xf # Conditions sur (P, ex, ey, L) - s[5] = norm(p0)^2 - 1 # Normalisation du co-état return s end -ξ = [T_min_100 * 1.5; randn(4)] -ξ[2:end] ./= norm(ξ[2:end]) # Normalisation initiale de p0 jshoot(ξ) = ForwardDiff.jacobian(shoot, ξ) shoot!(s, ξ) = (s[:] = shoot(ξ); nothing) jshoot!(js, ξ) = (js[:] = jshoot(ξ); nothing) -bvp_sol = fsolve(shoot!, jshoot!, ξ; show_trace=true); println(bvp_sol) + +ξ0 = randn(6) +ξ0 ./= norm(ξ0) # Normalize + +# resolution of the shooting system with fsolve +bvp_sol = fsolve(shoot!, jshoot!, ξ0; show_trace=true) +println("Solution de la méthode de tir : ", bvp_sol) ``` # Conclusion From 3940fd372c8d693a94dce27d18ce4f1802b2ba78 Mon Sep 17 00:00:00 2001 From: Youri Date: Wed, 9 Jul 2025 15:59:34 +0200 Subject: [PATCH 8/9] Indirect method with plot but it seems weird --- docs/src/tutorial-regularization.md | 70 +++++++++++++++++++++++------ 1 file changed, 56 insertions(+), 14 deletions(-) diff --git a/docs/src/tutorial-regularization.md b/docs/src/tutorial-regularization.md index f457040..7a7c372 100644 --- a/docs/src/tutorial-regularization.md +++ b/docs/src/tutorial-regularization.md @@ -47,6 +47,10 @@ hxf, hyf = 0, 0 # Final ascending node and inclinatio Dynamic functions in Gauss coordinates : +```@raw html +
Gauss transformation +``` + ```@example orbit asqrt(x; ε=1e-9) = sqrt(sqrt(x^2 + ε^2)) # sqrt lissée pour AD @@ -104,6 +108,10 @@ function F3(x) end ``` +```@raw html +
+``` + Initialisation with minimal time problem ```@example orbit @@ -167,7 +175,7 @@ end ocp1 = min_tf() # Define the optimal control problem sol = solve(ocp1; init=nlp_init, grid_size=100) -Tmax = 100.0 # Poussée max +Tmax = 100.0 # max power T = Tmax * cTmax tf = variable(sol) @@ -185,15 +193,14 @@ Plot in 3D : xsol = state(nlp_sol) t = time_grid(nlp_sol) N = size(t, 1) -nx = length(state(nlp_sol)(t[1])) # nombre de variables d'état, par ex 6 ici +nx = length(state(nlp_sol)(t[1])) # number of state variables -# Construire une matrice (nx x N) en évaluant xsol en chaque instant +# generate a matrix X = zeros(nx, N) for i in 1:N X[:, i] = xsol(t[i]) end -# Maintenant on peut accéder aux lignes comme prévu P = X[1, :] ex = X[2, :] ey = X[3, :] @@ -218,7 +225,7 @@ end every N ÷ min(N, 100) ``` # Indirect solution (Regularized shooting) -```@math +```@example orbit function ur(x, p) H1 = p' * F1(x) H2 = p' * F2(x) @@ -247,8 +254,7 @@ end fr = Flow(ocp, ur) # Regular flow (first version) function shoot(ξ::Vector) - tf = ξ[1] - p0 = ξ[2:end] + p0 = ξ xf_, pf = fr(0, x0, p0, tf) s = [xf_[1:5] .- xf[1:5]; norm(p0)^2 - 1] @@ -256,18 +262,54 @@ function shoot(ξ::Vector) return s end -jshoot(ξ) = ForwardDiff.jacobian(shoot, ξ) -shoot!(s, ξ) = (s[:] = shoot(ξ); nothing) -jshoot!(js, ξ) = (js[:] = jshoot(ξ); nothing) - ξ0 = randn(6) ξ0 ./= norm(ξ0) # Normalize +jshoot(ξ0) = ForwardDiff.jacobian(shoot, ξ0) +shoot!(s, ξ0) = (s[:] = shoot(ξ0); nothing) +jshoot!(js, ξ0) = (js[:] = jshoot(ξ0); nothing) # resolution of the shooting system with fsolve bvp_sol = fsolve(shoot!, jshoot!, ξ0; show_trace=true) println("Solution de la méthode de tir : ", bvp_sol) ``` +Plots 3D + +```@example orbit +p0 = bvp_sol.x +ode_sol = fr((0, tf), x0, p0) +t = time_grid(ode_sol); N = size(t, 1) + +x_ode = state(ode_sol) # State function +nx = length(state(ode_sol)(t[1])) # number of state variables + +# generate a matrix +X = zeros(nx, N) +for i in 1:N + X[:, i] = x_ode(t[i]) +end + +P = X[1, :] +ex = X[2, :] +ey = X[3, :] +hx = X[4, :] +hy = X[5, :] +L = X[6, :] +cL = cos.(L) +sL = sin.(L) +w = @. 1 + ex * cL + ey * sL +Z = @. hx * sL - hy * cL +C = @. 1 + hx^2 + hy^2 +q1 = @. P *((1 + hx^2 - hy^2) * cL + 2 * hx * hy * sL) / (C * w) +q2 = @. P *((1 - hx^2 + hy^2) * sL + 2 * hx * hy * cL) / (C * w) +q3 = @. 2 * P * Z / (C * w) + +plt1 = plot3d(1; xlim = (-60, 60), ylim = (-60, 60), zlim = (-5, 5), title = "Orbit transfer", legend=false) +@gif for i = 1:N + push!(plt1, q1[i], q2[i], q3[i]) +end every N ÷ min(N, 100) +``` + # Conclusion This tutorial shows how to solve a minimum-time orbital transfer with bounded thrust using a logarithmic barrier to regularize the problem. This approach facilitates the numerical solution by avoiding "bang-bang" control profiles. @@ -276,8 +318,8 @@ The use of Gauss coordinates enables a simpler and more efficient modeling of or ## References -Epenoy & Bertrand (CNES) "Optimal control and smoothing techniques..." +[Epenoy & Bertrand (CNES) "Optimal control and smoothing techniques for computing minimum fuel orbital transfers and rendezvous"](https://www.researchgate.net/publication/258242319_Optimal_control_and_smoothing_techniques_for_computing_minimum_fuel_orbital_transfers_and_rendezvous) -OptimalControl.jl Tutorial: Kepler minimum time +[OptimalControl.jl Tutorial: Kepler minimum time](https://control-toolbox.org/Kepler.jl/stable/) -Cots Olivier, Contrôle optimal géométrique : méthodes homotopiques et applications (2012) \ No newline at end of file +[Cots Olivier, Contrôle optimal géométrique : méthodes homotopiques et applications (2012), page 44](https://theses.hal.science/tel-00742927v4) \ No newline at end of file From f4530c4ada7ddeb288db98ffc885ff6309920fef Mon Sep 17 00:00:00 2001 From: Youri Date: Thu, 17 Jul 2025 14:57:39 +0200 Subject: [PATCH 9/9] Continuation on eps ok and indirect resolution but strange trajectory --- docs/src/tutorial-regularization.md | 49 ++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 8 deletions(-) diff --git a/docs/src/tutorial-regularization.md b/docs/src/tutorial-regularization.md index 7a7c372..64c7a89 100644 --- a/docs/src/tutorial-regularization.md +++ b/docs/src/tutorial-regularization.md @@ -144,7 +144,7 @@ Optimal control problem with regularization : ```@example orbit -function min_conso() +function min_conso(e) @def ocp begin t ∈ [0, tf], time x = (P, ex, ey, hx, hy, L) ∈ R⁶, state @@ -162,7 +162,7 @@ function min_conso() # Regularization with logarithmic barrier - ∫(u_norm - ε * (log(u_norm) + log(u_g))) → min + ∫(u_norm - e * (log(u_norm) + log(u_g))) → min end return ocp @@ -180,20 +180,40 @@ T = Tmax * cTmax tf = variable(sol) -ocp = min_conso() +ocp = min_conso(ε) nlp_init = (state = state(sol), control = control(sol)) +``` -nlp_sol = solve(ocp; init=nlp_init, grid_size=500) -plot(nlp_sol; control=:norm, size=(800, 300), layout=:group) +Minimize the regularization parameter +```@example orbit +eps = [1e-1, 1e-2, 1e-3, 1e-4, 1e-5] +i = nlp_init +s = sol + +for e in eps[2:end] + ocp = min_conso(e) + global s = solve(ocp; init=i, grid_size=500) + global i = s +end + +``` +```@example orbit +plt = plot(s; label="ε = $(eps[5])") # plot initial avec le premier ε +``` + +```@example orbit +t = time_grid(s) +u = control(s) +plot(t, norm∘u; label="‖u‖", xlabel="t") ``` Plot in 3D : ```@example orbit -xsol = state(nlp_sol) -t = time_grid(nlp_sol) +xsol = state(s) +t = time_grid(s) N = size(t, 1) -nx = length(state(nlp_sol)(t[1])) # number of state variables +nx = length(state(s)(t[1])) # number of state variables # generate a matrix X = zeros(nx, N) @@ -226,6 +246,8 @@ end every N ÷ min(N, 100) # Indirect solution (Regularized shooting) ```@example orbit +tf = 1.5*variable(sol) +ocp = min_conso(1e-5) function ur(x, p) H1 = p' * F1(x) H2 = p' * F2(x) @@ -278,6 +300,17 @@ Plots 3D ```@example orbit p0 = bvp_sol.x ode_sol = fr((0, tf), x0, p0) +plot(ode_sol) +``` + +```@example orbit +t = time_grid(ode_sol); N = size(t, 1) +u = control(ode_sol) +plot(t, norm∘u; label="‖u‖", xlabel="t") +``` + +```@example orbit + t = time_grid(ode_sol); N = size(t, 1) x_ode = state(ode_sol) # State function