-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix multiply divide's treatment of ConstVexity() variables * Add test * Move test, add test for 228 * remove extra newline
- Loading branch information
1 parent
6bccf6a
commit 7858cec
Showing
3 changed files
with
40 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
@testset "Constant variables: $solver" for solver in solvers | ||
|
||
@testset "Issue #166" begin | ||
# Issue #166 | ||
α = Variable(5) | ||
fix!(α, ones(5,1)) | ||
|
||
# has const vexity, but not at the head | ||
c = (rand(5,5) * α) * ones(1,5) | ||
|
||
β = Variable(5) | ||
β.value = ones(5) | ||
|
||
problem = minimize(sum(c * β), [β >= 0]) | ||
solve!(problem, solver) | ||
@test problem.optval ≈ evaluate(sum(c * β)) atol=TOL | ||
@test problem.optval ≈ 0.0 atol=TOL | ||
@test β.value ≈ zeros(5) atol=TOL | ||
end | ||
|
||
@testset "Issue #228" begin | ||
x = Variable(2) | ||
y = Variable(2) | ||
fix!(x, [1 1]') | ||
prob = minimize(y'*(x+[2 2]'), [y>=0]) | ||
solve!(prob, solver) | ||
@test prob.optval ≈ 0.0 atol = TOL | ||
|
||
prob = minimize(x'*y, [y>=0]) | ||
solve!(prob, solver) | ||
@test prob.optval ≈ 0.0 atol = TOL | ||
end | ||
|
||
|
||
end |