algorithm_functions.py#

This file contains helper functions for the SM-SPSA algorithm, such as methods to calculate a stationary distribution or perform the transformation.

generate_centred_mass_initial_matrix(M, C)

Applies the centred mass heuristic to a matrix.

hyperlink_cost_function(x)

Calculates the hyperlink cost function for a transition probability or matrix.

calculate_objective_value(stat_dist, ...)

Calculates the objective function value.

stationary_distribution(Matrix)

Calculates the stationary distribution of a transition matrix.

inverse_logistic_transformation_matrix(...)

Calculates the inverse logistic transformation of a matrix.

logistic_transformation(matrix)

Applies the logistic function to a matrix.

normalisation(matrix)

Normalises a matrix so that the row sums are equal to 1.

scale_matrix(matrix, initial_trans_matrix, C)

Scales a matrix.

logistic_simplex_transformation(matrix, ...)

Performs the complete transformation yielding a transition matrix.