InflGame.domains.rd.#

InflGame.domains.rd.multi_modal_gaussian_distribution_2D(bin_points, covariance_matrices=tensor([[[0.1000, 0.0000], [0.0000, 0.1000]], [[0.1000, 0.0000], [0.0000, 0.1000]], [[0.1000, 0.0000], [0.0000, 0.1000]]]), means=tensor([[0.0000, 0.0000], [1.0000, 0.0000], [0.5000, 0.8660]]))#

Compute a 2D multi-modal Gaussian mixture distribution for resources.

Creates a resource distribution as a weighted sum of multivariate Gaussian kernels, each with its own mean vector and covariance matrix. This enables modeling of complex spatial resource patterns in 2D domains.

The distribution is defined as:

\[R(\mathbf{b}) = \sum_{i=1}^{k} \exp\left(-\frac{1}{2}(\mathbf{b} - \boldsymbol{\mu}_i)^T \boldsymbol{\Sigma}_i^{-1} (\mathbf{b} - \boldsymbol{\mu}_i)\right)\]

where \(k\) is the number of modes, \(\boldsymbol{\mu}_i\) is the mean vector for mode \(i\), and \(\boldsymbol{\Sigma}_i\) is the covariance matrix for mode \(i\).

Parameters:
bin_pointsnp.ndarray | torch.Tensor

Points where the distribution is evaluated, shape \((N, 2)\) for \(N\) 2D coordinates.

covariance_matricestorch.Tensor, optional

Covariance matrices \(\boldsymbol{\Sigma}_i\) for each Gaussian mode, shape \((k, 2, 2)\) where \(k\) is the number of modes. By default creates 3 isotropic modes with variance 0.1.

meanstorch.Tensor, optional

Mean vectors \(\boldsymbol{\mu}_i\) for each Gaussian mode, shape \((k, 2)\). By default creates 3 modes at the vertices of an equilateral triangle.

Returns:
np.ndarray

Computed resource distribution values at the specified bin_points, shape \((N,)\).

Notes

The number of modes \(k\) is determined by the length of the means tensor. The covariance_matrices tensor must have the same number of modes.

Examples

>>> bin_points = np.random.rand(100, 2)
>>> means = torch.tensor([[0.3, 0.3], [0.7, 0.7]])
>>> covs = torch.tensor([[[0.05, 0], [0, 0.05]], [[0.08, 0], [0, 0.08]]])
>>> resources = multi_modal_gaussian_distribution_2D(bin_points, covs, means)