Skip to content

Commit 8a08824

Browse files
authored
Fix non implemented case in LinearExpression class (#724)
Operation `Float * LinearExpression` is not implemented and caused a stack recursion error `"maximum recursion depth exceeded"`. This PR changes to the equivalent `LinearExpression * Float` which calls LinearExpression.__mul__ that can handle floats. ## Summary by CodeRabbit * **Bug Fixes** * Fixed scalar multiplication operations on linear expressions to deliver correct mathematical results in linear programming problems. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> Authors: - Hugo Linsenmaier (https://github.com/hlinsen) Approvers: - Ishika Roy (https://github.com/Iroy30) URL: #724
1 parent 3a9a37d commit 8a08824

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

python/cuopt/cuopt/linear_programming/problem.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,7 @@ def __mul__(self, other):
935935
return other * self
936936

937937
def __rmul__(self, other):
938-
return other * self
938+
return self * other
939939

940940
def __itruediv__(self, other):
941941
# Compute expr /= constant

0 commit comments

Comments
 (0)