On this page:
<require>
<provide>
<matrix>
<solve>
<run-example>
<*>

3.4 Exponential cone🔗ℹ

The exponential cone is the closure of {(x, y, z) : y·e^(x/y) ≤ z, y > 0}. It is the building block for problems with logarithms and exponentials (see Maximum entropy). As a minimal demonstration we solve

minimize z
subject to (x, y, z) ∈ K_exp, x = 1, y = 1

With x = y = 1 the cone forces z ≥ e¹, so the optimum is z = e ≈ 2.71828.

(require scs)

(provide run-example)

Layout.

As with the SOC example, the equality rows (x = 1, y = 1) come first as the zero cone, then an A = −I block drops the slack (x, y, z) into the exponential cone:

(define A
  (scs:matrix 5 3
 
               1   0   0    ; x = 1 (zero cone)
               0   1   0    ; y = 1
              -1   0   0    ; exp-cone block: s = (x, y, z)
               0  -1   0
               0   0  -1))

#:exp-primal is the count of consecutive exponential-cone triples (one here).

(solve #:A A
       #:b #(1.0 1.0 0.0 0.0 0.0)
       #:c #(0.0 0.0 1.0)
       #:cone (make-cone #:zero 2 #:exp-primal 1)
       #:settings (make-settings #:eps-abs 1e-9 #:eps-rel 1e-9))

(define (run-example)
  <matrix>
  <solve>)

Running it.

(vector-ref (scs-result-x (run-example)) 2)   ; ~ 2.71828 = e

<*> ::=