Wikunia / Bonobo.jl

A general branch and bound framework
https://wikunia.github.io/Bonobo.jl/dev
MIT License
31 stars 2 forks source link

Return incumbent solution #43

Closed dhendryc closed 2 years ago

dhendryc commented 2 years ago

Currently the first of the collect solutions is returned. That isn't necessarily the correct one, though.

matbesancon commented 2 years ago

ping @Wikunia

Wikunia commented 2 years ago

It should be due to https://github.com/Wikunia/Bonobo.jl/blob/main/src/Bonobo.jl#L291 do you have an example where this isn't the case?

dhendryc commented 2 years ago

Interesting... When is this called?

Yes, I have an example there that does not work. I don't know if I can create a minimal working example though.

matbesancon commented 2 years ago

it seems like it could not be the case in the callback for instance?

dhendryc commented 2 years ago

No, the sort_solutions! is called after we exit the loop in optimize! . That's fine.

But you sort with :max sense. Should that depend on the problem sense?

In our case, we want the minimal solution.

Wikunia commented 2 years ago

I sort by reverse sense == :Max as internally everything is for minimization problems. @matbesancon yes for callbacks one would need to call something else though I'm not sure whether it makes sense to call result in that callback.

dhendryc commented 2 years ago

Yes, you are right. It was an issue on our side. The callback is called before sort_solutions!. Fixed it!