Skip to content
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

Use Norse data on the benchmarks #171

Merged
merged 2 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 11 additions & 6 deletions benchmark/benchmarks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ using TulipaEnergyModel

const SUITE = BenchmarkGroup()

SUITE["io"] = BenchmarkGroup(["data", "input", "graph", "output"])
SUITE["model"] = BenchmarkGroup(["model"])
SUITE["io"] = BenchmarkGroup()
SUITE["model"] = BenchmarkGroup()

const INPUT_FOLDER = joinpath(@__DIR__, "..", "test", "inputs", "tiny")
const INPUT_FOLDER = joinpath(@__DIR__, "..", "test", "inputs", "Norse")
const OUTPUT_FOLDER = joinpath(@__DIR__, "..", "test", "outputs")

SUITE["io"]["input"] = @benchmarkable begin
Expand All @@ -25,18 +25,23 @@ graph = create_graph(
joinpath(INPUT_FOLDER, "flows-data.csv"),
)

SUITE["model"]["all"] = @benchmarkable begin
SUITE["model"]["create_model"] = @benchmarkable begin
create_model($graph, $parameters, $sets)
end

model = create_model(graph, parameters, sets)

SUITE["model"]["solve_model"] = @benchmarkable begin
solve_model($model)
end

solution = solve_model(model)

SUITE["io"]["output"] = @benchmarkable begin
save_solution_to_file(
$OUTPUT_FOLDER,
$(sets.assets_investment),
$(solution.v_investment),
$(parameters.unit_capacity),
$(solution.assets_investment),
$(parameters.assets_unit_capacity),
)
end
1 change: 1 addition & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[deps]
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
Expand Down
5 changes: 5 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,8 @@ end
@test compute_rp_periods([time_steps4, time_steps5]) == [1:6, 7:12]
end
end

@testset "Ensuring benchmark loads" begin
include(joinpath(@__DIR__, "..", "benchmark", "benchmarks.jl"))
@test SUITE !== nothing
end
Loading