File tree Expand file tree Collapse file tree 1 file changed +26
-7
lines changed Expand file tree Collapse file tree 1 file changed +26
-7
lines changed Original file line number Diff line number Diff line change 1- module FixedSizeShortestPathTest
1+ @testitem " FixedSizeShortestPath" begin
2+ using DecisionFocusedLearningBenchmarks. FixedSizeShortestPath
3+ using Graphs
24
3- using DecisionFocusedLearningBenchmarks. FixedSizeShortestPath
5+ p = 5
6+ grid_size = (5 , 5 )
7+ A = (grid_size[1 ] - 1 ) * grid_size[2 ] + grid_size[1 ] * (grid_size[2 ] - 1 )
8+ b = FixedSizeShortestPathBenchmark (; p= p, grid_size= grid_size)
49
5- bench = FixedSizeShortestPathBenchmark ()
10+ @test nv (b. graph) == grid_size[1 ] * grid_size[2 ]
11+ @test ne (b. graph) == A
612
7- (; features, costs, solutions) = generate_dataset (bench)
8-
9- model = generate_statistical_model (bench)
10- maximizer = generate_maximizer (bench)
13+ dataset = generate_dataset (b, 50 )
14+ model = generate_statistical_model (b)
15+ maximizer = generate_maximizer (b)
1116
17+ for sample in dataset
18+ x = sample. x
19+ θ_true = sample. θ
20+ y_true = sample. y
21+ @test size (x) == (p,)
22+ @test length (θ_true) == A
23+ @test length (y_true) == A
24+ @test isnothing (sample. instance)
25+ @test all (y_true .== maximizer (- θ_true))
26+ θ = model (x)
27+ @test length (θ) == length (θ_true)
28+ y = maximizer (θ)
29+ @test length (y) == length (y_true)
30+ end
1231end
You can’t perform that action at this time.
0 commit comments