|
73 | 73 | """ |
74 | 74 | $TYPEDSIGNATURES |
75 | 75 |
|
76 | | -Generate a sample for the given `StochasticVehicleSchedulingBenchmark`. |
77 | | -If you want to not add label solutions in the sample, set `compute_solutions=false`. |
78 | | -By default, they will be computed using column generation. |
79 | | -Note that computing solutions can be time-consuming, especially for large instances. |
80 | | -You can also use instead `compact_mip` or `compact_linearized_mip` as the algorithm to compute solutions. |
81 | | -If you want to provide a custom algorithm to compute solutions, you can pass it as the `algorithm` keyword argument. |
82 | | -If `algorithm` takes keyword arguments, you can pass them as well directly in `kwargs...`. |
83 | | -If `store_city=false`, the coordinates and unnecessary information about instances will not be stored in the sample. |
84 | | -""" |
85 | | -function Utils.generate_sample( |
| 76 | +Generate an unlabeled instance for the given `StochasticVehicleSchedulingBenchmark`. |
| 77 | +Returns a [`DataSample`](@ref) with features `x` and `instance` set, but `y=nothing`. |
| 78 | +
|
| 79 | +To obtain labeled samples, pass a `target_policy` to [`generate_dataset`](@ref): |
| 80 | +
|
| 81 | +```julia |
| 82 | +policy = sample -> DataSample(; sample.context..., x=sample.x, |
| 83 | + y=column_generation_algorithm(sample.instance)) |
| 84 | +dataset = generate_dataset(benchmark, N; target_policy=policy) |
| 85 | +``` |
| 86 | +
|
| 87 | +If `store_city=false`, coordinates and city information are not stored in the instance. |
| 88 | +""" |
| 89 | +function Utils.generate_instance( |
86 | 90 | benchmark::StochasticVehicleSchedulingBenchmark, |
87 | 91 | rng::AbstractRNG; |
88 | 92 | store_city=true, |
89 | | - compute_solutions=true, |
90 | | - algorithm=column_generation_algorithm, |
91 | 93 | kwargs..., |
92 | 94 | ) |
93 | 95 | (; nb_tasks, nb_scenarios) = benchmark |
94 | 96 | instance = Instance(; nb_tasks, nb_scenarios, rng, store_city) |
95 | 97 | x = get_features(instance) |
96 | | - y_true = if compute_solutions |
97 | | - algorithm(instance; kwargs...) |
98 | | - else |
99 | | - nothing |
100 | | - end |
101 | | - return DataSample(; x, instance, y=y_true) |
| 98 | + return DataSample(; x, instance) |
102 | 99 | end |
103 | 100 |
|
104 | 101 | """ |
|
0 commit comments