-
Notifications
You must be signed in to change notification settings - Fork 274
Feature: Merge Expr and GenExpr
#1114
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
Draft
Zeroto521
wants to merge
215
commits into
scipopt:master
Choose a base branch
from
Zeroto521:issue/1074
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 1 commit
Commits
Show all changes
215 commits
Select commit
Hold shift + click to select a range
58c34c0
Feature: merge `Expr` and `GenExpr`
Zeroto521 4cbc603
Rename _unary to _to_unary_expr in expr.pxi
Zeroto521 188b3ef
Remove `Variable.create`
Zeroto521 193ec1c
Specify type of _lhs and _rhs as object in ExprCons
Zeroto521 c70e305
Merge branch 'master' into issue/1074
Zeroto521 d8d63d2
lint codes
Zeroto521 a0086d2
Change Variable constructor to use __cinit__
Zeroto521 123f36e
MAINT: Support return solution
Zeroto521 c961db5
Add return type annotations to _normalize methods
Zeroto521 0b01b08
Remove adding 0
Zeroto521 28e6673
MAINT: use class inner method to instead
Zeroto521 e4f48b5
Replace 'terms' with 'children' in Expr usage
Zeroto521 7d85fd0
lint codes
Zeroto521 f7159a0
Correct `_evaluate` cython syntax
Zeroto521 69737c0
Correct name: `PowerExpr` → `PowExpr`
Zeroto521 09a222b
Refactor expression to node conversion
Zeroto521 2b0fa85
Merge branch 'master' into issue/1074
Zeroto521 0b7ee70
Revert 188b3efa "Remove `Variable.create`"
Zeroto521 cc28588
Refactor Expr to standard Python class
Zeroto521 8719b91
Simplify comparison
Zeroto521 84886b3
Revert "MAINT: use class inner method to instead"
Zeroto521 955a9e0
Change cdef classes to Python classes in expr.pxi
Zeroto521 88aa0b4
lint codes
Zeroto521 d4bf9b7
Remove unused Expr class from scip.pxd
Zeroto521 b5f0435
Refactor ExprCons to Python class with type hints
Zeroto521 ece0ce0
Remove Cython related annotations
Zeroto521 7811406
Refactor tests to use Expr instead of GenExpr
Zeroto521 72efd0a
Remove `GenExpr`
Zeroto521 73777a4
Add __hash__ method to Variable class
Zeroto521 c0c14ae
Replace > and < with <= and >=
Zeroto521 900bc81
Support Variable type in matrix comparison
Zeroto521 003f3a6
Move degree() method from subclasses to Expr base class
Zeroto521 810a60d
support `Expr() + 1`
Zeroto521 0c406bb
Update degree test for empty expression
Zeroto521 dd2b02d
Replace `.terms` with `.children`
Zeroto521 c139de4
Replace `.vartuple` with `.vars`
Zeroto521 a7ba203
Fix operator overloads in Expr class
Zeroto521 3fbd24f
Replace __ge__ with __eq__ in Expr class
Zeroto521 ea9bb38
Support `variable[variable]`
Zeroto521 c17e4a5
Add iterator support to Variable class
Zeroto521 790319e
Refactor objective expression type handling
Zeroto521 7373021
Empty Expr * other Expr return empty Expr
Zeroto521 8876f64
Revert "support `Expr() + 1`"
Zeroto521 e1e1dac
support `_to_nodes`
Zeroto521 f5a4144
Support `__rpow__`
Zeroto521 3e3f2bd
Sort methods
Zeroto521 b9936f0
Merge branch 'master' into issue/1074
Joao-Dionisio e60e3ce
Support `__abs__`
Zeroto521 162f6f2
Expr requires Variable, Term, or Expr
Zeroto521 b3698de
`to_const_or_var` → `from_const_or_var`
Zeroto521 718fb67
Allow __getitem__ to accept non-Expr keys
Zeroto521 33695c4
Allow Term objects as keys in Expr __getitem__
Zeroto521 73a5a21
Use PolynomialExpr in quicksum and quickprod
Zeroto521 da49cca
Fix division logic for Expr with hash check
Zeroto521 2977310
Filter 0 coefficient from SumExpr
Zeroto521 b270aa8
Use Hashable for hash check in Expr division
Zeroto521 bb3f871
Improve type checks and constructors in expression classes
Zeroto521 29a7e2a
Term support return `_to_nodes`
Zeroto521 7f75a55
Add type annotations to expression classes and functions
Zeroto521 bd00b91
Refactor number type checks to use numbers.Number
Zeroto521 337803b
Handle Number type in UnaryExpr constructor
Zeroto521 d0776b1
Add type annotations to expression classes
Zeroto521 d74fbfa
Move `_to_unary_expr` to UnaryExpr class inner
Zeroto521 882a1b1
Update exception type in power operation test
Zeroto521 b971304
Refactor quicksum and quickprod implementations
Zeroto521 d56b5db
Improve addition logic for Expr classe
Zeroto521 ca5aae2
Refactor degree calculation in expression classes
Zeroto521 3a599a5
Fix node construction logic in expression classes
Zeroto521 0e7223b
Fix degree calculation for empty expression children
Zeroto521 86d60f7
Improve ExprCons initialization and validation
Zeroto521 659fb2b
Set default CONST term in Expr children
Zeroto521 36f46cc
Fix degree test for empty expression
Zeroto521 726561c
Update expected values in equation tests
Zeroto521 0edf545
Remove unused test_degree (it for GenExpr)
Zeroto521 1b4719e
Improve multiplication logic in Expr class
Zeroto521 1b481eb
Update inequality test assertions in test_expr.py
Zeroto521 cb9e8c2
Revert "Set default CONST term in Expr children"
Zeroto521 a679683
Refactor zero-removal logic in SumExpr and PolynomialExpr
Zeroto521 835feeb
Fix addition behavior for Expr with no children
Zeroto521 1cf3a79
Update degree test for empty expression
Zeroto521 fe7027e
Refactor Expr and ProdExpr multiplication logic
Zeroto521 64097ee
Merge SumExpr into Expr
Zeroto521 a0f3f57
Reorder imports and reformat addMatrixVar and addCons loop
Zeroto521 8c9d155
Speed up via avoid copying dict itself
Zeroto521 697d971
Drop `ptrs` from Term
Zeroto521 9e73d13
support the same base ProdExpr to add
Zeroto521 769a0c9
Add __slots__ attr for Expr
Zeroto521 0a32157
`Expr._normalize` will change itself now
Zeroto521 c118c47
Add type hints in ExprCons
Zeroto521 fd9ed81
Remove __next__ method
Zeroto521 1e22c8b
Speed up accessing the first child
Zeroto521 9555844
Use .append and .extend to add value to list
Zeroto521 f00c5f1
Use ConstExpr(1) instead of 1
Zeroto521 2b70039
Refactor sum expression type check in Expr class
Zeroto521 f9525cc
Cythonize Expr and ExprCons
Zeroto521 df44fcd
Cythonize Term
Zeroto521 f41fb88
Drop _remove_zero
Zeroto521 bc54cab
Drop `Variable.to_expr`
Zeroto521 5bc41f5
BUG: add coef to node if coef != 1
Zeroto521 45b38f9
Add degree method to Variable class
Zeroto521 06e77c2
Simplify a bit
Zeroto521 41dd48b
Fix Variable.__iadd__ to use MonomialExpr
Zeroto521 7cf94cd
Refactor Expr class and restore _is_SumExpr method
Zeroto521 ab57fea
Add in-place addition to ConstExpr and MonomialExpr
Zeroto521 f94da07
Merge branch 'master' into issue/1074
Zeroto521 adbd38e
Refactor _is_SumExpr to instance method in Expr
Zeroto521 4775060
Refactor expression classes and type annotations
Zeroto521 a41c470
Change Variable.degree return type to float
Zeroto521 84ce732
Add type check for Term constructor arguments
Zeroto521 b8c3466
Update __iter__ return type in Expr class
Zeroto521 3efdff2
Expr only receives Term and Expr
Zeroto521 d5ae65e
Refactor _to_node methods for expression classes
Zeroto521 94ac5ef
Optimize addition with zero constant expressions
Zeroto521 9e3b11a
Merge branch 'master' into issue/1074
Zeroto521 6148e8d
Add copy option to Expr.to_dict and optimize __iadd__
Zeroto521 0398a66
add type to calculate hash value for FuncExpr
Zeroto521 b8a23ba
Optimize in-place addition and implement in-place subtraction for Expr
Zeroto521 56a82cc
Fix Expr comparison logic with MatrixExpr
Zeroto521 c07fdc3
Fix comparison logic in Expr class
Zeroto521 4ffc79f
Add negative to `coeffs` test_customizedbenders.py
Zeroto521 2ce7501
Rename Term.HASH to Term._hash for clarity
Zeroto521 e40dbd8
Fix degree calculation for empty expression children
Zeroto521 50d9d68
Fix degree test for empty expression
Zeroto521 1999e88
change `relevant_value` to float in readStatistics
Zeroto521 744d421
Refactor expression type checks in expr.pxi
Zeroto521 8f9e804
Add in-place mul and sub operators to Variable
Zeroto521 02ca24e
Add in-place multiplication support to Expr class
Zeroto521 b9e8a02
Add __iadd__ method to ProdExpr and new config file
Zeroto521 33e1244
Add in-place multiplication to ProdExpr
Zeroto521 d43639b
Refactor child equality and hashing in FuncExpr
Zeroto521 26e3f49
Enhance PowExpr and LogExpr operator overloading
Zeroto521 d4b1f36
Remove lint
Zeroto521 67ea9b7
Fix sign error in dual solution coefficient calculation
Zeroto521 ac3bb7f
Drop test_upgrade
Zeroto521 fa87e36
Speed a little via checking empty first
Zeroto521 fb07597
Remove test_eq.py and test_ge.py test scripts
Zeroto521 5e381da
Delete config
Zeroto521 a73767e
Create test_term.py
Zeroto521 46c5f41
check error inputting into Expr
Zeroto521 2333cb4
Add test for slots enforcement in Expr and related classes
Zeroto521 c402e04
reorder test_expr_op_expr
Zeroto521 7a28c54
Add equality tests for Term class
Zeroto521 466b9e8
Add tests for Term __getitem__ behavior
Zeroto521 8e2dfe3
Rename test functions for clarity in test_expr.py
Zeroto521 5a4f5f7
Add Expr __getitem__ tests
Zeroto521 e902cf4
Add test for abs() on Expr objects
Zeroto521 4a86658
Add tests for Expr._fchild() method
Zeroto521 649a782
Add tests for unsupported type addition in Expr
Zeroto521 6d45eed
Add tests for Expr multiplication with invalid types
Zeroto521 84966df
Add tests for Expr division operations
Zeroto521 e0ea9a3
Add test for Expr power operation with exponent 0
Zeroto521 121af2c
Add tests for Expr rpow (__rpow__) behavior
Zeroto521 8b478c5
Fix FuncExpr can't access children
Zeroto521 900132a
Use identity comparison in test_getitem assertion
Zeroto521 42cd9ae
Expand and rename test for Expr multiplication
Zeroto521 b3129a7
Simplify Expr init
Zeroto521 95d9a03
Refactor tests to use explicit Model instances
Zeroto521 958e1bb
Refactor tests to use shared model fixture
Zeroto521 d302831
Refactor ProdExpr to use dict.fromkeys for children
Zeroto521 31bae2b
Refactor UnaryExpr.to_subclass type handling
Zeroto521 2221868
Add __bool__ method to Expr and refactor checks
Zeroto521 d1e94da
Handle the FuncExpr add itself
Zeroto521 431d4a0
handle adding 0 or 1 in Expr not the subclass
Zeroto521 1c5b3d8
Refactor variable naming from 'terms' to 'children'
Zeroto521 c931f40
Rename parameter in Term.__getitem__ method
Zeroto521 5d4cea9
Add iterator support to Term class
Zeroto521 9893145
Make _hash attribute readonly and improve __eq__ check
Zeroto521 c2f3a87
Update Term equality tests for non-Term comparisons
Zeroto521 d9f8522
Update __hash__ methods for Expr and PolynomialExpr
Zeroto521 b451bf8
Add explicit type casts in ExprCons methods
Zeroto521 7342e88
Rename to_subclass to _to_subclass in UnaryExpr
Zeroto521 2a1466b
Cast Number to float in UnaryExpr initialization
Zeroto521 07594f3
Optimize subtraction for identical Expr operands
Zeroto521 dd9d490
Add copy methods to expression classes
Zeroto521 66e83c0
Add _is_equal method to Expr class
Zeroto521 37b44b4
Add static method to check for zero constant expr
Zeroto521 d7f12dc
Add _ExprKey helper class and refactor sum handling in Expr
Zeroto521 f17d118
Cast children to dict in PolynomialExpr constructor
Zeroto521 22edc8d
Refactor: rename from_const_or_var to _from_const_or_var
Zeroto521 b912a0f
Rename to_subclass to _to_subclass in PolynomialExpr
Zeroto521 067002e
Refactor Expr: rename _is_Const and _is_Sum to snake_case
Zeroto521 4f75edc
Replace to_dict with _to_dict in Expr and PolynomialExpr
Zeroto521 250a8d4
Use _ExprKey to wrap key of Expr._children
Zeroto521 0255176
Enforce Expr type for objective functions
Zeroto521 05f131f
Refactor to use _children instead of children in Expr
Zeroto521 6569711
Rename and expand Expr tests for consistency
Zeroto521 b84bea6
Remove type check for dict in _merge_dicts method
Zeroto521 0f13f42
Refactor variable names in __imul__ method of Expr
Zeroto521 71af1bd
Handle zero coefficient in Expr._to_node
Zeroto521 3152d43
Fix indentation in Expr class for sum handling
Zeroto521 cc655e1
Optimize in-place multiplication for Expr sums
Zeroto521 bb842e3
Correct type from Term to Variable
Zeroto521 26529d2
Make MonomialExpr.from_var a private method
Zeroto521 8283c03
Add NotImplementedError for ExprCons equality
Zeroto521 520543c
Remove redundant bound checks in ExprCons
Zeroto521 1b0a0b3
Refactor ExprCons comparison operator type checks
Zeroto521 220e41b
Update constructor argument types to Cython syntax
Zeroto521 9089eea
Remove MonomialExpr and use PolynomialExpr for variables
Zeroto521 4689522
zero-check including empty-check
Zeroto521 73475b1
Fix type in ConstExpr call in Expr.__ge__ method
Zeroto521 697d090
Update _to_subclass signature in PolynomialExpr
Zeroto521 1fd8076
Fix argument order in UnaryExpr._to_subclass calls
Zeroto521 8304ebc
Refactor in-place addition for Expr and subclasses
Zeroto521 72e6320
Make ExprCons attributes readonly
Zeroto521 93027db
Change Term.vars and _ExprKey.expr to readonly attributes
Zeroto521 5a069db
Refactor expression comparison methods using __richcmp__
Zeroto521 e89e0d9
Make `Term._hash` to private attribute
Zeroto521 6a81522
Update Term tests to expect Variable instead of Term
Zeroto521 2d913d4
Refactor Expr subclass conversion logic
Zeroto521 bb91803
Create test_PolynomialExpr.py
Zeroto521 22e9cd4
Simplify Expr.__hash__ due to _ExprKey.__eq__
Zeroto521 4d1b54a
Cast result of __add__ to Expr in comparison ops
Zeroto521 c91e459
Reorder __slots__ and cdef readonly attributes in expr.pxi
Zeroto521 02774f0
Refactor quicksum and quickprod for type safety and speed
Zeroto521 b5a1037
Refactor unary functions via numpy ufunc
Zeroto521 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
Merge SumExpr into Expr
Merged SumExpr functionality into Expr, simplifying sum expression logic and normalization. Updated PolynomialExpr to inherit directly from Expr. Adjusted Model class to handle Expr instead of SumExpr for sum expressions. This refactor streamlines expression management and reduces class complexity.
- Loading branch information
commit 64097ee34d85cc6e45a2191bd6ff9e86c63798c1
Some comments aren't visible on the classic Files Changed page.
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
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.
Uh oh!
There was an error while loading. Please reload this page.