Skip to content

Commit 4867402

Browse files
committed
Let N only be part of parameters dict.
1 parent 37461ec commit 4867402

3 files changed

Lines changed: 6 additions & 7 deletions

File tree

src/main/create_graph.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ function create_graph(param, w = 11, h = 11; type = "map", kwargs...)
4242
graph = create_custom(options[:adjacency], options[:x], options[:y])
4343
end
4444

45-
graph[:N] = param[:N] # Ensure graph has all information
46-
graph[:Zjn] = haskey(options, :Zjn) ? options[:Zjn] : ones(graph[:J], graph[:N])
45+
graph[:Zjn] = haskey(options, :Zjn) ? options[:Zjn] : ones(graph[:J], param[:N])
4746
graph[:Hj] = haskey(options, :Hj) ? options[:Hj] : ones(graph[:J])
4847

4948
if param[:mobility] == false

src/main/init_parameters.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ end
107107
# Check if the parameters are consistent with the graph structure
108108
function check_graph_param(graph, param)
109109

110-
if haskey(param, :m) && length(param[:m]) != graph[:N]
111-
@warn "m does not have the right length N = $(graph[:N])."
110+
if haskey(param, :m) && length(param[:m]) != param[:N]
111+
@warn "m does not have the right length N = $(param[:N])."
112112
end
113113

114114
if haskey(param, :omegaj) && !haskey(graph, :omegaj)
@@ -142,8 +142,8 @@ function check_graph_param(graph, param)
142142
if haskey(param, :Zjn) && !haskey(graph, :Zjn)
143143
graph[:Zjn] = param[:Zjn]
144144
end
145-
if haskey(graph, :Zjn) && size(graph[:Zjn]) != (graph[:J], graph[:N])
146-
@warn "Zjn does not have the right size J ($(graph[:J])) x N ($(graph[:N]))."
145+
if haskey(graph, :Zjn) && size(graph[:Zjn]) != (graph[:J], param[:N])
146+
@warn "Zjn does not have the right size J ($(graph[:J])) x N ($(param[:N]))."
147147
end
148148

149149
if haskey(param, :Hj) && !haskey(graph, :Hj)

src/main/optimal_network.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ plot_graph(graph, results[:Ijk])
3131
function optimal_network(param, graph; I0=nothing, Il=nothing, Iu=nothing, verbose=false, return_model=0, solve_allocation = false)
3232

3333
# I0=nothing; Il=nothing; Iu=nothing; verbose=false; return_model = false; return_model = 0;
34-
# Check param.Zjn and make matrix if vector:
34+
# Check graph.Zjn and make matrix if vector:
3535
if length(size(graph[:Zjn])) == 1
3636
graph[:Zjn] = reshape(graph[:Zjn], graph[:J], 1)
3737
end

0 commit comments

Comments
 (0)