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

Branch&bound, fixes #1 #2

Merged
merged 1 commit into from
Nov 6, 2024
Merged

Branch&bound, fixes #1 #2

merged 1 commit into from
Nov 6, 2024

Conversation

Specy
Copy link
Owner

@Specy Specy commented Nov 5, 2024

Adds branch and bound to implement binary and integer variables, fixes #1

@Specy Specy requested a review from lovasoa November 5, 2024 18:22
Copy link
Collaborator

@lovasoa lovasoa left a 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.

@lovasoa
Copy link
Collaborator

lovasoa commented Nov 5, 2024

also, you may want to add a test with both integer and real variables.

@Specy
Copy link
Owner Author

Specy commented Nov 5, 2024

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?

@Specy
Copy link
Owner Author

Specy commented Nov 5, 2024

Ok i added a simple MILP test which is currently failing as it did not reach the optimal value, i'll investigate tomorrow

@Specy
Copy link
Owner Author

Specy commented Nov 5, 2024

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

@Specy
Copy link
Owner Author

Specy commented Nov 6, 2024

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

@Specy Specy merged commit 00ed76a into master Nov 6, 2024
@Specy Specy deleted the branch&bound branch November 6, 2024 10:31
continue;
}
let divergence = f64::abs(val - val.round());
if divergence > 1e-5 && divergence > max_divergence {
Copy link
Collaborator

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.

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.

add support for integer variables
2 participants