API Reference

Index

Reference

StochasticVehicleScheduling.CityType
City

Contains all the relevant information for an instance of the stochastic VSP problem.

Fields

  • width::Int: 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::Int: number of tasks to fulfill
  • tasks::Vector{Task}: tasks list (see Task), that should be ordered by start time
  • district_width::Int: width (in minutes) of each district
  • districts::Matrix{District}: districts matrix (see District), indices corresponding to their relative positions
  • random_inter_area_factor::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
StochasticVehicleScheduling.CompactInstanceType
CompactInstance{G<:AbstractGraph,M1,M2,C}

Instance of the stochastic VSP problem.

Fields

  • graph::G: graph computed from city with the create_VSP_graph(city::City) method.
  • features::Matrix{Float64}: features matrix computed from city
  • slacks
  • delays
source
StochasticVehicleScheduling.DistrictType
District

Fields

  • random_delay::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
StochasticVehicleScheduling.InstanceType
Instance{G<:AbstractGraph,M1,M2,C}

Instance of the stochastic VSP problem.

Fields

  • city::City
  • graph::G: graph computed from city with the create_VSP_graph(city::City) method.
  • features::Matrix{Float64}: features matrix computed from city
  • slacks
  • delays
source
StochasticVehicleScheduling.SolutionType
Solution

Should always be associated with an Instance.

Fields

  • value::BitVector: for each graph edge of instance, 1 if selected, else 0
  • path_value::BitMatrix: each row represents a vehicle, each column a task. 1 if task is done by the vehicle, else 0
source
StochasticVehicleScheduling.TaskType
Task

Fields

  • type::TaskType
  • start_point::Point: starting location of the task
  • end_point::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::LogNormal{Float64}: lognormal distribution modeling the task start delay
  • scenario_start_time::Vector{Float64}: size (nb_scenarios), realized delayed start times for each scenario
  • scenario_end_time::Vector{Float64}: size (nb_scenarios), realized delayed end times for each scenario
source
StochasticVehicleScheduling.compute_featuresMethod
compute_features(city::City)

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
StochasticVehicleScheduling.create_VSP_graphMethod
create_VSP_graph(city::City)

Return a MetaDiGraph computed from 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). Every (u, v) edge has a :travel_time property, corresponding to time istance between u and v.

source
StochasticVehicleScheduling.create_random_cityMethod
create_random_city(;
    αᵥ_low=default_αᵥ_low,
    αᵥ_high=default_αᵥ_high,
    first_begin_time=default_first_begin_time,
    last_begin_time=default_last_begin_time,
    district_μ=default_district_μ,
    district_σ=default_district_σ,
    task_μ=default_task_μ,
    task_σ=default_task_σ,
    city_kwargs...
)
  • Create 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
StochasticVehicleScheduling.easy_problemMethod
easy_problem(θ[; instance::AbstractInstance, model_builder])

Solves the easy problem of the learning pipeline given arcs weights θ. Note: If you have Gurobi, use grb_model as model_builder instead od cbc_model.

source
StochasticVehicleScheduling.evaluate_taskMethod
evaluate_task(
    i_task::Integer,
    instance::AbstractInstance,
    old_task_index::Integer,
    old_delay::Real,
    scenario::Int,
)

Evaluate the total delay of task i_task in scenario, knowing that current delay from task old_task_index is old_delay.

source
StochasticVehicleScheduling.generate_datasetMethod
generate_dataset(
    dataset_folder::String,
    nb_train_samples::Integer,
    nb_val_samples::Integer,
    nb_test_samples::Integer;
    random_seed=67,
    labeled=true,
    heuristic=true,
    city_kwargs,
)

Create a dataset in dataset_folder, train/validation/test samples, one file per subdataset. Also create a config file in the same location with some information.

source
StochasticVehicleScheduling.generate_samplesMethod
generate_samples(nb_samples::Integer[; heuristic=true, labeled=true, city_kwargs])

Generate nb_samples random instances with city_kwargs. If labeled, compute associated solutions for each instance: use local search if heuristic, else compute optimal solution.

source
StochasticVehicleScheduling.solve_deterministic_VSPMethod
solve_deterministic_VSP(instance::Instance; include_delays=true)

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 cbc_model.

source
StochasticVehicleScheduling.solve_scenariosMethod
solve_scenarios(instance::AbstractInstance; model_builder)

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

source
StochasticVehicleScheduling.to_arrayMethod
to_array(solution::Solution, instance::AbstractInstance)

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

source