-
Notifications
You must be signed in to change notification settings - Fork 3
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
Branch&bound, fixes #1 #2
Conversation
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.
Really cool 😎
I suggested a few changes, feel free to take what you want from them.
also, you may want to add a test with both integer and real variables. |
I wanted to add one but i wanted to use a "known" one or some that already have a solution, do you have one? |
Ok i added a simple MILP test which is currently failing as it did not reach the optimal value, i'll investigate tomorrow |
Ok pretty weird, using very large values causes unexpected results. the problem was i64::MAX causing issues, i've clamped integer values to i32 for now and it seems to work properly the problem seems to happen also when using high f64 values like f64::MAX, but it is unrelated to the integer solution I'm gonna make an issue about it |
I'm gonna merge this as that bug in #3 was already present so it's not a regression, i'm not sure how to tackle that for now so at least let's support integer variables for now. I added a failing test to track the bug for the future |
continue; | ||
} | ||
let divergence = f64::abs(val - val.round()); | ||
if divergence > 1e-5 && divergence > max_divergence { |
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.
@Specy I think you should use the EPS constant here, instead of hardcoding 1e-5.
Adds branch and bound to implement binary and integer variables, fixes #1