forked from PyPSA/linopy
-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/centralize quadratic solvers check #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
d699d16
Add highs validation for quadratic constraints
FBumann 06da62f
Multi-dimensional quadratic constraints - Fixed LP file and Gurobi di…
FBumann c801fe5
Add quadratic constraints to netcdf serialization
FBumann e931014
add test_netcdf_roundtrip_multidimensional
FBumann 4ef8d1f
Added the following properties to MatrixAccessor in matrices.py:
FBumann 4312efb
Fix imports
FBumann 19d3c43
Add dual support
FBumann 6ca9f84
Add Add mosek direct api
FBumann 4b0252e
qc_linear property now handles the case when there are no linear ter…
FBumann 3b915fe
Remove separate quad checks
FBumann b09fbca
Add tests for verification of solver
FBumann 7e2ccb7
Merge remote-tracking branch 'origin/master' into feature/centralize-…
FBumann b2739a8
Merge remote-tracking branch 'origin/master' into feature/centralize-…
FBumann File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Script executed:
Repository: FBumann/linopy
<shell_result>
Repository: FBumann/linopy
Exit code: 0
stdout:
</shell_result>
Script executed:
Repository: FBumann/linopy
<shell_result>
Repository: FBumann/linopy
Exit code: 0
stdout:
</shell_result>
Script executed:
Repository: FBumann/linopy
<shell_result>
Repository: FBumann/linopy
Exit code: 0
stdout:
</shell_result>
Script executed:
Repository: FBumann/linopy
<shell_result>
Repository: FBumann/linopy
Exit code: 0
stdout:
</shell_result>
Script executed:
Repository: FBumann/linopy
<shell_result>
Repository: FBumann/linopy
Exit code: 0
stdout:
</shell_result>
Script executed:
Repository: FBumann/linopy
<shell_result>
Repository: FBumann/linopy
Exit code: 0
stdout:
</shell_result>
Script executed:
Repository: FBumann/linopy
<shell_result>
Repository: FBumann/linopy
Exit code: 0
stdout:
</shell_result>
Script executed:
Repository: FBumann/linopy
<shell_result>
Repository: FBumann/linopy
Exit code: 0
stdout:
</shell_result>
Script executed:
Repository: FBumann/linopy
<shell_result>
Repository: FBumann/linopy
Exit code: 0
stdout:
</shell_result>
Script executed:
Repository: FBumann/linopy
<shell_result>
Repository: FBumann/linopy
Exit code: 0
stdout:
</shell_result>
Script executed:
Repository: FBumann/linopy
<shell_result>
Repository: FBumann/linopy
Exit code: 0
stdout:
</shell_result>
Script executed:
Repository: FBumann/linopy
<shell_result>
Repository: FBumann/linopy
Exit code: 0
stdout:
</shell_result>
Script executed:
Repository: FBumann/linopy
<shell_result>
Repository: FBumann/linopy
Exit code: 1
</shell_result>
Script executed:
Repository: FBumann/linopy
<shell_result>
Repository: FBumann/linopy
Exit code: 0
stdout:
</shell_result>
Script executed:
Repository: FBumann/linopy
<shell_result>
Repository: FBumann/linopy
Exit code: 0
stdout:
</shell_result>
Script executed:
Repository: FBumann/linopy
<shell_result>
Repository: FBumann/linopy
Exit code: 0
stderr:
</shell_result>
Script executed:
Repository: FBumann/linopy
<shell_result>
Repository: FBumann/linopy
Exit code: 0
stdout:
</shell_result>
Script executed:
Repository: FBumann/linopy
<shell_result>
Repository: FBumann/linopy
Exit code: 0
stdout:
</shell_result>
Script executed:
Repository: FBumann/linopy
<shell_result>
Repository: FBumann/linopy
Script execution failed with error: Request timed out after 120000ms (requestId=cc11bc26-5f94-45c7-b7b4-40c7a21ecd8b)
</shell_result>
Script executed:
Repository: FBumann/linopy
<shell_result>
Repository: FBumann/linopy
Exit code: 0
stdout:
</shell_result>
Script executed:
Repository: FBumann/linopy
<shell_result>
Repository: FBumann/linopy
Exit code: 0
stdout:
</shell_result>
Script executed:
Repository: FBumann/linopy
<shell_result>
Repository: FBumann/linopy
Exit code: 0
stdout:
</shell_result>
Script executed:
Repository: FBumann/linopy
<shell_result>
Repository: FBumann/linopy
Exit code: 0
stdout:
</shell_result>
Script executed:
Repository: FBumann/linopy
<shell_result>
Repository: FBumann/linopy
Exit code: 0
stdout:
</shell_result>
Script executed:
Repository: FBumann/linopy
<shell_result>
Repository: FBumann/linopy
Exit code: 0
stdout:
</shell_result>
Script executed:
Repository: FBumann/linopy
<shell_result>
Repository: FBumann/linopy
Exit code: 0
stdout:
</shell_result>
Script executed:
Repository: FBumann/linopy
<shell_result>
Repository: FBumann/linopy
Exit code: 1
</shell_result>
Script executed:
Repository: FBumann/linopy
<shell_result>
Repository: FBumann/linopy
Exit code: 0
stdout:
</shell_result>
Script executed:
Repository: FBumann/linopy
<shell_result>
Repository: FBumann/linopy
Exit code: 0
</shell_result>
Script executed:
Repository: FBumann/linopy
<shell_result>
Repository: FBumann/linopy
Exit code: 0
stdout:
</shell_result>
Script executed:
Repository: FBumann/linopy
<shell_result>
Repository: FBumann/linopy
Exit code: 0
stdout:
</shell_result>
Script executed:
Repository: FBumann/linopy
<shell_result>
Repository: FBumann/linopy
Exit code: 0
stdout:
</shell_result>
Script executed:
Repository: FBumann/linopy
<shell_result>
Repository: FBumann/linopy
Exit code: 0
stdout:
</shell_result>
Perfect! Now I have the complete picture. The Q property delegates to
expr.to_matrix()from the QuadraticExpression. This confirms the pattern. Let me finalize my analysis and provide the corrected review comment.Verify the coefficient scaling for MOSEK quadratic constraints.
The Qc matrices from
matrices.py(line 241) have only diagonal terms doubled (documented: "Q is symmetric with doubled diagonal terms"). The code divides all entries uniformly by 2, which incorrectly scales off-diagonal terms.For example, a constraint like
x*ywith coefficient 1:(0,1)=1, (1,0)=1(not doubled)tril(Q)extracts(1,0)=10.50.5for the off-diagonal term, which is incorrect (should be1)The objective export (line 745) handles this correctly by reconstructing the full symmetric matrix:
0.5 * tril(M.Q + M.Q.transpose()). Apply the same pattern to quadratic constraints rather than dividing all entries uniformly.The uniform division by 2 is incorrect for off-diagonal entries. Consider reconstructing the symmetric matrix like the objective does to ensure proper coefficient scaling.
🤖 Prompt for AI Agents