Skip to content

Commit

Permalink
match neg(x) docs definition (#277)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomerarnon authored and ararslan committed Mar 22, 2019
1 parent 3fb5415 commit 7f11002
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/atoms/lp_cone/min.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@ end
min(x::AbstractExpr, y::AbstractExpr) = MinAtom(x, y)
min(x::AbstractExpr, y::Value) = min(x, Constant(y))
min(x::Value, y::AbstractExpr) = min(Constant(x), y)
neg(x::AbstractExpr) = min(x, Constant(0, Negative()))
neg(x::AbstractExpr) = max(-x, Constant(0, Positive()))
4 changes: 2 additions & 2 deletions test/test_lp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@

@testset "neg atom" begin
x = Variable(3)
p = minimize(1, [x >= -2, x <= -2, neg(x) >= -3])
p = minimize(1, [x >= -2, x <= -2, neg(x) <= 3])
@test vexity(p) == ConvexVexity()
solve!(p, solver)
@test p.optval 1 atol=TOL
@test evaluate(sum(neg(x))) -6 atol=TOL
@test evaluate(sum(neg(x))) 6 atol=TOL
end

@testset "sumlargest atom" begin
Expand Down

0 comments on commit 7f11002

Please sign in to comment.