Skip to content

Commit

Permalink
Merge d3b7b37 into 34c91f9
Browse files Browse the repository at this point in the history
  • Loading branch information
blegat committed Oct 4, 2018
2 parents 34c91f9 + d3b7b37 commit ae5e4e6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/variables.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ struct VariableRef <: AbstractVariableRef
index::MOI.VariableIndex
end

# owner_model should be implemented by all `AbstractVariableRef`.
# owner_model should be implemented by an `AbstractVariableRef` if the field
# name is not `model`.
"""
owner_model(v::AbstractVariableRef)
Expand All @@ -115,9 +116,7 @@ julia> x = @variable(model)
julia> JuMP.owner_model(x) === model
true
"""
function owner_model end

owner_model(v::VariableRef) = v.model
owner_model(v::AbstractVariableRef) = v.model

Base.iszero(::VariableRef) = false
Base.copy(v::VariableRef) = VariableRef(v.model, v.index)
Expand Down
1 change: 0 additions & 1 deletion test/JuMPExtension.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ Base.:(==)(v::MyVariableRef, w::MyVariableRef) = v.model === w.model && v.idx ==
if VERSION >= v"0.7-"
Base.broadcastable(v::MyVariableRef) = Ref(v)
end
JuMP.owner_model(v::MyVariableRef) = v.model
JuMP.isequal_canonical(v::MyVariableRef, w::MyVariableRef) = v == w
JuMP.variable_type(::MyModel) = MyVariableRef
function JuMP.add_variable(m::MyModel, v::JuMP.AbstractVariable, name::String="")
Expand Down

0 comments on commit ae5e4e6

Please sign in to comment.