mirror of
https://github.com/ANL-CEEESA/RELOG.git
synced 2025-12-06 07:48:50 -06:00
Fix formatting
This commit is contained in:
@@ -103,7 +103,7 @@ function solve(filename::AbstractString; heuristic = false, kwargs...)
|
|||||||
return_model = true,
|
return_model = true,
|
||||||
output = nothing,
|
output = nothing,
|
||||||
marginal_costs = false,
|
marginal_costs = false,
|
||||||
kwargs...
|
kwargs...,
|
||||||
)
|
)
|
||||||
@info "Filtering candidate locations..."
|
@info "Filtering candidate locations..."
|
||||||
selected_pairs = []
|
selected_pairs = []
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ function solve(root, filename)
|
|||||||
)
|
)
|
||||||
ref_solution, ref_model = RELOG.solve(
|
ref_solution, ref_model = RELOG.solve(
|
||||||
ref_file,
|
ref_file,
|
||||||
heuristic=true,
|
heuristic = true,
|
||||||
optimizer=optimizer,
|
optimizer = optimizer,
|
||||||
lp_optimizer=HiGHS.Optimizer,
|
lp_optimizer = HiGHS.Optimizer,
|
||||||
return_model=true,
|
return_model = true,
|
||||||
marginal_costs=true,
|
marginal_costs = true,
|
||||||
)
|
)
|
||||||
Libc.flush_cstdio()
|
Libc.flush_cstdio()
|
||||||
flush(stdout)
|
flush(stdout)
|
||||||
@@ -27,14 +27,8 @@ function solve(root, filename)
|
|||||||
if length(ref_solution) == 0
|
if length(ref_solution) == 0
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
RELOG.write_products_report(
|
RELOG.write_products_report(ref_solution, replace(ref_file, ".json" => "_products.csv"))
|
||||||
ref_solution,
|
RELOG.write_plants_report(ref_solution, replace(ref_file, ".json" => "_plants.csv"))
|
||||||
replace(ref_file, ".json" => "_products.csv"),
|
|
||||||
)
|
|
||||||
RELOG.write_plants_report(
|
|
||||||
ref_solution,
|
|
||||||
replace(ref_file, ".json" => "_plants.csv"),
|
|
||||||
)
|
|
||||||
RELOG.write_plant_outputs_report(
|
RELOG.write_plant_outputs_report(
|
||||||
ref_solution,
|
ref_solution,
|
||||||
replace(ref_file, ".json" => "_plant_outputs.csv"),
|
replace(ref_file, ".json" => "_plant_outputs.csv"),
|
||||||
@@ -43,10 +37,7 @@ function solve(root, filename)
|
|||||||
ref_solution,
|
ref_solution,
|
||||||
replace(ref_file, ".json" => "_plant_emissions.csv"),
|
replace(ref_file, ".json" => "_plant_emissions.csv"),
|
||||||
)
|
)
|
||||||
RELOG.write_transportation_report(
|
RELOG.write_transportation_report(ref_solution, replace(ref_file, ".json" => "_tr.csv"))
|
||||||
ref_solution,
|
|
||||||
replace(ref_file, ".json" => "_tr.csv"),
|
|
||||||
)
|
|
||||||
RELOG.write_transportation_emissions_report(
|
RELOG.write_transportation_emissions_report(
|
||||||
ref_solution,
|
ref_solution,
|
||||||
replace(ref_file, ".json" => "_tr_emissions.csv"),
|
replace(ref_file, ".json" => "_tr_emissions.csv"),
|
||||||
@@ -60,16 +51,13 @@ function solve(root, filename)
|
|||||||
sc_solution = RELOG.resolve(
|
sc_solution = RELOG.resolve(
|
||||||
ref_model,
|
ref_model,
|
||||||
scenario,
|
scenario,
|
||||||
optimizer=optimizer,
|
optimizer = optimizer,
|
||||||
lp_optimizer=HiGHS.Optimizer,
|
lp_optimizer = HiGHS.Optimizer,
|
||||||
)
|
)
|
||||||
if length(sc_solution) == 0
|
if length(sc_solution) == 0
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
RELOG.write_plants_report(
|
RELOG.write_plants_report(sc_solution, replace(scenario, ".json" => "_plants.csv"))
|
||||||
sc_solution,
|
|
||||||
replace(scenario, ".json" => "_plants.csv"),
|
|
||||||
)
|
|
||||||
RELOG.write_products_report(
|
RELOG.write_products_report(
|
||||||
sc_solution,
|
sc_solution,
|
||||||
replace(scenario, ".json" => "_products.csv"),
|
replace(scenario, ".json" => "_products.csv"),
|
||||||
@@ -114,10 +102,7 @@ function solve_recursive(path)
|
|||||||
endswith(filename, "_plants.csv") || continue
|
endswith(filename, "_plants.csv") || continue
|
||||||
push!(
|
push!(
|
||||||
results,
|
results,
|
||||||
joinpath(
|
joinpath(replace(root, path => ""), replace(filename, "_plants.csv" => "")),
|
||||||
replace(root, path => ""),
|
|
||||||
replace(filename, "_plants.csv" => ""),
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -32,11 +32,11 @@ function submit(req::HTTP.Request)
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Run job
|
# Run job
|
||||||
run(`bash -c "(julia --project=$PROJECT_DIR $PROJECT_DIR/src/web/run.jl $job_path 2>&1 | tee $job_path/solve.log) >/dev/null 2>&1 &"`)
|
run(
|
||||||
|
`bash -c "(julia --project=$PROJECT_DIR $PROJECT_DIR/src/web/run.jl $job_path 2>&1 | tee $job_path/solve.log) >/dev/null 2>&1 &"`,
|
||||||
response = Dict(
|
|
||||||
"job_id" => job_id,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
response = Dict("job_id" => job_id)
|
||||||
return HTTP.Response(200, body = JSON.json(response))
|
return HTTP.Response(200, body = JSON.json(response))
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -63,4 +63,3 @@ function web(host = "127.0.0.1", port = 8080)
|
|||||||
HTTP.serve(ROUTER, host, port)
|
HTTP.serve(ROUTER, host, port)
|
||||||
Base.exit_on_sigint(true)
|
Base.exit_on_sigint(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user