Newton’s method under equality constrains#

constrained_lagrangian_solver(function, x0, constraints, x_bounds=None, epsilon=0.0001, max_iter=250, keep_history=False, verbose=False)[source]#

Returns a tensor n x 1 with optimal point and history of minimization by newton_eq_const. Alias of ‘’Newton’s method under equality constrains’’ [1]

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

References

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

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

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

  • constraints (Sequence[Callable[[float | torch.Tensor], Tensor]]) – list of equality constraints

  • x_bounds (Union[Sequence[Tuple[float, float]], None, Tensor]) – bounds on x. e.g. 0 <= x[i] <= 1, then x_bounds[i] = (0, 1)

  • epsilon (float) – optimization accuracy

  • 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

>>> constrained_lagrangian_solver(lambda x: (x[0] + 0.5) ** 2 + (x[1] - 0.5) ** 2,
>>>                              torch.tensor([0.1, 0.1]),[lambda x: x[0] - 1]))
tensor([1.0540, 0.5000], dtype=torch.float64)