-
Notifications
You must be signed in to change notification settings - Fork 92
Define is_copyable and is_set_by_optimize #509
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
Conversation
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 a big improvement!
docs/src/apireference.md
Outdated
|
||
* it is either set when the model is created like [`SolverName`](@ref) and | ||
[`RawSolver`](@ref), | ||
* or explicitely when the model is copied like |
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.
Typo: explicitly
docs/src/apireference.md
Outdated
|
||
* it is either set when the model is created like [`SolverName`](@ref) and | ||
[`RawSolver`](@ref), | ||
* or explicitely when the model is copied like |
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 the line break here? Does it actually exceed 80 characters?
docs/src/apireference.md
Outdated
[`RawSolver`](@ref), | ||
* or explicitely when the model is copied like | ||
[`ObjectiveSense`](@ref), | ||
* or implicitely like [`NumberOfVariables`](@ref) |
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.
Typo: implicitly
docs/src/apireference.md
Outdated
[`RawSolver`](@ref), | ||
* or explicitely when the model is copied like | ||
[`ObjectiveSense`](@ref), | ||
* or implicitely like [`NumberOfVariables`](@ref) |
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.
Another example of implicit setting is add_constraint
docs/src/apireference.md
Outdated
* or it is set to contain the result of the optimization during | ||
[`optimize!`](@ref) like [`VariablePrimal`](@ref). | ||
|
||
The following functions allows to distinguish between different some of these |
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.
"some of these different categories"
src/attributes.jl
Outdated
supports(::ModelLike, ::Union{AbstractVariableAttribute, AbstractConstraintAttribute}, ::Type{<:Index}) = false | ||
function supports(::ModelLike, attr::Union{AbstractModelAttribute, | ||
AbstractOptimizerAttribute}) | ||
@assert is_copyable(attr) |
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.
Prefer error messages over assert for checking user-facing inputs.
src/attributes.jl
Outdated
@@ -294,7 +307,9 @@ struct SolverName <: AbstractOptimizerAttribute end | |||
""" | |||
ListOfModelAttributesSet() | |||
|
|||
A model attribute for the `Vector{AbstractModelAttribute}` of all model attributes that were set to the model. | |||
A model attribute for the `Vector{AbstractModelAttribute}` of all model | |||
attributes `attr` such that `is_copyable(attr)` returns `true` that were set to |
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.
such that 1) is_copyable(attr)
returns true
and 2) the attribute was set.
Codecov Report
@@ Coverage Diff @@
## master #509 +/- ##
=========================================
+ Coverage 95.59% 95.6% +<.01%
=========================================
Files 46 46
Lines 4700 4707 +7
=========================================
+ Hits 4493 4500 +7
Misses 207 207
Continue to review full report at Codecov.
|
docs/src/apireference.md
Outdated
* or it is set to contain the result of the optimization during | ||
[`optimize!`](@ref) like [`VariablePrimal`](@ref). | ||
|
||
The following functions allows to distinguish between some of these different |
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.
"allows" -> "allow"
Closes #480