diff --git a/Project.toml b/Project.toml index ba3b1da..98fd359 100644 --- a/Project.toml +++ b/Project.toml @@ -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" diff --git a/src/PowerSimulationsDecomposition.jl b/src/PowerSimulationsDecomposition.jl index 4fbc0be..8c616d5 100644 --- a/src/PowerSimulationsDecomposition.jl +++ b/src/PowerSimulationsDecomposition.jl @@ -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) = """ diff --git a/src/algorithms/sequential_algorithm.jl b/src/algorithms/sequential_algorithm.jl index 4411466..2259451 100644 --- a/src/algorithms/sequential_algorithm.jl +++ b/src/algorithms/sequential_algorithm.jl @@ -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 @@ -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 diff --git a/src/multi_optimization_container.jl b/src/multi_optimization_container.jl index 7782885..f394633 100644 --- a/src/multi_optimization_container.jl +++ b/src/multi_optimization_container.jl @@ -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 @@ -183,3 +183,6 @@ function init_optimization_container!( return end + +function PSI.serialize_optimization_model(container::MultiOptimizationContainer, save_path::String) +end diff --git a/src/problems/multi_region_problem.jl b/src/problems/multi_region_problem.jl index b9db436..cde9b13 100644 --- a/src/problems/multi_region_problem.jl +++ b/src/problems/multi_region_problem.jl @@ -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,