Optimalisatie

Argmax, argmin, beperkingen, Lagrangiaan en KKT-voorwaarden.

Optimization symbols in LaTeX: argmax, argmin and constraints

Optimization notation in LaTeX centres on \min, \max and their arg versions. \min_{x} and \max_{x} are built in and put the variable under the operator in display math, but there is no built-in \argmax: write \operatorname*{arg\,max}_x or declare \argmax once with \DeclareMathOperator* from amsmath. Constraints follow \text{s.t.}, the Lagrangian is \mathcal{L}(x, \lambda), the optimum is x^*, and semidefinite constraints use \succeq 0. The table lists the optimization symbols people use most, with the package each one needs; the full list follows below.

Quick reference: objectives, constraints and optimality

SymbolCommandUsePackageCopy
arg max⁡xf(x)\operatorname*{arg\,max}_{x} f(x)
\operatorname*{arg\,max}_{x} f(x)Argmax with the variable underneathamsmath
arg min⁡xf(x)\operatorname*{arg\,min}_{x} f(x)
\operatorname*{arg\,min}_{x} f(x)Argmin with the variable underneathamsmath
min⁡x∈Xf(x)\min_{x \in \mathcal{X}} f(x)
\min_{x \in \mathcal{X}} f(x)Minimise over a setbuilt in
max⁡xf(x)\max_{x} f(x)
\max_{x} f(x)Maximisebuilt in
s.t.\text{s.t.}
\text{s.t.}Subject toamsmath
gi(x)≤0g_i(x) \leq 0
g_i(x) \leq 0Inequality constraintbuilt in
hj(x)=0h_j(x) = 0
h_j(x) = 0Equality constraintbuilt in
L(x,λ)\mathcal{L}(x, \lambda)
\mathcal{L}(x, \lambda)Lagrangianbuilt in
∇f(x∗)=0\nabla f(x^*) = 0
\nabla f(x^*) = 0First-order optimality conditionbuilt in
∇2f(x)\nabla^2 f(x)
\nabla^2 f(x)Hessianbuilt in
X⪰0X \succeq 0
X \succeq 0Positive semidefinitebuilt in
λi≥0\lambda_i \geq 0
\lambda_i \geq 0Dual variables (multipliers)built in

Writing a constrained problem

A full problem lines up neatly in an aligned environment from amsmath; the optidef package offers ready-made mini and maxi environments if you write many of them:

\[
\begin{aligned}
\min_{x \in \mathbb{R}^n} \quad & f(x) \\
\text{s.t.} \quad & g_i(x) \leq 0, \quad i = 1, \dots, m \\
& h_j(x) = 0, \quad j = 1, \dots, p
\end{aligned}
\]

Frequently asked questions about optimization in LaTeX

How do I write argmax in LaTeX?
Write \operatorname*{arg\,max}_{x} f(x) with amsmath; the star puts x under the operator in display math. To reuse it, add \DeclareMathOperator*{\argmax}{arg\,max} to the preamble and write \argmax_x f(x). \arg\max also prints arg max, but its subscript attaches only to max.
How do I write an optimization problem with constraints in LaTeX?
Put the objective and constraints in an aligned environment: \min_{x} \quad & f(x) \\ \text{s.t.} \quad & g(x) \leq 0. The optidef package provides mini and maxi environments that align the objective and constraints for you.
How do I write subject to in LaTeX?
Use \text{s.t.} or \text{subject to} from amsmath so the words are set in upright text with normal spacing. Writing s.t. directly in math mode prints italic variables s and t.
arg⁡max⁡\arg\max

Argmax

\arg\max
arg⁡min⁡\arg\min

Argmin

\arg\min
arg⁡max⁡x\arg\max_{x}

Argmax Subscript

\arg\max_{x}
arg⁡min⁡x\arg\min_{x}

Argmin Subscript

\arg\min_{x}
min⁡x\min_{x}

Minimize

\min_{x}
max⁡x\max_{x}

Maximize

\max_{x}
s.t.\text{s.t.}

Subject To

\text{s.t.}
g(x)≤0g(x) \leq 0

Constraint

g(x) \leq 0
h(x)=0h(x) = 0
L(x,λ)\mathcal{L}(x, \lambda)

Lagrangian

\mathcal{L}(x, \lambda)
λ\lambda
∇f(x)\nabla f(x)

Gradient

\nabla f(x)
∇2f(x)\nabla^2 f(x)

Hessian

\nabla^2 f(x)
x∗x^*
X\mathcal{X}

Feasible Set

\mathcal{X}
f(x)f(x)
μ\mu
∇f+λ∇g=0\nabla f + \lambda \nabla g = 0

KKT Conditions

\nabla f + \lambda \nabla g = 0
C\mathcal{C}

Convex Set

\mathcal{C}
≻0\succ 0
⪰0\succeq 0