Skip to content

Add scaling#817

Draft
davide-f wants to merge 4 commits into
PyPSA:masterfrom
davide-f:add_scaling
Draft

Add scaling#817
davide-f wants to merge 4 commits into
PyPSA:masterfrom
davide-f:add_scaling

Conversation

@davide-f

@davide-f davide-f commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Closes # (if applicable).

Changes proposed in this Pull Request

This PR aims to showcase a possible implementation of scaling into linopy.
Scaling of mathematical problems is complex and different solvers adopt different standards (if any). Generally, it is up to the modeller to cast the problem within adeguate ranges. This PR may give an intermediate tool to answer this problem.

The idea is to add a scaling parameter to each variable, constraint and objective term that will be used to scale the problem accordingly.
Scaling applied to each variable divides all coefficients of the variable column-wise, while scaling applied to constraints or the objective apply the scaling row-wise.

This PR is being used for testing the role of scaling and showcase a possible implementation.

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).
  • A note for the release notes doc/release_notes.rst of the upcoming release is included.
  • I consent to the release of this PR's code under the MIT license.

@FBumann

FBumann commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

@davide-f Great work here! This is a long wanted feature!

@davide-f

davide-f commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

@davide-f Great work here! This is a long wanted feature!

Thanks for the comment! This was a prototype that needs finalization if you and Fabian see it relevant.
I'd wait for feedback on that before dedicating resources as it can require some time.
Please let me know your view

@FabianHofmann

Copy link
Copy Markdown
Collaborator

@davide-f great, I will take a look at this in the coming days. #524 already implemented scaling but in another fashion. it follows the idea of auto-scaling by a certain method. this pr requires the user to insert the scaling parameters by themselves. Since this pr gives the user more control I am closing #524. We might want to think about how to extent this later by an auto-scaling mechanism.

@FabianHofmann FabianHofmann mentioned this pull request Jul 13, 2026
4 tasks
@FBumann

FBumann commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

@davide-f I agree with @FabianHofmann. But having such an auto scale feature (and building it in a way to easily extend it to new sscaling trategies) should be a follow up and non blocking to this I think.

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.

3 participants