common#

Common functions for kernel control algorithms.

This file contains common functions used by the kernel optimal control algorithms, and implements an LP solver to compute the probability vector \(\gamma\). This functionality is accessed via the :py:func:compute_solution function, which serves as a single entrypoint, and the unconstrained version is chosen if the constraint matrix D is None.

gym_socks.algorithms.control.common.compute_solution(C, D=None, heuristic=False)[source]#

Compute the solution to the LP.

Computes a solution to the linear program, choosing either to delegate to the unconstrained or constrained solver depending on whether D is None.

Parameters
  • C (numpy.ndarray) – Array holding values of the cost function evaluated at sample points.

  • D (Optional[numpy.ndarray]) – Array holding values of the constraint function evaluated at sample points.

  • heuristic (bool) – Whether to compute the heuristic solution.

Returns

Probability vector.

Return type

gamma