Skip to content

Implement twosat #43

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

Merged
merged 10 commits into from
Sep 13, 2020
Merged

Implement twosat #43

merged 10 commits into from
Sep 13, 2020

Conversation

manta1130
Copy link
Contributor

@manta1130 manta1130 commented Sep 11, 2020

resolved #40

@manta1130
Copy link
Contributor Author

Verified by this submit

@manta1130 manta1130 marked this pull request as ready for review September 12, 2020 00:13
@manta1130 manta1130 requested a review from qryxip September 12, 2020 06:21
src/twosat.rs Outdated
pub fn add_clause(&mut self, i: usize, f: bool, j: usize, g: bool) {
assert!(i < self.n && j < self.n);
self.scc
.add_edge(2 * i + if f { 0 } else { 1 }, 2 * j + if g { 1 } else { 0 });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Rust we have <{integer} as From<bool>> but I don't know we should use this...

assert_eq!(0, u32::from(false));
assert_eq!(1, u32::from(true));

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think using explicit type conversion is more simpler than using if expression but I'm not sure if this way is common usage.

Copy link
Collaborator

@koba-e964 koba-e964 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a comment on testing.

Copy link
Collaborator

@TonalidadeHidrica TonalidadeHidrica left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically LGTM

@manta1130
Copy link
Contributor Author

I've fixed based on reviews.

@qryxip qryxip merged commit f264623 into rust-lang-ja:master Sep 13, 2020
@manta1130 manta1130 deleted the feature/twosat branch September 13, 2020 13:23
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 twosat
4 participants