-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add coefficient_type kwarg to dual_optimizer (#168)
- Loading branch information
1 parent
208b284
commit 7d0816c
Showing
4 changed files
with
33 additions
and
3 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,24 @@ | ||
# Copyright (c) 2017: Guilherme Bodin, and contributors | ||
# | ||
# Use of this source code is governed by an MIT-style license that can be found | ||
# in the LICENSE.md file or at https://opensource.org/licenses/MIT. | ||
|
||
import Hypatia | ||
|
||
@testset "Solve problems with different coefficient_type" begin | ||
function mineig(::Type{T}) where {T} | ||
model = GenericModel{T}( | ||
Dualization.dual_optimizer( | ||
Hypatia.Optimizer{T}; | ||
coefficient_type = T, | ||
), | ||
) | ||
JuMP.set_silent(model) | ||
@variable(model, x[1:3, 1:3] in PSDCone()) | ||
@constraint(model, sum(x[i, i] for i in 1:3) == 1) | ||
@objective(model, Min, sum(x[i, i] for i in 1:3)) | ||
optimize!(model) | ||
return objective_value(model) | ||
end | ||
@test mineig(Float64) ≈ mineig(Float32) | ||
end |
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