Stochastic Vehicle Scheduling

Public

DecisionFocusedLearningBenchmarks.StochasticVehicleScheduling.compact_linearized_mipMethod
compact_linearized_mip(
    instance::DecisionFocusedLearningBenchmarks.StochasticVehicleScheduling.Instance;
    scenario_range,
    model_builder,
    silent
) -> Any

Returns the optimal solution of the Stochastic VSP instance, by solving the associated compact MIP. Quadratic constraints are linearized using Mc Cormick linearization. Note: If you have Gurobi, use grb_model as model_builder instead of highs_model.

source
DecisionFocusedLearningBenchmarks.StochasticVehicleScheduling.compact_mipMethod
compact_mip(
    instance::DecisionFocusedLearningBenchmarks.StochasticVehicleScheduling.Instance;
    scenario_range,
    model_builder,
    silent
) -> Any

Returns the optimal solution of the Stochastic VSP instance, by solving the associated compact quadratic MIP. Note: If you have Gurobi, use grb_model as model_builder instead of highs_model.

Warning

You need to use a solver that supports quadratic constraints to use this method.

source
DecisionFocusedLearningBenchmarks.Utils.generate_datasetMethod
generate_dataset(
    benchmark::StochasticVehicleSchedulingBenchmark,
    dataset_size::Int64;
    compute_solutions,
    seed,
    rng,
    algorithm,
    store_city,
    kwargs...
) -> Any

Create a dataset of dataset_size instances for the given StochasticVehicleSchedulingBenchmark. If you want to not add label solutions in the dataset, set compute_solutions=false. By default, they will be computed using column generation. Note that computing solutions can be time-consuming, especially for large instances. You can also use instead compact_mip or compact_linearized_mip as the algorithm to compute solutions. If you want to provide a custom algorithm to compute solutions, you can pass it as the algorithm keyword argument. If algorithm takes keyword arguments, you can pass them as well directly in kwargs.... If store_city=false, the coordinates and unnecessary information about instances will not be stored in the dataset.

source
DecisionFocusedLearningBenchmarks.Utils.generate_maximizerMethod
generate_maximizer(
    bench::StochasticVehicleSchedulingBenchmark;
    model_builder
) -> DecisionFocusedLearningBenchmarks.StochasticVehicleScheduling.StochasticVechicleSchedulingMaximizer{typeof(DecisionFocusedLearningBenchmarks.Utils.highs_model)}
source

Private

DecisionFocusedLearningBenchmarks.StochasticVehicleScheduling.CityType
struct City

Data structure for a city in the vehicle scheduling problem. Contains all the relevant information to build an instance of the problem.

Fields

  • width::Int64: city width (in minutes)

  • vehicle_cost::Float64: cost of a vehicle in the objective function

  • delay_cost::Float64: cost of one minute delay in the objective function

  • nb_tasks::Int64: number of tasks to fulfill

  • tasks::Vector{DecisionFocusedLearningBenchmarks.StochasticVehicleScheduling.Task}: tasks list (see Task), that should be ordered by start time

  • district_width::Int64: idth (in minutes) of each district

  • districts::Matrix{DecisionFocusedLearningBenchmarks.StochasticVehicleScheduling.District}: districts matrix (see District), indices corresponding to their relative positions

  • random_inter_area_factor::Distributions.LogNormal{Float64}: a log-normal distribution modeling delay between districts

  • scenario_inter_area_factor::Matrix{Float64}: size (nb_scenarios, 24), each row correspond to one scenario, each column to one hour of the day

source
DecisionFocusedLearningBenchmarks.StochasticVehicleScheduling.DistrictType
struct District

Data structure for a district in the vehicle scheduling problem.

Fields

  • random_delay::Distributions.LogNormal{Float64}: log-normal distribution modeling the district delay

  • scenario_delay::Matrix{Float64}: size (nb_scenarios, 24), observed delays for each scenario and hour of the day

source
DecisionFocusedLearningBenchmarks.StochasticVehicleScheduling.InstanceType
struct Instance{CC, G<:Graphs.AbstractGraph, M1<:(AbstractMatrix), M2<:(AbstractMatrix), F, C}

Instance of the stochastic VSP problem.

Fields

  • graph::Graphs.AbstractGraph: graph computed from city with the create_VSP_graph(city::City) method

  • features::Matrix: features matrix computed from city

  • slacks::AbstractMatrix: slack matrix

  • intrinsic_delays::AbstractMatrix: intrinsic delays scenario matrix

  • vehicle_cost::Any: cost of a vehicle

  • delay_cost::Any: cost of one minute delay

  • city::Any: associated city

source
DecisionFocusedLearningBenchmarks.StochasticVehicleScheduling.TaskType
struct Task

Data structure for a task in the vehicle scheduling problem.

Fields

  • type::DecisionFocusedLearningBenchmarks.StochasticVehicleScheduling.TaskType: type of the task (depot start, job, or depot end)

  • start_point::DecisionFocusedLearningBenchmarks.StochasticVehicleScheduling.Point: starting location of the task

  • end_point::DecisionFocusedLearningBenchmarks.StochasticVehicleScheduling.Point: end location of the task

  • start_time::Float64: start time (in minutes) of the task

  • end_time::Float64: end time (in minutes) of the task

  • random_delay::Distributions.LogNormal{Float64}: lognormal distribution modeling the task start delay

  • scenario_start_time::Vector{Float64}: size (nb_scenarios), observed delayed start times for each scenario

  • scenario_end_time::Vector{Float64}: size (nb_scenarios), observed delayed end times for each scenario

source
DecisionFocusedLearningBenchmarks.StochasticVehicleScheduling._local_searchMethod
_local_search(
    solution::DecisionFocusedLearningBenchmarks.StochasticVehicleScheduling.Solution,
    instance::DecisionFocusedLearningBenchmarks.StochasticVehicleScheduling.Instance;
    nb_it
) -> Tuple{DecisionFocusedLearningBenchmarks.StochasticVehicleScheduling.Solution, Any, Vector{Int64}, Vector}

Very simple local search heuristic, using the neighborhood defined by move_one_random_task

source
DecisionFocusedLearningBenchmarks.StochasticVehicleScheduling.compute_featuresMethod
compute_features(
    city::DecisionFocusedLearningBenchmarks.StochasticVehicleScheduling.City
) -> Matrix{Float32}

Returns a matrix of features of size (20, nb_edges). For each edge, compute the following features (in the same order):

  • travel time
  • vehicle_cost if edge is connected to source, else 0
  • 9 deciles of the slack
  • cumulative probability distribution of the slack evaluated in [-100, -50, -20, -10, 0, 10, 50, 200, 500]
source
DecisionFocusedLearningBenchmarks.StochasticVehicleScheduling.create_VSP_graphMethod
create_VSP_graph(
    city::DecisionFocusedLearningBenchmarks.StochasticVehicleScheduling.City
) -> Graphs.SimpleGraphs.SimpleDiGraph{Int64}

Return the acyclic directed graph corresponding to city. Each vertex represents a task. Vertices are ordered by start time of corresponding task. There is an edge from task u to task v the (end time of u + tie distance between u and v <= start time of v).

source
DecisionFocusedLearningBenchmarks.StochasticVehicleScheduling.create_random_cityMethod
create_random_city(
;
    αᵥ_low,
    αᵥ_high,
    first_begin_time,
    last_begin_time,
    district_μ,
    district_σ,
    task_μ,
    task_σ,
    seed,
    rng,
    city_kwargs...
) -> DecisionFocusedLearningBenchmarks.StochasticVehicleScheduling.City
  • Creates a city from city_kwargs
  • Depot location at city center
  • Randomize tasks, and add two dummy tasks : one source task at time=0 from the depot, and one destination task ending at time=end at depot
  • Roll every scenario.
source
DecisionFocusedLearningBenchmarks.StochasticVehicleScheduling.solve_deterministic_VSPMethod
solve_deterministic_VSP(
    instance::DecisionFocusedLearningBenchmarks.StochasticVehicleScheduling.Instance;
    include_delays,
    model_builder,
    verbose
) -> Tuple{Union{Float64, Vector{Float64}}, Any}

Return the optimal solution of the deterministic VSP problem associated to instance. The objective function is vehicle_cost * nb_vehicles + include_delays * delay_cost * sum_of_travel_times Note: If you have Gurobi, use grb_model as model_builder instead od highs_model.

source
DecisionFocusedLearningBenchmarks.StochasticVehicleScheduling.to_arrayMethod
to_array(
    solution::DecisionFocusedLearningBenchmarks.StochasticVehicleScheduling.Solution,
    instance::DecisionFocusedLearningBenchmarks.StochasticVehicleScheduling.Instance
) -> Any

Returns a BitMatrix, with value true at each index (i, j) if corresponding edge of graph is selected in the solution

source