mirror of
https://github.com/ANL-CEEESA/UnitCommitment.jl.git
synced 2025-12-06 16:28:51 -06:00
PH: Rename vars, remove return value
This commit is contained in:
@@ -4,81 +4,34 @@
|
||||
|
||||
using JuMP, MPI, TimerOutputs
|
||||
|
||||
mutable struct TerminationCriteria
|
||||
max_iterations::Int
|
||||
max_time::Float64
|
||||
min_feasibility::Float64
|
||||
min_improvement::Float64
|
||||
min_iterations::Int
|
||||
|
||||
function TerminationCriteria(;
|
||||
max_iterations::Int = 1000,
|
||||
max_time::Float64 = 14400.0,
|
||||
min_feasibility::Float64 = 1e-3,
|
||||
min_improvement::Float64 = 1e-3,
|
||||
min_iterations::Int = 2,
|
||||
)
|
||||
return new(
|
||||
max_iterations,
|
||||
max_time,
|
||||
min_feasibility,
|
||||
min_improvement,
|
||||
min_iterations,
|
||||
)
|
||||
end
|
||||
Base.@kwdef mutable struct PHTermination
|
||||
max_iterations::Int = 1000
|
||||
max_time::Float64 = 14400.0
|
||||
min_feasibility::Float64 = 1e-3
|
||||
min_improvement::Float64 = 1e-3
|
||||
min_iterations::Int = 2
|
||||
end
|
||||
|
||||
Base.@kwdef mutable struct IterationInfo
|
||||
it_num::Int
|
||||
sp_consensus_vals::Array{Float64,1}
|
||||
global_consensus_vals::Array{Float64,1}
|
||||
sp_obj::Float64
|
||||
global_obj::Float64
|
||||
it_time::Float64
|
||||
total_elapsed_time::Float64
|
||||
global_residual::Float64
|
||||
Base.@kwdef mutable struct PHIterationInfo
|
||||
global_infeas::Float64
|
||||
global_obj::Float64
|
||||
global_residual::Float64
|
||||
iteration_number::Int
|
||||
iteration_time::Float64
|
||||
sp_vals::Array{Float64,1}
|
||||
sp_obj::Float64
|
||||
target::Array{Float64,1}
|
||||
total_elapsed_time::Float64
|
||||
end
|
||||
|
||||
mutable struct ProgressiveHedging <: SolutionMethod
|
||||
consensus_vars::Union{Array{VariableRef,1},Nothing}
|
||||
weights::Union{Array{Float64,1},Nothing}
|
||||
initial_global_consensus_vals::Union{Array{Float64,1},Nothing}
|
||||
num_of_threads::Int
|
||||
ρ::Float64
|
||||
λ_default::Float64
|
||||
print_interval::Int
|
||||
termination_criteria::TerminationCriteria
|
||||
|
||||
function ProgressiveHedging(;
|
||||
consensus_vars::Union{Array{VariableRef,1},Nothing} = nothing,
|
||||
weights::Union{Array{Float64,1},Nothing} = nothing,
|
||||
initial_global_consensus_vals::Union{Array{Float64,1},Nothing} = nothing,
|
||||
num_of_threads::Int = 1,
|
||||
ρ::Float64 = 1.0,
|
||||
λ_default::Float64 = 0.0,
|
||||
print_interval::Int = 1,
|
||||
termination_criteria::TerminationCriteria = TerminationCriteria(),
|
||||
)
|
||||
return new(
|
||||
consensus_vars,
|
||||
weights,
|
||||
initial_global_consensus_vals,
|
||||
num_of_threads,
|
||||
ρ,
|
||||
λ_default,
|
||||
print_interval,
|
||||
termination_criteria,
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
struct FinalResult
|
||||
obj::Float64
|
||||
vals::Any
|
||||
infeasibility::Float64
|
||||
total_iteration_num::Int
|
||||
wallclock_time::Float64
|
||||
Base.@kwdef mutable struct ProgressiveHedging <: SolutionMethod
|
||||
initial_weights::Union{Vector{Float64},Nothing} = nothing
|
||||
initial_target::Union{Vector{Float64},Nothing} = nothing
|
||||
ρ::Float64 = 1.0
|
||||
λ::Float64 = 0.0
|
||||
print_interval::Int = 1
|
||||
termination::PHTermination = PHTermination()
|
||||
inner_method::SolutionMethod = XavQiuWanThi2019.Method()
|
||||
end
|
||||
|
||||
struct SpResult
|
||||
@@ -86,23 +39,23 @@ struct SpResult
|
||||
vals::Array{Float64,1}
|
||||
end
|
||||
|
||||
Base.@kwdef mutable struct SubProblem
|
||||
Base.@kwdef mutable struct PHSubProblem
|
||||
mip::JuMP.Model
|
||||
obj::AffExpr
|
||||
consensus_vars::Array{VariableRef,1}
|
||||
weights::Array{Float64,1}
|
||||
end
|
||||
|
||||
Base.@kwdef struct SpSolution
|
||||
Base.@kwdef struct PhSubProblemSolution
|
||||
obj::Float64
|
||||
consensus_vals::Array{Float64,1}
|
||||
vals::Array{Float64,1}
|
||||
residuals::Array{Float64,1}
|
||||
end
|
||||
|
||||
Base.@kwdef mutable struct SpParams
|
||||
Base.@kwdef mutable struct PHSubProblemParams
|
||||
ρ::Float64
|
||||
λ::Array{Float64,1}
|
||||
global_consensus_vals::Array{Float64,1}
|
||||
target::Array{Float64,1}
|
||||
end
|
||||
|
||||
struct MpiInfo
|
||||
@@ -118,9 +71,3 @@ struct MpiInfo
|
||||
return new(comm, rank, is_root, nprocs)
|
||||
end
|
||||
end
|
||||
|
||||
Base.@kwdef struct Callbacks
|
||||
before_solve_subproblem::Any
|
||||
after_solve_subproblem::Any
|
||||
after_iteration::Any
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user