Skip to content

Commit 31cae12

Browse files
authored
Merge pull request #42 from JuliaDecisionFocusedLearning/cost-bar
Implement cost bar for DVSP plots
2 parents 079b724 + cf63408 commit 31cae12

File tree

10 files changed

+396
-491
lines changed

10 files changed

+396
-491
lines changed

Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ ConstrainedShortestPaths = "b3798467-87dc-4d99-943d-35a1bd39e395"
1010
DataDeps = "124859b0-ceae-595e-8997-d05f6a7a8dfe"
1111
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
1212
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
13+
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
1314
Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c"
1415
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
1516
HiGHS = "87dc4568-4c63-4d18-b0c0-bb2238e4078b"
@@ -40,6 +41,7 @@ ConstrainedShortestPaths = "0.6.0"
4041
DataDeps = "0.7"
4142
Distributions = "0.25"
4243
DocStringExtensions = "0.9"
44+
FileIO = "1.17.0"
4345
Flux = "0.14, 0.15, 0.16"
4446
Graphs = "1.11"
4547
HiGHS = "1.9"

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
[![Coverage](https://codecov.io/gh/JuliaDecisionFocusedLearning/DecisionFocusedLearningBenchmarks.jl/branch/main/graph/badge.svg)](https://app.codecov.io/gh/JuliaDecisionFocusedLearning/DecisionFocusedLearningBenchmarks.jl)
77
[![Code Style: Blue](https://img.shields.io/badge/code%20style-blue-4495d1.svg)](https://github.com/JuliaDiff/BlueStyle)
88

9+
!!! warning
10+
This package is currently under active development. The API may change in future releases.
11+
Please refer to the [documentation](https://JuliaDecisionFocusedLearning.github.io/DecisionFocusedLearningBenchmarks.jl/stable/) for the latest updates.
12+
913
## What is Decision-Focused Learning?
1014

1115
Decision-focused learning (DFL) is a paradigm that integrates machine learning prediction with combinatorial optimization to make better decisions under uncertainty. Unlike traditional "predict-then-optimize" approaches that optimize prediction accuracy independently of downstream decision quality, DFL directly optimizes end-to-end decision performance.

docs/src/benchmark_interfaces.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ The package defines a hierarchy of three abstract types:
2626

2727
```
2828
AbstractBenchmark
29-
── AbstractStochasticBenchmark{exogenous}
29+
── AbstractStochasticBenchmark{exogenous}
3030
└── AbstractDynamicBenchmark{exogenous}
3131
```
3232

3333
- **`AbstractBenchmark`**: static, single-stage optimization problems
3434
- **`AbstractStochasticBenchmark{exogenous}`**: stochastic, single stage optimization problems
35-
**`AbstractDynamicBenchmark{exogenous}`**: multi-stage sequential decision problems
35+
- **`AbstractDynamicBenchmark{exogenous}`**: multi-stage sequential decision-making problems
3636

3737
The `{exogenous}` type parameter indicates whether uncertainty distribution comes from external sources (`true`) or is influenced by decisions (`false`), which affects available methods.
3838

src/DynamicVehicleScheduling/DynamicVehicleScheduling.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ using IterTools: partition
1313
using JSON
1414
using JuMP
1515
using Plots: plot, plot!, scatter!, @animate, Plots, gif
16-
using Printf: @printf
16+
using Printf: @printf, @sprintf
1717
using Random: Random, AbstractRNG, MersenneTwister, seed!, randperm
1818
using Requires: @require
1919
using Statistics: mean, quantile

src/DynamicVehicleScheduling/anticipative_solver.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ function anticipative_solver(
5454
)
5555
if reset_env
5656
reset!(env; reset_rng=true, seed)
57+
scenario = env.scenario
5758
end
5859

5960
@assert !is_terminated(env)
@@ -213,13 +214,15 @@ function anticipative_solver(
213214
current_epoch=epoch,
214215
)
215216

217+
reward = -cost(state, decode_bitmatrix_to_routes(y_true))
218+
216219
x = if two_dimensional_features
217220
compute_2D_features(state, env.instance)
218221
else
219222
compute_features(state, env.instance)
220223
end
221224

222-
return DataSample(; instance=state, y_true, x)
225+
return DataSample(; instance=(; state, reward), y_true, x)
223226
end
224227

225228
return obj, dataset

0 commit comments

Comments
 (0)