|
1 | | -# SPDX-FileCopyrightText: Copyright (c) 2021-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # noqa |
| 1 | +# SPDX-FileCopyrightText: Copyright (c) 2021-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. |
2 | 2 | # SPDX-License-Identifier: Apache-2.0 |
3 | 3 |
|
4 | 4 |
|
@@ -35,15 +35,27 @@ class DatasetDistribution(IntEnum): |
35 | 35 | RANDOM_CLUSTERED = dataset_distribution_t.RANDOM_CLUSTERED |
36 | 36 |
|
37 | 37 |
|
38 | | -def generate_dataset(locations=100, asymmetric=True, min_demand=cudf.Series(), |
39 | | - max_demand=cudf.Series(), min_capacities=cudf.Series(), |
40 | | - max_capacities=cudf.Series(), min_service_time=0, |
| 38 | +def generate_dataset(locations=100, asymmetric=True, min_demand=None, |
| 39 | + max_demand=None, min_capacities=None, |
| 40 | + max_capacities=None, min_service_time=0, |
41 | 41 | max_service_time=0, tw_tightness=0.0, |
42 | 42 | drop_return_trips=0.0, shifts=1, |
43 | 43 | n_vehicle_types=1, n_matrix_types=1, |
44 | 44 | distribution=DatasetDistribution.CLUSTERED, |
45 | 45 | center_box=None, seed=0): |
46 | 46 |
|
| 47 | + # Default to empty device series here rather than in the signature: |
| 48 | + # a cudf.Series() default is constructed at import time and needs a GPU, |
| 49 | + # which would make importing this module fail on a GPU-less host. |
| 50 | + if min_demand is None: |
| 51 | + min_demand = cudf.Series() |
| 52 | + if max_demand is None: |
| 53 | + max_demand = cudf.Series() |
| 54 | + if min_capacities is None: |
| 55 | + min_capacities = cudf.Series() |
| 56 | + if max_capacities is None: |
| 57 | + max_capacities = cudf.Series() |
| 58 | + |
47 | 59 | cdef unique_ptr[handle_t] handle_ptr |
48 | 60 | handle_ptr.reset(new handle_t()) |
49 | 61 | handle_ = handle_ptr.get() |
|
0 commit comments