Log Barrier method#

log_barrier_solver(function, x0, inequality_constraints, epsilon=1e-05, max_iter=1000, keep_history=False, verbose=False)[source]#

Returns optimal point of optimization with inequality constraints by Log Barrier method [1]

References

\(\rule{125mm}{0.2pt} \\\)

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

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

  • epsilon (float) – optimization accuracy

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

  • max_iter (int) – maximum number of iterations

  • keep_history (bool) – flag of return history

  • verbose (bool) – flag of printing iteration logs

Returns:

tuple with point and history.

Return type:

Tuple[Tensor, HistoryGD]

Examples

Example for \(f(x, y) = (x + 0.5)^2 + (y - 0.5)^2, \quad 0 \le x \le 1, 0 \le y \le 1\)

>>> log_barrier_solver(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]])
tensor([0.0032, 0.5000], dtype=torch.float64)