pyepo.data.tsp¶
Synthetic data for traveling salesman problem
Functions¶
|
Generate synthetic feature-cost pairs for the traveling salesperson problem. |
Module Contents¶
- pyepo.data.tsp.genData(num_data: int, num_features: int, num_nodes: int, deg: int = 1, noise_width: float = 0, seed: int = 135) tuple[numpy.ndarray, numpy.ndarray]¶
Generate synthetic feature-cost pairs for the traveling salesperson problem.
Edge costs combine a Euclidean component (node coordinates drawn from a mixture of a Gaussian \(\mathcal{N}(0, \mathbf{I})\) and a uniform \(\mathbf{U}(-2, 2)\) distribution) with a feature-encoded component obtained by mapping the standard-Gaussian feature vector through a random Bernoulli \(\times\) uniform matrix \(\mathcal{B}\) and a polynomial of degree
deg, scaled by multiplicative noise of half-widthnoise_width.- Parameters:
num_data – number of data points
num_features – dimension of features
num_nodes – number of nodes
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: