Skip to content
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

Rust Integration: Full Rust Integration #3

Draft
wants to merge 24 commits into
base: lowtime-rust
Choose a base branch
from

Conversation

ohjuny
Copy link
Collaborator

@ohjuny ohjuny commented Nov 9, 2024

This PR follows #1 . (And replaces #2 )
#1 : Sets up pyo3 integration and replaces calls to nx.maximum_flow with a Rust implementation.
In particular, #1 constructs and destructs a Rust-side PhillipsDessouky object every iteration, and therefore incurs interop overhead at every iteration.

This PR seeks to replace all (or most of) solver.py such that all the iterations can be performed in Rust without having to go back to Python.

TODO: more information

@ohjuny ohjuny marked this pull request as draft November 9, 2024 17:26
@ohjuny
Copy link
Collaborator Author

ohjuny commented Nov 15, 2024

(just noting down some things for myself)

Cost Model Issues
CostModel in Python is abstract base class - in Rust this is a trait. Operations have a cost model, which is generic over this trait. But pyo3 doesn't support passing in trait-bound objects. There are workarounds, in particular using Box<dyn ModelCost> where ModelCost is the trait - CostModel contains a dyn Box to ExponentialModel. But this makes the CostModel constructor weird, in that it needs to take in a dynamic type, which pyo3 doesn't support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant