Primal-dual algorithm#

primal_dual_interior(function, x0, inequality_constraints, mu=0.0001, epsilon=1e-12, alpha=0.1, max_iter=200, verbose=False, keep_history=False)[source]#

Returns point and history of minimization. [1]

AIM: minimize \(\ f(x)\) subject to \(\ c(x) \geqslant 0\); c from inequality_constraints

\(\ B(x,\mu) = f(x) - \mu \sum_{i=1}^m \log(c_i(x)) \rightarrow \min\)

Here \(\mu\) is a small positive scalar, \(\mu \rightarrow 0\)

Parameters:
  • function (Callable[[Tensor], Tensor]) – callable that depends on the first positional argument

  • x0 (Tensor) – some specific point x(Torch tensor)

  • inequality_constraints (Sequence[Callable[[Tensor], Tensor]]) – \(\mathcal{I}\) is set of inequality functions

  • mu (float) – is a small positive scalar, sometimes called the “barrier parameter”

  • epsilon (float) – optimization accuracy

  • alpha (float) – step length

  • max_iter (int) – maximum number of iterations

  • verbose (bool) – flag of printing iteration logs

  • keep_history (bool) – flag of return history

Returns:

tuple with point and history.

Raises:

ArithmeticError – if x0 is not in trust region.

Return type:

Tuple[Tensor, HistoryGD]

Reference

Examples

>>> primal_dual_interior(lambda x: (x[0] + 0.5) ** 2 + (x[1] - 0.5) ** 2, torch.tensor([0.9, 0.1]),
>>>                    [lambda x: x[0], lambda x: 1 - x[0], lambda x: x[1], lambda x: 1 - x[1]])[0]
tensor([1.9910e-04, 5.0000e-01], dtype=torch.float64)