Skip to content
Snippets Groups Projects
Commit 64898db6 authored by David Radu's avatar David Radu
Browse files

fixed bug on saving files

parent bb3a4119
No related branches found
No related tags found
No related merge requests found
......@@ -38,7 +38,7 @@ function main_SA(index_dict, deployment_dict, legacy_index_list,
elseif init_sol_algorithm == "SGH"
x_init_alg, LB_init_alg = Array{Float64, 2}(undef, R_init, L), Array{Float64, 1}(undef, R_init)
for r = 1:R_init
if (div(r, 5) > 0) & (mod(r, 5) == 0)
if (div(r, 10) > 0) & (mod(r, 10) == 0)
@info "$(Dates.format(now(), "HH:MM:SS")) Run $(r)/$(R) of $(init_sol_algorithm)"
end
x_init_alg[r, :], LB_init_alg[r] = randomised_greedy_heuristic_partition(D, c, n_partitions, p,
......@@ -54,7 +54,7 @@ function main_SA(index_dict, deployment_dict, legacy_index_list,
println("Initial solution retrieved. Starting local search.")
for r = 1:R
if (div(r, 5) > 0) & (mod(r, 5) == 0)
if (div(r, 10) > 0) & (mod(r, 10) == 0)
@info "$(Dates.format(now(), "HH:MM:SS")) Run $(r)/$(R) of LS"
end
x_sol[r, :], LB_sol[r], obj_sol[r, :] = simulated_annealing_local_search_partition(D, c, n_partitions,
......@@ -88,7 +88,7 @@ function main_SGH(index_dict, deployment_dict, legacy_index_list,
if algorithm == "SGH"
x_sol, LB_sol = Array{Float64, 2}(undef, R, L), Array{Float64, 1}(undef, R)
for r = 1:R
if (div(r, 5) > 0) & (mod(r, 5) == 0)
if (div(r, 10) > 0) & (mod(r, 10) == 0)
@info "$(Dates.format(now(), "HH:MM:SS")) Run $(r)/$(R)"
end
x_sol[r, :], LB_sol[r] = randomised_greedy_heuristic_partition(D, c, n_partitions, p,
......
......@@ -381,7 +381,6 @@ function greedy_heuristic_partition(D::Array{Float64,2}, c::Float64, n::Vector{I
ind_candidate_pointer = 1
@inbounds for r in regions
if locations_added_per_region[r] < n[r]
println(r, ind_compl_incumbent[r])
@inbounds for ind in ind_compl_incumbent[r]
Dx_tmp .= Dx_incumbent .+ view(D, :, ind)
y_tmp .= Dx_tmp .>= threshold
......@@ -398,7 +397,6 @@ function greedy_heuristic_partition(D::Array{Float64,2}, c::Float64, n::Vector{I
end
end
end
println(ind_candidate_list)
ind_candidate = sample(view(ind_candidate_list, 1:ind_candidate_pointer-1))
filter!(a -> a != ind_candidate, ind_compl_incumbent[locations_regions_mapping[ind_candidate]])
ind_incumbent[locations_added+1] = ind_candidate
......
......@@ -147,10 +147,10 @@ if __name__ == '__main__':
retrieve_site_data(model_parameters, capacity_factors_data, criticality_data, deployment_dict,
site_positions, locations_dict, legacy_coordinates, output_folder, benchmark='PROD')
pickle.dump(jl_obj, open(join(output_folder, 'solution_matrix.p'), 'wb'))
pickle.dump(jl_sel, open(join(output_folder, 'objective_vector.p'), 'wb'))
pickle.dump(jl_sel, open(join(output_folder, 'solution_matrix.p'), 'wb'))
pickle.dump(jl_obj, open(join(output_folder, 'objective_vector.p'), 'wb'))
try:
pickle.dump(jl_tra, open(join(output_folder, 'solution_matrix.p'), 'wb'))
pickle.dump(jl_tra, open(join(output_folder, 'trajectory_matrix.p'), 'wb'))
except NameError:
pass
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment