-
Notifications
You must be signed in to change notification settings - Fork 29
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
Implement twosat #43
Conversation
Verified by this submit |
68e5d1d
to
c0862e8
Compare
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 }); |
There was a problem hiding this comment.
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));
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically LGTM
I've fixed based on reviews. |
This reverts commit 209a624.
resolved #40