Repository navigation
Conversation
… linear, quadratic or constant term rather than a piece `Piece` is `Term`, in `_engine/terms.py`. Its kinds are `linear`, `quadratic` and `constant`, and a `CompiledExpression` holds them as `linear`, `constant` and `quadratic`. The helpers that named a piece name a term, and the products read as what they do: `times_constant`, `times_variable` and `to_the_power`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WjaoQERHiPueVjahe7oKSG
Merging this PR will not alter performance
Comparing Footnotes
|
…ratic, so the terms keep their plain names Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WjaoQERHiPueVjahe7oKSG
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Note
The following content was generated by AI.
Pieceis nowTerm, in_engine/terms.py. A term islinear,quadraticorconstant, which retires the words "piece", "term piece", "const piece" and "constant part". The compiler'squadraticflag is nowadmits_quadratic. Behaviour does not change.What was renamed
_engine/pieces.py_engine/terms.pyPieceTerm'term','quad','const''linear','quadratic','constant'CompiledExpression.terms,.consts,.quads.linear,.constant,.quadraticCompiler.expression(..., quadratic=)Compiler.expression(..., admits_quadratic=)map_piecesmap_termsrefuse_a_piece_without_the_dimsrefuse_a_term_without_the_dimsjoin_mul,join_quad,join_powtimes_constant,times_variable,to_the_power_parameter_piece,_variable_piece,_solved_piece,_dual_piece,_sum_piece,_group_piece,_at_piece,_remap_piece_termtranslate_piece,window_piecetranslate_term,window_termquadraticlist shadowed it. Now the locals inproduct,quotientand_build_constraintuse the plain nameslinear,quadraticandconstant, like the fields ofCompiledExpression. Its docstring no longer says that a constraint row cannot hold a product, which was false for a quadratic constraint.is_quadratic, anddeclares_quadraticalso decides which constraints the solver capability check sees.pieces, are nowframes(andalignedinreadback).verification.mdand the test names and prose use the new words.specsolve cannot buildandDeclare the parameter over, and both phrases are unchanged.Verification
On
dd1315d, in a uv environment that mirrors the pixidevanddocsfeatures:ruff check .andruff format --check .pass.pyrefly checkreports 0 errors. On216fa32, the linopy-reference check also reported 0 errors.pytest -n auto: 5524 passed, 663 skipped, 4 xfailed, 4 failed. The 4 failures are the gurobi and xpress cases oftest_a_row_with_no_terms_is_not_built_and_is_reportedandtest_a_solver_hands_back_a_vector_and_not_an_index. These solvers are not installed in this container, and the same 4 fail on unmodifiedmain.tests/test_docstring_links.pypasses. On216fa32,tests/test_docs_math.pypassed andzensical build --strictfound no issues.pixi run checkitself, because pixi is not installed here. I ran its parts directly.Not done
_strategy.pyand_archive.py, "pieces" means slices of a table.piecewiseand the GenX curve's "piece" are language words.pfor a term, thecvalandcoeffcolumns,constant_scalarand the__const {i}__alias are unchanged. Renaming them would add churn and remove no concept.sumalong a dimension the constant does not carry, is a separate change. Mathspec's per-nodedims(feat(program): each expression node states the dimensions it is read over energy-models/mathspec#899) may let the engine spread the constant term before the sum instead of refusing it.🤖 Generated with Claude Code
https://claude.ai/code/session_01WjaoQERHiPueVjahe7oKSG