Skip to content

Commit

Permalink
update code for solve call
Browse files Browse the repository at this point in the history
  • Loading branch information
jd-lara committed Jan 11, 2024
1 parent 8d1bee1 commit 390f911
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
InfrastructureSystems = "2cd47ed4-ca9b-11e9-27f2-ab636a7671f1"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195"
MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
PowerSimulations = "e690365d-45e2-57bb-ac84-44ba829e73c4"
PowerSystems = "bcd98974-b02a-5e2f-9ee0-a103f5c450dd"

[compat]
DocStringExtensions = "~0.8, ~0.9"
Dates = "1"
DocStringExtensions = "~0.8, ~0.9"
InfrastructureSystems = "^1.21"
JuMP = "1"
MathOptInterface = "1"
MPI = "^0.20"
PowerSimulations = "^0.25"
PowerSystems = "^3"
Expand Down
3 changes: 2 additions & 1 deletion src/PowerSimulationsDecomposition.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ import InfrastructureSystems
import JuMP
import Dates
import MPI
import MathOptInterface

const PSI = PowerSimulations
const PSY = PowerSystems
const IS = InfrastructureSystems
const PM = PSI.PM

const MOI = MathOptInterface

using DocStringExtensions
@template (FUNCTIONS, METHODS) = """
Expand Down
4 changes: 4 additions & 0 deletions src/algorithms/sequential_algorithm.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ function build_impl!(

for (index, sub_problem) in container.subproblems
@debug "Building Subproblem $index" _group = PSI.LOG_GROUP_OPTIMIZATION_CONTAINER
# System modification
PSI.build_impl!(sub_problem, template, sys)
end

Expand All @@ -24,8 +25,11 @@ end

function solve_impl!(container::MultiOptimizationContainer{SequentialAlgorithm}, sys::PSY.System)
# Solve main problem
status = PSI.RunStatus.SUCCESSFUL
for (index, sub_problem) in container.subproblems
@info "Solving problem $index"
status = PSI.solve_impl!(sub_problem, sys)
end
#write_results_to_main_container()
return status
end
5 changes: 4 additions & 1 deletion src/multi_optimization_container.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ mutable struct MultiOptimizationContainer{T<:DecompositionAlgorithm} <: PSI.Abst
base_power::Float64
optimizer_stats::PSI.OptimizerStats
built_for_recurrent_solves::Bool
metadata::PSI.OptimizationContainerMetadata # Unclear about how to extend this correctly
metadata::PSI.OptimizationContainerMetadata
default_time_series_type::Type{<:PSY.TimeSeriesData} # Maybe isn't needed here
mpi_info::Union{Nothing, MpiInfo}
end
Expand Down Expand Up @@ -183,3 +183,6 @@ function init_optimization_container!(

return
end

function PSI.serialize_optimization_model(container::MultiOptimizationContainer, save_path::String)
end
6 changes: 5 additions & 1 deletion src/problems/multi_region_problem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,18 @@ end

function instantiate_network_model(model::PSI.DecisionModel{MultiRegionProblem})
PSI.instantiate_network_model(model)
return
end

function PSI.build_model!(model::PSI.DecisionModel{MultiRegionProblem})
build_impl!(PSI.get_optimization_container(model), PSI.get_template(model), PSI.get_system(model))
return
end

function PSI.solve_impl!(model::PSI.DecisionModel{MultiRegionProblem})
solve_impl!(PSI.get_optimization_container(model), PSI.get_system(model))
status = solve_impl!(PSI.get_optimization_container(model), PSI.get_system(model))
PSI.set_run_status!(model, status)
return
end

function PSI.write_model_dual_results!(store,
Expand Down

0 comments on commit 390f911

Please sign in to comment.