|
|
|
@ -58,7 +58,7 @@ instance = UnitCommitment.read("/path/to/input.json.gz")
|
|
|
|
|
|
|
|
|
|
function _repair_scenario_name_and_probability(
|
|
|
|
|
scenarios::Vector{UnitCommitmentScenario},
|
|
|
|
|
path::Vector{String}
|
|
|
|
|
path::Vector{String},
|
|
|
|
|
)::Vector{UnitCommitmentScenario}
|
|
|
|
|
number_of_scenarios = length(scenarios)
|
|
|
|
|
probs = [sc.probability for sc in scenarios]
|
|
|
|
@ -68,7 +68,9 @@ function _repair_scenario_name_and_probability(
|
|
|
|
|
total_weight = sum(probs)
|
|
|
|
|
catch e
|
|
|
|
|
if isa(e, MethodError)
|
|
|
|
|
error("If any of the scenarios is assigned a weight, then all scenarios must be assigned weights.")
|
|
|
|
|
error(
|
|
|
|
|
"If any of the scenarios is assigned a weight, then all scenarios must be assigned weights.",
|
|
|
|
|
)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
@ -76,7 +78,8 @@ function _repair_scenario_name_and_probability(
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
for (sc_path, sc) in zip(path, scenarios)
|
|
|
|
|
sc.name !== "" || (sc.name = first(split(last(split(sc_path, "/")), ".")))
|
|
|
|
|
sc.name !== "" ||
|
|
|
|
|
(sc.name = first(split(last(split(sc_path, "/")), ".")))
|
|
|
|
|
sc.probability = (sc.probability / total_weight)
|
|
|
|
|
end
|
|
|
|
|
return scenarios
|
|
|
|
|