Skip to content

Commit

Permalink
Collect assets and flows in the model to make it faster to evaluate p…
Browse files Browse the repository at this point in the history
…resence in the set
  • Loading branch information
abelsiqueira committed Jan 11, 2024
1 parent efa42fc commit 4f6ce2f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/create-model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ function create_model(graph, representative_periods, constraints_partitions; wri
end

## Sets unpacking
A = labels(graph)
F = edge_labels(graph)
filter_assets(key, value) = Iterators.filter(a -> getfield(graph[a], key) == value, A)
filter_flows(key, value) = Iterators.filter(f -> getfield(graph[f...], key) == value, F)
A = labels(graph) |> collect
F = edge_labels(graph) |> collect
filter_assets(key, value) = filter(a -> getfield(graph[a], key) == value, A)
filter_flows(key, value) = filter(f -> getfield(graph[f...], key) == value, F)

Ac = filter_assets(:type, "consumer")
Ap = filter_assets(:type, "producer")
Expand Down

0 comments on commit 4f6ce2f

Please sign in to comment.