Skip to content

Implement mincostflow#25

Merged
matsu7874 merged 7 commits into
rust-lang-ja:masterfrom
kenkoooo:features/mincostflow
Sep 10, 2020
Merged

Implement mincostflow#25
matsu7874 merged 7 commits into
rust-lang-ja:masterfrom
kenkoooo:features/mincostflow

Conversation

@kenkoooo
Copy link
Copy Markdown
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.

Comment thread src/mincostflow.rs Outdated
Comment thread src/mincostflow.rs Outdated
Comment thread src/mincostflow.rs Outdated
Comment thread src/mincostflow.rs
Comment thread src/mincostflow.rs
Comment thread src/mincostflow.rs Outdated
@MiSawa
Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread src/mincostflow.rs
Comment thread src/mincostflow.rs
@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