Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
blegat committed Oct 2, 2023
1 parent 5dbd9f6 commit 6ea896c
Showing 1 changed file with 50 additions and 8 deletions.
58 changes: 50 additions & 8 deletions src/RelativeEntropy/bridges/age.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,52 @@
"""
AGEBridge{T,F,G,H} <: MOI.Bridges.Constraint.AbstractBridge
The nonnegativity of `x ≥ 0` in
```
∑ ci x^αi ≥ -c0 x^α0
```
can be reformulated as
```
∑ ci exp(αi'y) ≥ -β exp(α0'y)
```
In any case, it is shown to be equivalent to
```
∃ ν ≥ 0 s.t. D(ν, exp(1)*c) ≤ β, ∑ νi αi = α0 ∑ νi [CP16, (3)]
```
where `N(ν, λ) = ∑ νj log(νj/λj)` is the relative entropy function.
The constant `exp(1)` can also be moved out of `D` into
```
∃ ν ≥ 0 s.t. D(ν, c) - ∑ νi ≤ β, ∑ νi αi = α0 ∑ νi [MCW21, (2)]
```
The relative entropy cone in MOI is `(u, v, w)` such that `D(w, v) ≥ u`.
Therefore, we can either encode `(β, exp(1)*c, ν)` [CP16, (3)] or
`(β + ∑ νi, c, ν)` [MCW21, (2)].
In this bridge, we use the second formulation.
!!! note
A direct application of the Arithmetic-Geometric mean inequality gives
```
∃ ν ≥ 0 s.t. D(ν, exp(1)*c) ≤ -log(-β), ∑ νi αi = α0, ∑ νi = 1 [CP16, (4)]
```
which is not jointly convex in (ν, c, β).
The key to get the convex formulation [CP16, (3)] or [MCW21, (2)] instead is to
use the convex conjugacy between the exponential and the negative entropy functions [CP16, (iv)].
[CP16] Chandrasekaran, Venkat, and Parikshit Shah.
"Relative entropy relaxations for signomial optimization."
SIAM Journal on Optimization 26.2 (2016): 1147-1173.
[MCW21] Murray, Riley, Venkat Chandrasekaran, and Adam Wierman.
"Signomial and polynomial optimization via relative entropy and partial dualization."
Mathematical Programming Computation 13 (2021): 257-295.
https://arxiv.org/pdf/1907.00814.pdf
"""
struct AGEBridge{T,F,G,H} <: MOI.Bridges.Constraint.AbstractBridge
k::Int
equality_constraints::Vector{MOI.ConstraintIndex{F,MOI.EqualTo{T}}}
relative_entropy_constraint::MOI.ConstraintIndex{G,MOI.RelativeEntropyCone}
end # See https://arxiv.org/pdf/1907.00814.pdf
end

function MOI.Bridges.Constraint.bridge_constraint(
::Type{AGEBridge{T,F,G,H}},
Expand All @@ -14,19 +58,17 @@ function MOI.Bridges.Constraint.bridge_constraint(
ν = MOI.add_variables(model, m - 1)
sumν = MOI.ScalarAffineFunction(MOI.ScalarAffineTerm.(one(T), ν), zero(T))
ceq = map(1:size(set.α, 2)) do var
f = -sumν
f = zero(typeof(sumν))
j = 0
for i in 1:m
if i != set.k
if i == set.k
MA.sub_mul!!(f, convert(T, set.α[i, var]), sumν)
else
j += 1
MA.add_mul!!(f, convert(T, set.α[i, var]), ν[j])
end
end
return MOI.Utilities.normalize_and_add_constraint(
model,
f,
MOI.EqualTo(zero(T)),
)
return MOI.add_constraint(model, f, MOI.EqualTo(zero(T)))
end
scalars = MOI.Utilities.eachscalar(func)
f = MOI.Utilities.operate(
Expand Down

0 comments on commit 6ea896c

Please sign in to comment.