matrix_algorithms.run_matrix_algorithm#

matrix_algorithms.run_matrix_algorithm(M: ndarray, C: ndarray, start_time_algorithm: datetime, rng: numpy.random.mtrand.RandomState | numpy.random._generator.Generator, ALGORITHM_PARAMETERS: dict[str, Any]) tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray]#

Runs SM-SPSA on a transition matrix and binary matrix C.

Parameters:
  • M (np.ndarray) – The transition matrix that is optimised.

  • C (np.ndarray) – The binary adjustment matrix.

  • start_time_algorithm (datetime.datetime) – The start time of the algorithm.

  • rng (np.random.mtrand.RandomState | np.random._generator.Generator) – A pseudo-random number generator.

  • ALGORITHM_PARAMETERS (dict[str, Any]) – The algorithm parameters. The parameters NR_ITERATIONS, MAXIMISE_OBJECTIVE, EPSILON, USE_TIME_LIMIT and TIME_LIMIT_SEC are at least necessary. See main.py for parameter explanations. Note that methods that are called within this method may require more parameters. Note that NR_ITERATIONS is set in the methods of run_algorithm.py.

Returns:

  • gradient_estimates (np.ndarray) – The gradient estimate at each iteration.

  • thetas (np.ndarray) – The matrix in the unconstrained space at each iteration.

  • transition_matrices (np.ndarray) – The transition matrix in the stochastic matrix space at each iteration.

  • stationary_distributions (np.ndarray) – The stationary distribution of all nodes at each iteration.

  • objective_values (np.ndarray) – The objective value at each iteration.