Skip to content

Refactor cost access behind accessor object#804

Open
nathanneike wants to merge 1 commit intoPythonOT:masterfrom
nathanneike:cleanup_cost_accessor
Open

Refactor cost access behind accessor object#804
nathanneike wants to merge 1 commit intoPythonOT:masterfrom
nathanneike:cleanup_cost_accessor

Conversation

@nathanneike
Copy link
Copy Markdown
Contributor

Types of changes

  • Refactoring / code cleanup
  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and context / Related issue

This PR cleans up cost handling in the network simplex solver by introducing a dedicated cost accessor object. The goal is to centralize cost retrieval for the different existing cost modes instead of keeping the logic duplicated across pricing, initialization, warmstart, and total-cost computation.

This does not aim to change solver behavior. It is a cleanup step to make the cost path easier to reason about and easier to extend in follow-up optimization work.

How has this been tested (if it applies)

  • Rebuilt the compiled extension locally with clang:
    • CC=clang CXX=clang++ LDFLAGS="-L$PWD/.openmp/lib -Wl,-rpath,$PWD/.openmp/lib -lomp" .venv/bin/python setup.py build_ext --inplace
  • Verified the modified C++ extension compiles successfully.
  • Started the full pytest suite with:

PR checklist

  • I have read the CONTRIBUTING document.
  • The documentation is up-to-date with the changes I made (check build artifacts).
  • All tests passed, and additional code has been covered with new tests.
  • I have added the PR and Issue fix to the RELEASES.md file.

@github-actions github-actions bot added the ot.lp label Mar 31, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 31, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.87%. Comparing base (41a4d57) to head (475d179).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #804   +/-   ##
=======================================
  Coverage   96.87%   96.87%           
=======================================
  Files         113      113           
  Lines       23062    23062           
=======================================
  Hits        22342    22342           
  Misses        720      720           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant