Skip to content

Stochastic vehicle scheduling #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 37 commits into from
Mar 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
7cf4505
start moving StochasticVehicle scheduling in this package
BatyLeo Nov 7, 2024
c2feb23
instance data structure
BatyLeo Nov 8, 2024
6e5cb75
use an rng and seed for city generation
BatyLeo Nov 28, 2024
649c94e
implement Instance
BatyLeo Nov 28, 2024
a232588
mip algorithms
BatyLeo Nov 28, 2024
507ff4f
fix bugs and add column generation
BatyLeo Nov 28, 2024
b94e4bb
Fix Aqua tests
BatyLeo Nov 28, 2024
64224bb
fix doc
BatyLeo Nov 28, 2024
f451364
bugfix
BatyLeo Dec 5, 2024
0fcd98f
maximizer, statistical model and tests
BatyLeo Dec 5, 2024
f1aefe1
update compat
BatyLeo Dec 5, 2024
d7c563a
update compat
BatyLeo Dec 5, 2024
91482b8
fix tests
BatyLeo Dec 5, 2024
07d00ab
option to restrict scenarios
BatyLeo Dec 5, 2024
357f31c
fix
BatyLeo Dec 17, 2024
38923a2
Add the option to compute solutions on generate dataset
BatyLeo Dec 17, 2024
5d06cec
cleanup doc
BatyLeo Dec 17, 2024
31a6f9e
close gap option in column generation
BatyLeo Dec 17, 2024
12bfef0
update docstrings
BatyLeo Dec 19, 2024
23c41b3
Merge branch 'main' into StoVSP
BatyLeo Dec 20, 2024
d1c4cd4
up
BatyLeo Dec 20, 2024
7e26cc0
Merge branch 'main' into StoVSP
BatyLeo Dec 23, 2024
e117b38
plot instance and plot solution
BatyLeo Dec 24, 2024
53eca77
fix tests
BatyLeo Feb 20, 2025
0573902
cleanup
BatyLeo Feb 24, 2025
8c98324
Improve interface
BatyLeo Feb 25, 2025
e17355a
Merge branch 'update-interface' into StoVSP
BatyLeo Feb 25, 2025
b3505c2
bugfix
BatyLeo Feb 25, 2025
be418bd
update plotting methods
BatyLeo Feb 25, 2025
33bc086
add local search
BatyLeo Feb 25, 2025
b89854f
fix tests
BatyLeo Feb 25, 2025
90a0e90
fix tests
BatyLeo Mar 3, 2025
d81e625
More tests and bugfix
BatyLeo Mar 3, 2025
78e50d8
wip
BatyLeo Mar 3, 2025
4cbcbc2
bug fix and update utils
BatyLeo Mar 4, 2025
44afabe
percentage option in gap method
BatyLeo Mar 4, 2025
f0f14b2
improve compute_gap method
BatyLeo Mar 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/docs/src/index.md
data
scripts
*heuristic_algorithms
.DS_Store

# Files generated by invoking Julia with --code-coverage
Expand Down
19 changes: 14 additions & 5 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,51 @@ authors = ["Members of JuliaDecisionFocusedLearning"]
version = "0.1.0"

[deps]
ConstrainedShortestPaths = "b3798467-87dc-4d99-943d-35a1bd39e395"
DataDeps = "124859b0-ceae-595e-8997-d05f6a7a8dfe"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c"
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
HiGHS = "87dc4568-4c63-4d18-b0c0-bb2238e4078b"
Images = "916415d5-f1e6-5110-898d-aaa5f9f070e0"
InferOpt = "4846b161-c94e-4150-8dac-c7ae193c601f"
Ipopt = "b6b21f68-93f8-5de0-b562-5493be1d77c9"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Metalhead = "dbeba491-748d-5e0e-a39e-b530a07fa0cc"
NPZ = "15e1cf62-19b3-5cfa-8e77-841668bca605"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
SCIP = "82193955-e24f-5292-bf16-6f2c5261a85f"
SimpleWeightedGraphs = "47aef6b3-ad0c-573a-a1e2-d07658019622"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"

[compat]
ConstrainedShortestPaths = "0.6.0"
DataDeps = "0.7"
Distributions = "0.25"
DocStringExtensions = "0.9"
Flux = "0.14"
Flux = "0.16"
Graphs = "1.11"
HiGHS = "1.9"
Images = "0.26"
InferOpt = "0.6"
Images = "0.26.1"
Ipopt = "1.6"
JuMP = "1.22"
LinearAlgebra = "1"
Metalhead = "0.9"
Metalhead = "0.9.4"
NPZ = "0.4"
Plots = "1"
Printf = "1.11.0"
Random = "1"
Requires = "1.3.0"
SimpleWeightedGraphs = "1.4"
SparseArrays = "1"
Statistics = "1.11.1"
StatsBase = "0.34.4"
julia = "1.6"

[extras]
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ Currently, this package provides the following benchmark problems (many more to
- `FixedSizeShortestPathBenchmark`: shortest path problem with on a graph with fixed size.
- `WarcraftBenchmark`: shortest path problem on image maps
- `PortfolioOptimizationBenchmark`: portfolio optimization problem.
- `StochasticVehicleSchedulingBenchmark`: stochastic vehicle scheduling problem.

See the [documentation](https://JuliaDecisionFocusedLearning.github.io/DecisionFocusedLearningBenchmarks.jl/stable/) for more details.
8 changes: 5 additions & 3 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ cp(joinpath(@__DIR__, "..", "README.md"), joinpath(@__DIR__, "src", "index.md");
md_dir = joinpath(@__DIR__, "src")
tutorial_dir = joinpath(@__DIR__, "src", "tutorials")
benchmarks_dir = joinpath(@__DIR__, "src", "benchmarks")
api_dir = joinpath(@__DIR__, "src", "api")

api_files = map(x -> joinpath("api", x), readdir(api_dir))
tutorial_files = readdir(tutorial_dir)
md_tutorial_files = [split(file, ".")[1] * ".md" for file in tutorial_files]
benchmark_files = readdir(benchmarks_dir)
md_benchmark_files = [split(file, ".")[1] * ".md" for file in benchmark_files]

include_tutorial = true
include_tutorial = false

if include_tutorial
for file in tutorial_files
Expand All @@ -35,9 +37,9 @@ makedocs(;
"benchmarks/fixed_size_shortest_path.md",
"benchmarks/warcraft.md",
"benchmarks/portfolio_optimization.md",
"benchmarks/vsp.md",
],
"API reference" =>
["api/interface.md", "api/decision_focused.md", "api/warcraft.md"],
"API reference" => api_files,
],
)

Expand Down
File renamed without changes.
15 changes: 0 additions & 15 deletions docs/src/api/decision_focused.md

This file was deleted.

15 changes: 15 additions & 0 deletions docs/src/api/fixed_shortest_path.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Fixed-size shortest path

## Public

```@autodocs
Modules = [DecisionFocusedLearningBenchmarks.FixedSizeShortestPath]
Private = false
```

## Private

```@autodocs
Modules = [DecisionFocusedLearningBenchmarks.FixedSizeShortestPath]
Public = false
```
15 changes: 15 additions & 0 deletions docs/src/api/portfolio_optimization.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Subset selection

## Public

```@autodocs
Modules = [DecisionFocusedLearningBenchmarks.PortfolioOptimization]
Private = false
```

## Private

```@autodocs
Modules = [DecisionFocusedLearningBenchmarks.PortfolioOptimization]
Public = false
```
15 changes: 15 additions & 0 deletions docs/src/api/subset_selection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Subset selection

## Public

```@autodocs
Modules = [DecisionFocusedLearningBenchmarks.SubsetSelection]
Private = false
```

## Private

```@autodocs
Modules = [DecisionFocusedLearningBenchmarks.SubsetSelection]
Public = false
```
15 changes: 15 additions & 0 deletions docs/src/api/vsp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Stochastic Vehicle Scheduling

## Public

```@autodocs
Modules = [DecisionFocusedLearningBenchmarks.StochasticVehicleScheduling]
Private = false
```

## Private

```@autodocs
Modules = [DecisionFocusedLearningBenchmarks.StochasticVehicleScheduling]
Public = false
```
3 changes: 3 additions & 0 deletions docs/src/benchmarks/vsp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Stochastic Vehicle Scheduling

[`StochasticVehicleSchedulingBenchmark`](@ref).
16 changes: 12 additions & 4 deletions src/DecisionFocusedLearningBenchmarks.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module DecisionFocusedLearningBenchmarks

using DataDeps
using HiGHS
using InferOpt
using Requires: @require

function __init__()
# Register the Warcraft dataset
ENV["DATADEPS_ALWAYS_ACCEPT"] = "true"
register(
DataDep(
Expand All @@ -14,6 +14,10 @@ function __init__()
post_fetch_method=unpack,
),
)

# Gurobi setup
@info "If you have Gurobi installed and want to use it, make sure to `using Gurobi` in order to enable it."
@require Gurobi = "2e9cd046-0924-5485-92f1-d5272153d98b" include("gurobi_setup.jl")
return nothing
end

Expand All @@ -25,6 +29,7 @@ include("SubsetSelection/SubsetSelection.jl")
include("Warcraft/Warcraft.jl")
include("FixedSizeShortestPath/FixedSizeShortestPath.jl")
include("PortfolioOptimization/PortfolioOptimization.jl")
include("StochasticVehicleScheduling/StochasticVehicleScheduling.jl")

using .Utils
using .Argmax
Expand All @@ -33,13 +38,15 @@ using .SubsetSelection
using .Warcraft
using .FixedSizeShortestPath
using .PortfolioOptimization
using .StochasticVehicleScheduling

# Interface
export AbstractBenchmark, DataSample
export generate_dataset
export generate_statistical_model
export generate_maximizer
export plot_data
export generate_maximizer, maximizer_kwargs
export objective_value
export plot_data, plot_instance, plot_solution
export compute_gap

# Export all benchmarks
Expand All @@ -49,5 +56,6 @@ export SubsetSelectionBenchmark
export WarcraftBenchmark
export FixedSizeShortestPathBenchmark
export PortfolioOptimizationBenchmark
export StochasticVehicleSchedulingBenchmark

end # module DecisionFocusedLearningBenchmarks
7 changes: 7 additions & 0 deletions src/FixedSizeShortestPath/FixedSizeShortestPath.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ function FixedSizeShortestPathBenchmark(;
return FixedSizeShortestPathBenchmark(g, grid_size, p, deg, ν)
end

function Utils.objective_value(
::FixedSizeShortestPathBenchmark, θ::AbstractArray, y::AbstractArray
)
return -dot(θ, y)
end

"""
$TYPEDSIGNATURES

Expand Down Expand Up @@ -149,5 +155,6 @@ function Utils.generate_statistical_model(bench::FixedSizeShortestPathBenchmark)
end

export FixedSizeShortestPathBenchmark
export generate_dataset, generate_maximizer, generate_statistical_model

end
11 changes: 6 additions & 5 deletions src/PortfolioOptimization/PortfolioOptimization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ module PortfolioOptimization

using ..Utils
using DocStringExtensions: TYPEDEF, TYPEDFIELDS, TYPEDSIGNATURES
using Distributions
using Distributions: Uniform, Bernoulli
using Flux: Chain, Dense
using Ipopt
using JuMP
using LinearAlgebra
using Random
using Ipopt: Ipopt
using JuMP: @variable, @objective, @constraint, optimize!, value, Model, set_silent
using LinearAlgebra: I
using Random: MersenneTwister

"""
$TYPEDEF
Expand Down Expand Up @@ -127,5 +127,6 @@ function Utils.generate_statistical_model(bench::PortfolioOptimizationBenchmark)
end

export PortfolioOptimizationBenchmark
export generate_dataset, generate_maximizer, generate_statistical_model

end
Loading