-
-
Notifications
You must be signed in to change notification settings - Fork 399
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
Fixes for copy(::Model) #491
Conversation
@@ -214,6 +230,19 @@ function Base.copy(source::Model) | |||
return dest | |||
end | |||
|
|||
# Copy methods that I'm not sure where else to put |
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'd just put them in with the Variable section
Related style of code I have in JuMPeR: Kinda funny that we had the variable copy-to-new-model code in JuMP but not this PR. |
I'm kind of tempted to turn of OS X travis until we get Homebrew figured out... |
dest.colLower = source.colLower[:] | ||
dest.colUpper = source.colUpper[:] | ||
dest.colCat = source.colCat[:] | ||
|
||
# callbacks and hooks | ||
dest.callbacks = copy(source.callbacks) |
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.
Is it safe to copy callbacks? They refer to variables from the old model.
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.
Since callbacks are wrapped in types, not plain functions, I think this will result in a no method error, except if a user explicitly defines a copy method for their custom callback.
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.
Err, guess not. I'll just make this an error if callbacks are present.
ref #490