CTModels v0.7.0
CTModels v0.7.0
Highlights
-
New typed core for OCP models and solutions
Split the old monolithicsrc/types.jlinto a structuredsrc/core/types/hierarchy (ocp_components,ocp_model,ocp_solution,nlp,initial_guess, …). This clarifies the representation of models, solutions, constraints, and related metadata, and adds the aliasAbstractOptimalControlProblem = CTModels.AbstractModelfor better interop. -
New NLP modelling layer
Introduced a dedicatedsrc/nlp/layer (problem_core.jl,discretized_ocp.jl,model_api.jl,options_schema.jl,nlp_backends.jl, …) to build NLP models from optimisation problems and OCP models, and to map NLP solutions back toCTModels.Solution. Adds support for ADNLPModels- and ExaModels-based backends as first-class CTModels components. -
Initial guess utilities
New, typed initial-guess layer insrc/init/initial_guess.jl:pre_initial_guessbuilds anOptimalControlPreInitcontainer from raw user data (functions, vectors, scalars), andinitial_guessbuilds and validates anOptimalControlInitialGuessagainst anAbstractOptimalControlProblem. Dedicated tests cover the new types and constructors. -
JSON / JLD I/O improvements
Reworked JSON export/import inext/CTModelsJSON.jlto handleinfos::Dict{Symbol,Any}more robustly and predictably, with improved tests for JSON and JLD round-trips intest/io/test_export_import.jl. -
Plotting and examples
Small improvements in the plot extension (ext/plot.jl,plot_default.jl,plot_utils.jl) and additional examples/tests for plotting and printing solutions intest/plot/test_plot.jl. -
Documentation overhaul
New, more didactic index page indocs/src/index.mdexplaining CTModels' role in the OptimalControl/control-toolbox ecosystem, a new Interfaces section (docs/src/interfaces/), and reorganised API reference pages with improved automatic API doc generation usingdocs/docutils/DocumenterReference.jl. -
Extensive test suite
Many new tests for core types, initial guesses, the NLP layer, I/O, OCP building blocks, and plotting (see the new subdirectoriestest/core/,test/nlp/,test/io/,test/ocp/,test/plot/,test/problems/).test/runtests.jlwas refactored into a more modular structure.
Breaking Changes / Compatibility Notes
-
CTBase compatibility bump
compatfor CTBase was raised from0.16to0.17inProject.toml. Downstream packages must be able to use CTBase ≥ 0.17 to upgrade to CTModels v0.7.0. -
New hard dependencies
CTModels now declares additional dependencies inProject.toml:ADNLPModels = "0.8"ExaModels = "0.9"NLPModels = "0.21"SolverCore = "0.3"KernelAbstractions = "0.9"
Projects with tight compat bounds on these packages may need to update their compat entries.
-
Internal file/layout refactor
The internal layout of the source tree changed significantly:src/types.jlwas split into multiple files undersrc/core/types/,src/init.jlwas replaced bysrc/init/initial_guess.jl,- most OCP-related files were moved under
src/ocp/, - NLP-related code was moved under
src/nlp/.
Publicly exported names have been kept as stable as possible, but code that relied on internal file structure or non-exported implementation details may break.
-
JSON export/import behaviour
JSON I/O has been tightened and made more structured. The intent is to be more robust, but very low-level consumers of the previous JSON format may see behavioural differences and should re-check their pipelines.
New Features
- Added a typed OCP core in
src/core/types/, includingocp_components.jl,ocp_model.jl,ocp_solution.jl, andnlp.jl, to model optimal control problems and their solutions more explicitly. - Added a new NLP layer in
src/nlp/withproblem_core.jl,discretized_ocp.jl,model_api.jl,options_schema.jl, andnlp_backends.jlto interface CTModels with ADNLPModels and ExaModels backends. - Introduced typed initial-guess types and constructors in
src/core/types/initial_guess.jlandsrc/init/initial_guess.jl. - Added JSON and JLD solution I/O helpers in
ext/CTModelsJSON.jlandCTModelsJLD.jlto persist and reload solutions.
Enhancements
- Improved organisation of OCP-related code by moving files under
src/ocp/and sharpening the separation between core types, OCP model components, NLP layer, and I/O. - Refined plotting support in the CTModelsPlots extension (
plot.jl,plot_default.jl,plot_utils.jl) and aligned examples with the new types and solution structures.
Bug Fixes
- No additional user-facing bug fixes are explicitly highlighted in this release beyond those implied by the refactors and new tests. Please refer to the full changelog for low-level details.
Documentation
- Added a new, explanatory index page at
docs/src/index.mddescribing CTModels' role and main concepts. - Introduced an Interfaces section in
docs/src/interfaces/covering OCP tools, optimisation problems, optimisation modelers, and solution builders. - Added a custom API reference generator in
docs/docutils/DocumenterReference.jland updateddocs/make.jlto improve API documentation structure.
Tests
- Added extensive tests for core types in
test/core/,
including OCP components, models, solutions, NLP types, and utilities. - Added tests for initial guesses in
test/init/test_initial_guess.jl. - Added tests for the NLP layer in
test/nlp/, covering discretised OCPs, model API, backends, options schema, and problem core. - Added I/O tests in
test/io/for export/import behaviour and extension errors. - Added OCP-level tests in
test/ocp/and problem examples intest/problems/.
Internal
- Updated CI configuration in
.github/workflows/and addedformatter.lockto track formatting state. - Ignored profiling scripts via
.gitignoreand removed them from the tracked files. - Reorganised the test suite to mirror the new
core/,ocp/,nlp/,io/,meta/, andproblems/structure.
Merged pull requests:
- CompatHelper: bump compat for NLPModelsIpopt to 0.11 for package test, (drop existing compat) (#200) (@github-actions[bot])
- Update CI.yml (#216) (@ocots)
- CompatHelper: add new compat entry for CTParser at version 0.7 for package docs, (drop existing compat) (#218) (@github-actions[bot])
- Update from CTSolvers (#225) (@ocots)
Closed issues: