-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
913d0b7
commit 5470031
Showing
4 changed files
with
48 additions
and
0 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,30 @@ | ||
#= | ||
maximize likelihood of d observations at discrete points appearing with random | ||
frequencies, subject to probability vector not being too far from a uniform | ||
prior | ||
=# | ||
|
||
struct DiscreteMaxLikelihood{T <: Real} <: ExampleInstanceJuMP{T} | ||
d::Int | ||
end | ||
|
||
function build(inst::DiscreteMaxLikelihood{T}) where {T <: Float64} | ||
d = inst.d | ||
@assert d >= 2 | ||
freq = rand(1:(2 * d), d) | ||
|
||
model = JuMP.Model() | ||
JuMP.@variables(model, begin | ||
p[1:d] >= 0 | ||
prodp | ||
end) | ||
JuMP.@constraints(model, begin | ||
vcat(prodp, p) in Hypatia.HypoPowerMeanCone{T}(freq / sum(freq)) | ||
vcat(inv(d), inv(d), p) in Hypatia.EpiPerSepSpectralCone{T}( | ||
Cones.NegEntropySSF(), Cones.VectorCSqr{T}, d) | ||
sum(p) == 1 | ||
end) | ||
JuMP.@objective(model, Max, prodp) | ||
|
||
return model | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
insts = Dict() | ||
insts["minimal"] = [ | ||
((2,),), | ||
] | ||
insts["fast"] = [ | ||
((10,),), | ||
((100,),), | ||
((1000,),), | ||
] | ||
insts["various"] = [ | ||
((2500,),), | ||
((5000,),), | ||
((10000,),), | ||
] | ||
return (DiscreteMaxLikelihood, insts) |