Skip to content

feat: add bayesian opmization - #138

Merged
gabrielfrasantos merged 4 commits into
mainfrom
feature/add-bayesian-optmization
Apr 4, 2026
Merged

gabrielfrasantos merged 4 commits into
mainfrom
feature/add-bayesian-optmization

Conversation

@gabrielfrasantos

@gabrielfrasantos gabrielfrasantos commented Apr 4, 2026 •

Copy link
Copy Markdown
Contributor
  • Hoist std::log(2*pi) to static const log2pi in ComputeLogLikelihoodContribution() — avoids recomputing the transcendental on every forward-pass time step

@gabrielfrasantos gabrielfrasantos linked an issue Apr 4, 2026 that may be closed by this pull request
@github-actions

github-actions Bot commented Apr 4, 2026 •

Copy link
Copy Markdown
Contributor

✅⚠️MegaLinter analysis: Success with warnings

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ ACTION actionlint 6 0 0 0.06s
✅ CPP clang-format 295 4 0 0 1.38s
✅ CPP cppcheck 295 0 0 11.88s
✅ DOCKERFILE hadolint 1 0 0 0.06s
✅ JSON jsonlint 8 0 0 0.51s
✅ JSON prettier 8 8 0 0 0.66s
⚠️ MARKDOWN markdownlint 62 1 70 0 2.72s
✅ MARKDOWN markdown-table-formatter 62 20 0 0 0.31s
⚠️ SPELL lychee 175 29 0 1.86s
✅ YAML prettier 13 6 0 0 0.77s
✅ YAML yamllint 13 0 0 0.68s

Detailed Issues

⚠️ SPELL / lychee - 29 errors
[IGNORED] url.https://github.com/.insteadOf | Unsupported: Error creating request client: builder error for url (url.https://github.com/.insteadOf)
[ERROR] https://gitlab-ci-token/ | Network error: error sending request for url (https://gitlab-ci-token/) Maybe a certificate error?
[ERROR] file://doc/filters/solvers/DiscreteAlgebraicRiccatiEquation.md | Cannot find file
[ERROR] file://doc/filters/controllers/Pid.md | Cannot find file
[ERROR] file://doc/filters/controllers/Lqr.md | Cannot find file
[ERROR] file://doc/math/Geometry3D.md | Cannot find file
[ERROR] file://estimators/LinearRegression.md | Cannot find file
[ERROR] file://doc/NeuralNetwork.md | Cannot find file
[ERROR] file://doc/model/Model.md | Cannot find file
[ERROR] file://doc/losses/Loss.md | Cannot find file
[ERROR] file://doc/optimizer/Optimizer.md | Cannot find file
[ERROR] file://doc/losses/Loss.md | Cannot find file
[ERROR] file://estimators/LinearRegression.md | Cannot find file
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/18 | Network error: Not Found
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/2 | Network error: Not Found
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/27 | Network error: Not Found
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/4 | Network error: Not Found
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/3 | Network error: Not Found
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/13 | Network error: Not Found
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/26 | Network error: Not Found
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/9 | Network error: Not Found
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/24 | Network error: Not Found
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/7 | Network error: Not Found
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/1 | Network error: Not Found
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/6 | Network error: Not Found
[ERROR] https://mathweb.ucsd.edu/~sbuss/ResearchWeb/ikmethods/iksurvey.pdf | Network error: error sending request for url (https://mathweb.ucsd.edu/~sbuss/ResearchWeb/ikmethods/iksurvey.pdf) Maybe a certificate error?
[403] https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$ | Network error: Forbidden
[403] https://developer.arm.com/documentation/dui0473/latest | Network error: Forbidden
[403] https://developer.arm.com/documentation/100166/latest/ | Network error: Forbidden
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/15 | Network error: Not Found
📝 Summary
---------------------
🔍 Total..........236
✅ Successful.....198
⏳ Timeouts.........0
🔀 Redirected.......0
👻 Excluded.........8
❓ Unknown..........0
🚫 Errors..........29

Errors in doc/kinematics/ForwardKinematics.md
[ERROR] file://doc/math/Geometry3D.md | Cannot find file

Errors in doc/kinematics/InverseKinematics.md
[ERROR] https://mathweb.ucsd.edu/~sbuss/ResearchWeb/ikmethods/iksurvey.pdf | Network error: error sending request for url (https://mathweb.ucsd.edu/~sbuss/ResearchWeb/ikmethods/iksurvey.pdf) Maybe a certificate error?

Errors in doc/regularization/Regularization.md
[ERROR] file://doc/losses/Loss.md | Cannot find file
[ERROR] file://estimators/LinearRegression.md | Cannot find file
[ERROR] file://doc/optimizer/Optimizer.md | Cannot find file

Errors in CHANGELOG.md
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/2 | Network error: Not Found
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/24 | Network error: Not Found
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/27 | Network error: Not Found
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/13 | Network error: Not Found
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/26 | Network error: Not Found
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/9 | Network error: Not Found
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/7 | Network error: Not Found
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/4 | Network error: Not Found
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/18 | Network error: Not Found
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/3 | Network error: Not Found
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/1 | Network error: Not Found
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/6 | Network error: Not Found
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/15 | Network error: Not Found

Errors in .gitlab-ci.yml
[ERROR] https://gitlab-ci-token/ | Network error: error sending request for url (https://gitlab-ci-token/) Maybe a certificate error?

Errors in doc/performance-optimization/README.md
[403] https://developer.arm.com/documentation/dui0473/latest | Network error: Forbidden
[403] https://developer.arm.com/documentation/100166/latest/ | Network error: Forbidden

Errors in doc/filters/active/KalmanFilter.md
[ERROR] file://doc/filters/controllers/Pid.md | Cannot find file
[ERROR] file://doc/filters/solvers/DiscreteAlgebraicRiccatiEquation.md | Cannot find file
[ERROR] file://doc/filters/controllers/Lqr.md | Cannot find file

Errors in doc/optimization/Optimizer.md
[ERROR] file://estimators/LinearRegression.md | Cannot find file
[ERROR] file://doc/losses/Loss.md | Cannot find file
[ERROR] file://doc/NeuralNetwork.md | Cannot find file
[ERROR] file://doc/model/Model.md | Cannot find file

Errors in .github/workflows/static-analysis.yml
[403] https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$ | Network error: Forbidden
⚠️ MARKDOWN / markdownlint - 70 errors
.github/agents/executor.agent.md:11:401 error MD013/line-length Line length [Expected: 400; Actual: 459]
.github/agents/executor.agent.md:11 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "You are the executor agent for..."]
.github/agents/orchestrator.agent.md:18 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "You are the orchestrator agent..."]
.github/agents/planner.agent.md:11:401 error MD013/line-length Line length [Expected: 400; Actual: 458]
.github/agents/planner.agent.md:11 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "You are the planner agent for ..."]
.github/agents/reviewer.agent.md:14:401 error MD013/line-length Line length [Expected: 400; Actual: 456]
.github/agents/reviewer.agent.md:14 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "You are the reviewer agent for..."]
.github/instructions/numerical-cpp.instructions.md:77:401 error MD013/line-length Line length [Expected: 400; Actual: 423]
.github/prompts/orchestrate.prompt.md:8:401 error MD013/line-length Line length [Expected: 400; Actual: 496]
.github/prompts/orchestrate.prompt.md:8 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "Analyze the following task for..."]
CHANGELOG.md:29 error MD024/no-duplicate-heading Multiple headings with the same content [Context: "Features"]
CHANGELOG.md:45 error MD024/no-duplicate-heading Multiple headings with the same content [Context: "Bug Fixes"]
doc/analysis/PowerDensitySpectrum.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 509]
doc/analysis/PowerDensitySpectrum.md:104:20 error MD056/table-column-count Table column count [Expected: 2; Actual: 6; Too many cells, extra data will be missing]
doc/analysis/PowerDensitySpectrum.md:104:17 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/analysis/PowerDensitySpectrum.md:104:20 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/analysis/PowerDensitySpectrum.md:104:32 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/analysis/PowerDensitySpectrum.md:104:38 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/analysis/PowerDensitySpectrum.md:104:45 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/analysis/PowerDensitySpectrum.md:104:135 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/control_analysis/FrequencyResponse.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 469]
doc/control_analysis/RootLocus.md:69 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
doc/control_analysis/RootLocus.md:113:13 error MD060/table-column-style Table column style [Table pipe is missing space to the left for style "compact"]
doc/control_analysis/RootLocus.md:113:27 error MD060/table-column-style Table column style [Table pipe is missing space to the left for style "compact"]
doc/control_analysis/RootLocus.md:113:1 error MD060/table-column-style Table column style [Table pipe is missing space to the right for style "compact"]
doc/control_analysis/RootLocus.md:113:13 error MD060/table-column-style Table column style [Table pipe is missing space to the right for style "compact"]
doc/estimators/ExpectationMaximization.md:37:12 error MD060/table-column-style Table column style [Table pipe is missing space to the left for style "compact"]
doc/estimators/ExpectationMaximization.md:37:23 error MD060/table-column-style Table column style [Table pipe is missing space to the left for style "compact"]
doc/estimators/ExpectationMaximization.md:37:37 error MD060/table-column-style Table column style [Table pipe is missing space to the left for style "compact"]
doc/estimators/ExpectationMaximization.md:37:1 error MD060/table-column-style Table column style [Table pipe is missing space to the right for style "compact"]
doc/estimators/ExpectationMaximization.md:37:12 error MD060/table-column-style Table column style [Table pipe is missing space to the right for style "compact"]
doc/estimators/ExpectationMaximization.md:37:23 error MD060/table-column-style Table column style [Table pipe is missing space to the right for style "compact"]
doc/estimators/ExpectationMaximization.md:104:103 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/estimators/README.md:9:68 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/estimators/README.md:9:142 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/estimators/README.md:10:68 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/estimators/README.md:10:142 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/estimators/README.md:11:68 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/estimators/README.md:11:144 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/active/KalmanSmoother.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 421]
doc/filters/active/KalmanSmoother.md:111:28 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/active/KalmanSmoother.md:111:61 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/active/KalmanSmoother.md:111:110 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/active/KalmanSmoother.md:122:19 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/active/KalmanSmoother.md:122:27 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/active/KalmanSmoother.md:122:67 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/active/KalmanSmoother.md:123:19 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/active/KalmanSmoother.md:123:27 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/active/KalmanSmoother.md:123:67 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/active/KalmanSmoother.md:124:19 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/active/KalmanSmoother.md:124:27 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/active/KalmanSmoother.md:124:67 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/active/KalmanSmoother.md:125:19 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/active/KalmanSmoother.md:125:27 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/active/KalmanSmoother.md:125:67 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/active/UnscentedKalmanFilter.md:11:401 error MD013/line-length Line length [Expected: 400; Actual: 468]
doc/filters/README.md:16:145 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/neural_network/model/Model.md:147:63 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/neural_network/model/Model.md:147:156 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/neural_network/model/Model.md:148:60 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/neural_network/model/Model.md:148:153 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/regularization/Regularization.md:100:32 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/regularization/Regularization.md:100:135 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/windowing/window.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 415]
README.md:1 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "[![Quality Gate Status](https:..."]
README.md:9:401 error MD013/line-length Line length [Expected: 400; Actual: 442]
README.md:19:142 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
README.md:20:142 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
README.md:23:147 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
README.md:28:140 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]

See detailed reports in MegaLinter artifacts

Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining FLAVOR_SUGGESTIONS: false)

  • Documentation: Custom Flavors
  • Command: npx mega-linter-runner@9.4.0 --custom-flavor-setup --custom-flavor-linters ACTION_ACTIONLINT,CPP_CPPCHECK,CPP_CLANG_FORMAT,DOCKERFILE_HADOLINT,JSON_JSONLINT,JSON_PRETTIER,MARKDOWN_MARKDOWNLINT,MARKDOWN_MARKDOWN_TABLE_FORMATTER,SPELL_LYCHEE,YAML_PRETTIER,YAML_YAMLLINT

MegaLinter is graciously provided by OX Security
Show us your support by starring ⭐ the repository

Comment thread .vscode/launch.json Resolved
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a Bayesian Optimization implementation to the numerical/optimization domain and integrates it into a new Qt simulator for Bayesian MPC calibration, alongside documentation and tests. It also refactors parts of the EM/Kalman smoothing pipeline to support the new calibration workflow.

Changes:

  • Add optimization::BayesianOptimization + BlackBoxObjective (with unit tests, docs, and coverage instantiation wiring).
  • Introduce a new BayesianMpcCalibration simulator (application + view + launch config) that runs an EM→BO calibration pipeline and visualizes results.
  • Refactor KalmanSmoother and ExpectationMaximization internals into helper methods to improve structure and reuse.

Reviewed changes

Copilot reviewed 31 out of 31 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
simulator/controllers/CMakeLists.txt Registers the new Bayesian MPC calibration simulator in the simulator controller build.
simulator/controllers/BayesianMpcCalibration/CMakeLists.txt Adds the top-level executable target and wires application/view subtargets.
simulator/controllers/BayesianMpcCalibration/Main.cpp Qt entry point that launches the new calibration window.
simulator/controllers/BayesianMpcCalibration/application/CMakeLists.txt Defines the simulator application library and links required numerical libraries (incl. optimization).
simulator/controllers/BayesianMpcCalibration/application/BayesianMpcCalibrationSimulator.hpp Declares the EM→BO calibration orchestrator and result payload for the UI.
simulator/controllers/BayesianMpcCalibration/application/BayesianMpcCalibrationSimulator.cpp Implements the end-to-end pipeline execution and step response generation.
simulator/controllers/BayesianMpcCalibration/application/DoubleIntegratorPlant.hpp Declares a simple plant model and observation generator for EM training data.
simulator/controllers/BayesianMpcCalibration/application/DoubleIntegratorPlant.cpp Implements observation generation with process/measurement noise.
simulator/controllers/BayesianMpcCalibration/application/EmKfPipeline.hpp Declares a pipeline wrapper around EM iterations and convergence tracking.
simulator/controllers/BayesianMpcCalibration/application/EmKfPipeline.cpp Implements iterative EM stepping and convergence detection.
simulator/controllers/BayesianMpcCalibration/application/MpcBoCalibrator.hpp Declares BO-based tuning of MPC weights (Q/R) via an ISE objective.
simulator/controllers/BayesianMpcCalibration/application/MpcBoCalibrator.cpp Implements BO-driven search over MPC weight parameters.
simulator/controllers/BayesianMpcCalibration/view/CMakeLists.txt Defines the Qt view library target for the new simulator UI.
simulator/controllers/BayesianMpcCalibration/view/BayesianMpcCalibrationView.hpp Declares the main window, controls, and chart widgets.
simulator/controllers/BayesianMpcCalibration/view/BayesianMpcCalibrationView.cpp Implements UI layout, run action, and result visualization charts.
numerical/optimization/CMakeLists.txt Adds Bayesian Optimization sources and links optimization to the solver target.
numerical/optimization/BlackBoxObjective.hpp Introduces a polymorphic objective interface for BO.
numerical/optimization/BayesianOptimization.hpp Implements fixed-capacity GP + EI Bayesian optimization.
numerical/optimization/BayesianOptimization.cpp Adds explicit template instantiations for coverage builds.
numerical/optimization/test/CMakeLists.txt Registers the new BO test file with the optimization test target.
numerical/optimization/test/TestBayesianOptimization.cpp Adds unit tests for GP prediction, EI, acquisition bounds, and optimization behavior.
numerical/filters/active/KalmanSmoother.hpp Extracts log-likelihood and smoother-gain calculations into helper methods.
numerical/estimators/offline/ExpectationMaximization.hpp Extracts transition/observation update computations into helper methods and generalizes symmetrization.
doc/optimization/README.md Adds BO to the optimization docs index table.
doc/optimization/BayesianOptimization.md Adds new design-first documentation for Bayesian Optimization per template sections.
.vscode/launch.json Adds a launch configuration entry for the new simulator executable.
.github/instructions/numerical-cpp.instructions.md Updates documentation guidance toward design-first, template-aligned docs.
.github/copilot-instructions.md Updates repo-wide documentation and launch-config expectations.
.github/agents/reviewer.agent.md Updates reviewer checklist to enforce doc template + no implementation/usage snippets.
.github/agents/planner.agent.md Updates planning checklist for documentation and simulator launch configuration.
.github/agents/executor.agent.md Updates execution checklist for documentation and simulator launch configuration.

@sonarqubecloud

sonarqubecloud Bot commented Apr 4, 2026

Copy link
Copy Markdown

@gabrielfrasantos gabrielfrasantos changed the title feat: add bayesin opmization feat: add bayesian opmization Apr 4, 2026
@gabrielfrasantos
gabrielfrasantos merged commit dbf40cc into main Apr 4, 2026
9 checks passed
@gabrielfrasantos
gabrielfrasantos deleted the feature/add-bayesian-optmization branch April 4, 2026 20:47
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.

feat: add Bayesian Optimization for MPC calibration

3 participants