-
Notifications
You must be signed in to change notification settings - Fork 31
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
Rewrite callback interface #195
Conversation
@joaquimg, could you take a look? |
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 marked a few examples of some issues, but most of them appear in many other places.
Also, fix conflicts :) |
src/MOI/callbacks/MOI_heuristic.jl
Outdated
info = model.callback_table.moi_heuristic::Union{Tuple{CallbackInfo{CD}}, Nothing} | ||
|
||
if !isnothing(info) | ||
push_callback_state!(model, CS_MOI_HEURISTIC) |
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.
This is not thread-safe, right?
We should probably comment it
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.
Certainly not.
After reading the docs, I think that we shouldn't worry about that much since it only breaks if MUTEXCALLBACKS
is set to 0
. We could make this mechanism thread-safe when the mutex is off but it would take some time thinking to get things right.
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.
Note
My first attempt would be to rely on theMIPTHREADID
index to sort out each thread's context.
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.
Lets add this info somewhere?
Maybe in the optimizer struct right by the associated fields
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.
How about triggering a warning if the number of threads is greater than one and there are registered callbacks? @joaquimg
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.
shouldn't it warn if there are registered callback and MUTEXCALLBACK = 0?
dmatval, | ||
) | ||
|
||
Xpress.Lib.XPRSloadcuts( |
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.
User cut should not be local only?
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.
That lies on the second checkbox of the PR description. We are still refactoring without breaking the old API in some sense.
Implementing heuristic/lazyconstraint/usercut properly requires some redesign and even other XPRS methods might be useful then.
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.
So you agree, but you want to fix it in a second step?
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.
if that is the case, lets add a comment about it so we do not forget.
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.
The plan is to integrate our new callback coordination mechanism and then to make it follow MOI's semantics.
I'm adding the comments.
Co-authored-by: Joaquim Dias Garcia <[email protected]>
This PR aims to reorganize the callback interface for Xpress in order to: