Allow zero-valued LP Python model updates#1421
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR fixes mutable default arguments and improves parameter handling in two ChangesMutable defaults and falsy value handling
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
🔔 Hi @anandhkb, this pull request has had no activity for 7 days. Please update or let us know if it can be closed. Thank you! If this is an "epic" issue, then please add the "epic" label to this issue. |
Summary
Problem.updateConstraintandProblem.updateObjectiveused truthiness checks for optional numeric updates. That meant valid zero values such asrhs=0orconstant=0were silently ignored.This updates those checks to distinguish omitted arguments from explicit zero-valued updates. It also removes the mutable default list from both methods while keeping the existing call behavior.
Validation
python3 -m py_compile python/cuopt/cuopt/linear_programming/problem.py python/cuopt/cuopt/tests/linear_programming/test_python_API.pygit diff --checkNot run locally:
PYTHONPATH=python/cuopt uvx --with 'pytest<9.0' pytest python/cuopt/cuopt/tests/linear_programming/test_python_API.py -k 'problem_update_accepts_zero_values' -qcould not collect because this checkout does not include the generated/nativecuopt.linear_programming.internals.internalsmodule.