File tree Expand file tree Collapse file tree 3 files changed +30
-0
lines changed
Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ using DecisionFocusedLearningBenchmarks
2+ using Random
3+ using Test
4+
5+ @testset " AbstractBenchmark interface" begin
6+ struct DummyBenchmark <: AbstractStaticBenchmark end
7+ b = DummyBenchmark ()
8+ rng = MersenneTwister (1234 )
9+ @test_throws ErrorException generate_instance (b, rng)
10+ @test_throws ErrorException generate_maximizer (b)
11+ @test_throws ErrorException generate_maximizer (b; seed= 0 )
12+ @test ! has_visualization (b)
13+
14+ function DecisionFocusedLearningBenchmarks. generate_instance (
15+ :: DummyBenchmark , rng:: AbstractRNG
16+ )
17+ return DataSample (; x= rand (rng, 5 ))
18+ end
19+
20+ dataset = generate_dataset (b, 10 ; seed= 0 )
21+ @test length (dataset) == 10
22+ @test all (x -> length (x. x) == 5 , dataset)
23+
24+ struct DummyDynamicBenchmark <: AbstractDynamicBenchmark end
25+ db = DummyDynamicBenchmark ()
26+ @test_throws ErrorException compute_gap (db)
27+ end
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ using Random
88 end
99
1010 include (" utils.jl" )
11+ include (" interface.jl" )
1112
1213 include (" argmax.jl" )
1314 include (" argmax_2d.jl" )
Original file line number Diff line number Diff line change 77
88 b = StochasticVehicleSchedulingBenchmark (; nb_tasks= 25 , nb_scenarios= 10 )
99
10+ @test is_exogenous (b)
11+
1012 N = 2
1113 K = 3
1214
You can’t perform that action at this time.
0 commit comments