Skip to content

Commit

Permalink
Fix undefined variable error in zero(Var), one(Var)
Browse files Browse the repository at this point in the history
  • Loading branch information
IainNZ committed Jul 29, 2015
1 parent 463fed8 commit 2a8eb15
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/JuMP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,9 @@ end
getCategory(v::Variable) = v.m.colCat[v.col]

Base.zero(::Type{Variable}) = AffExpr(Variable[],Float64[],0.0)
Base.zero(::Variable) = zero(typeof(v))
Base.zero(::Variable) = zero(Variable)
Base.one(::Type{Variable}) = AffExpr(Variable[],Float64[],1.0)
Base.one(::Variable) = one(typeof(v))
Base.one(::Variable) = one(Variable)

verify_ownership(m::Model, vec::Vector{Variable}) = all(v->isequal(v.m,m), vec)

Expand Down
2 changes: 2 additions & 0 deletions test/variable.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ facts("[variable] constructors") do
d = Dict()
@defVar(mcon, d["bar"][1:10] == 1)
@fact getValue(d["bar"][1]) --> 1
@fact typeof(zero(nobounds)) --> AffExpr
@fact typeof(one(nobounds)) --> AffExpr
end

facts("[variable] get and set bounds") do
Expand Down

0 comments on commit 2a8eb15

Please sign in to comment.