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

Implement mincostflow #25

Merged
merged 7 commits into from
Sep 10, 2020
Merged

Conversation

kenkoooo
Copy link
Contributor

@kenkoooo kenkoooo commented Sep 8, 2020

Port mincostflow from the AtCoder's library, resolved #21.

Questions

  • It handles Cap and Cost as the same type. Is it better to separate types?
    • => Let's keep it for now.
  • It uses Integer trait. Does it make sense?
  • We can change some variable names. Let me hear your opinion.

src/mincostflow.rs Outdated Show resolved Hide resolved
src/mincostflow.rs Outdated Show resolved Hide resolved
src/mincostflow.rs Outdated Show resolved Hide resolved
src/mincostflow.rs Show resolved Hide resolved
src/mincostflow.rs Show resolved Hide resolved
src/mincostflow.rs Outdated Show resolved Hide resolved
@MiSawa
Copy link
Contributor

MiSawa commented Sep 8, 2020

For Cap and Cost -- in theory we can use a different type for Cap, Cost and Result type where Result : From<Cap> + From<Cost>.... which can be useful for problems like this, though probably overkill for almost all other problems.

Another use case would be non-integral cost problems. Since having non-integral capacity is problematic for this algorithm, it would make sense to separate these two type params, and use Cost type for product of them.
Actually floating point types in Rust doesn't implement Ord, so..... nevermind.

@kenkoooo
Copy link
Contributor Author

kenkoooo commented Sep 9, 2020

For Cap and Cost -- in theory we can use a different type for Cap, Cost and Result type where Result : From<Cap> + From<Cost>.... which can be useful for problems like this, though probably overkill for almost all other problems.

Another use case would be non-integral cost problems. Since having non-integral capacity is problematic for this algorithm, it would make sense to separate these two type params, and use Cost type for product of them.
Actually floating point types in Rust doesn't implement Ord, so..... nevermind.

Thanks! Let's keep using a single type parameter for now.

@matsu7874 matsu7874 merged commit 0312d8d into rust-lang-ja:master Sep 10, 2020
@kenkoooo kenkoooo deleted the features/mincostflow branch September 10, 2020 17:19
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.

Implement mincostflow
4 participants