Skip to content

Conversation

@springfall2008
Copy link
Owner

No description provided.

Copilot AI review requested due to automatic review settings January 13, 2026 08:15
Copy link
Contributor

Copilot AI left a comment

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 introduces improvements to the coarse/fine optimization algorithm in Predbat's planning system, along with documentation for the feature. The main change restructures the optimization loop nesting to improve algorithm behavior, moving the price iteration to the outer loop so that the fine-tuning pass can leverage the globally best slot sizes discovered across all price levels during the coarse pass.

Changes:

  • Added documentation for the enable_coarse_fine_levels configuration option
  • Restructured optimization loops in plan.py to place price iteration outside of coarse/fine iteration
  • Optimized min_freeze_percent calculation to avoid redundant recomputation
  • Added time.sleep(0) to DummyThread for better control yielding
  • Updated test expectations to reflect improved optimization results

Reviewed changes

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

File Description
docs/apps-yaml.md Added comprehensive documentation for the enable_coarse_fine_levels config option explaining the two-pass optimization strategy
apps/predbat/config.py Added enable_coarse_fine_levels to the configuration schema with boolean type
apps/predbat/plan.py Restructured optimization loops (price outer, coarse/fine inner), moved min_freeze_percent calculation outside loops for efficiency, added control yielding to DummyThread, and improved conditional clarity with parentheses
coverage/cases/predbat_debug_pre_saving1.yaml.expected.json Updated test expectations to reflect the new optimization results (12 vs 14 charge limit entries, modified charge windows)

@springfall2008 springfall2008 merged commit 4169e03 into main Jan 13, 2026
7 checks passed
@springfall2008 springfall2008 deleted the opt2 branch January 13, 2026 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants