-
Notifications
You must be signed in to change notification settings - Fork 35
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
adding possibility to set solver options for MOI constructor #81
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,15 @@ const CbcCI = CbcCInterface | |
|
||
mutable struct Optimizer <: MOI.AbstractOptimizer | ||
inner::CbcModel | ||
Optimizer() = new(CbcModel()) # Initializes with an empty model | ||
Optimizer(::Nothing) = new(CbcModel()) # Initializes with an empty model | ||
end | ||
|
||
function Optimizer(;kwargs...) | ||
model = Optimizer(nothing) | ||
for (name,value) in kwargs | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Formatting nit: |
||
setParameter(model.inner, string(name), string(value)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens if an invalid option name is passed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cbc ignores unknown names There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add a comment here about that? |
||
end | ||
return model | ||
end | ||
|
||
struct CbcModelFormat | ||
|
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.
Why is the
::Nothing
needed?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.
To differentiate the default constructor to the one with kwargs.. I took CPLEX.jl example. Apparently I cannot define a default constructor that takes kwargs.
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.
But then tests fail for julia 0.6
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.
Could you remove the inner constructor?
Then it should be valid to call
Optimizer(CbcModel())
from the outer constructor that takes keyword arguments.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.
Yes, you are right. I did it