pyepo.data.shortestpath¶
Synthetic data for shortest path problem
Functions¶
|
Generate synthetic feature-cost pairs for the shortest path problem. |
Module Contents¶
- pyepo.data.shortestpath.genData(num_data: int, num_features: int, grid: tuple[int, int], deg: int = 1, noise_width: float = 0, seed: int = 135) tuple[numpy.ndarray, numpy.ndarray]¶
Generate synthetic feature-cost pairs for the shortest path problem.
Features are sampled from a standard multivariate Gaussian \(\mathcal{N}(0, \mathbf{I})\). A random Bernoulli(0.5) matrix \(\mathcal{B}\) maps each feature vector into the edge-cost coefficients via a polynomial of degree
deg, scaled by multiplicative uniform noise of half-widthnoise_width.- Parameters:
num_data – number of data points
num_features – dimension of features
grid – size of grid network
deg – polynomial degree of the feature-to-cost mapping
noise_width – half-width of the multiplicative uniform noise
seed – random seed (default 135 for reproducibility)
- Returns:
data features (np.ndarray), costs (np.ndarray)
- Return type: