Skip to content

doc: deepen numerical-scaling notebook (unit framing, all ranges per step) - #1067

Merged
FabianHofmann merged 2 commits into
masterfrom
doc/scaling-notebook-depth
Oct 27, 2026
Merged

FabianHofmann merged 2 commits into
masterfrom
doc/scaling-notebook-depth

Conversation

@FabianHofmann

@FabianHofmann FabianHofmann commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Note

The following content was generated by AI.

Changes proposed in this Pull Request

Reworks the numerical-scaling example notebook so it is easier to follow and goes deeper into how scaling moves the solver's numbers.

  • Scaling as a change of units. Every factor is now read as a unit the solver sees: p in MW instead of GW, e in GWh instead of MWh, rows in GWh, costs in k€. The show helper labels each table with these units.
  • All four ranges after every step. Each step prints the constraint rows, the variable columns (bounds and costs) and the four ranges solvers report (matrix, objective, bounds, rhs), as titled tables.
  • Implicit shifts explained. The notebook shows how one factor moves several ranges at once:
    • Column scaling moves bounds and coefficients in opposite directions.
    • It never touches the rhs, so rows drift away from their right-hand sides.
    • Row and objective scaling cannot narrow a spread, only move it. A short demo shows this.
  • Units vs physics. The link coefficient 1e6 is split into a unit conversion (1000 MW/GW) and 1000 full-load hours. Scaling removes only the unit part.
  • Model tweak. Both variables and both rows are now scaled. The capacity cost changed from 3e-4 to 3e5 €/GW so capacity matters in the objective. The round-trip check now also compares the link dual.
  • Plot. It now shows all four ranges per step.
  • Summary table. A new table shows which setting moves which range.
  • New section "When unit changes cannot help". Two generators in MW (2 kW and 2 GW) share one balance row. Changing to kW and GW only moves the spread into the matrix and the costs.

The previous version claimed an improvement from row-scaling the link row, but the matrix ratio stayed at 1e3. The new text corrects this.

Checklist

  • AI-generated content is marked (see AGENTS.md).
  • Code changes are sufficiently documented; i.e. new functions contain docstrings and further explanations may be given in doc.
  • Unit tests for new features were added (if applicable). Not applicable, documentation only.
  • A note for the release notes doc/release_notes.rst of the upcoming release is included. Not added, documentation only.
  • I consent to the release of this PR's code under the MIT license.

@codspeed

codspeed Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 181 untouched benchmarks
⏩ 181 skipped benchmarks1


Comparing doc/scaling-notebook-depth (1e05787) with master (ae80bc8)

Open in CodSpeed

Footnotes

  1. 181 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@FabianHofmann
FabianHofmann merged commit 9ad435d into master Oct 27, 2026
20 checks passed
@FabianHofmann
FabianHofmann deleted the doc/scaling-notebook-depth branch October 27, 2026 09:04
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.

1 participant