Skip to content

Commit

Permalink
N-2 test and force ADMM convergence
Browse files Browse the repository at this point in the history
* Add N-2 test and force no block model iteration limits exceeded for convergence
* EmptyBlockModel always returns solution status MOI.Optimal
  • Loading branch information
michel2323 committed Feb 3, 2023
1 parent 4bfe8aa commit 704dad3
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 11 deletions.
6 changes: 3 additions & 3 deletions Artifacts.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[ExaData]
git-tree-sha1 = "df547b1e5d707fdb88721eee9bf84f9211e1fb50"
git-tree-sha1 = "882112a441efaa242000181b177c4005b190a4c1"
lazy = true
[[ExaData.download]]
url = "https://web.cels.anl.gov/~mschanen/ExaData-e1b6123.tar.gz"
sha256 = "f6e22f26fbf273e97625a25b1b55f07d0eb0e15283483c545dda6eda84c48fdd"
url = "https://web.cels.anl.gov/~mschanen/ExaData-4747d0f.tar.gz"
sha256 = "6d929aa12f3841c0fb14100effff42bc5edffd7602afb4844e80996f033c3fc8"
13 changes: 11 additions & 2 deletions src/Evaluators/ProxALEvalutor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -400,13 +400,22 @@ function optimize!(
iteration()

# Check convergence
if max(
iteration_limit = 0
for blk in opfBlockData.blkModel
solution = get_solution(blk)
if solution.status MOI_OPTIMAL_STATUSES
iteration_limit = 1
end
end
giteration_limit = comm_sum(iteration_limit, comm)

if (max(
runinfo.maxviol_t[end],
runinfo.maxviol_c[end],
runinfo.maxviol_t_actual[end],
runinfo.maxviol_c_actual[end],
runinfo.maxviol_d[end]
) <= algparams.tol
) <= algparams.tol) && (giteration_limit == 0)
# minviol = max(
# runinfo.maxviol_t[end],
# runinfo.maxviol_c[end],
Expand Down
14 changes: 10 additions & 4 deletions src/backends.jl
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,13 @@ function init!(block::EmptyBlockModel, algparams::AlgParams) end
function set_objective!(block::EmptyBlockModel, algparams::AlgParams,
primal::AbstractPrimalSolution, dual::AbstractDualSolution)
end
function get_solution(block::EmptyBlockModel) end
function get_solution(block::EmptyBlockModel)
# Empty block is always optimal
solution = (
status=MOI.OPTIMAL,
)
return solution
end

### Implementation of JuMPBlockBackend
struct JuMPBlockBackend <: AbstractBlockModel
Expand Down Expand Up @@ -768,9 +774,9 @@ function get_solution(block::AdmmBlockBackend)
k = block.k
t = block.t

if status MOI_OPTIMAL_STATUSES
@warn("Block $blk[$k, $t] subproblem not solved to optimality. status: $status")
end
# if status ∉ MOI_OPTIMAL_STATUSES
# @warn("Block $blk[$k, $t] subproblem not solved to optimality. status: $status")
# end

s = ExaAdmmBackend.slack_values(model) |> Array
solution = (
Expand Down
4 changes: 2 additions & 2 deletions src/communication.jl
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,11 @@ end
Collective to reduce and return the sum over scalar `data`.
"""
function comm_sum(data::Float64, comm::MPI.Comm)
function comm_sum(data::Number, comm::MPI.Comm)
return MPI.Allreduce(data, MPI.SUM, comm)
end

function comm_sum(data::Float64, comm::Nothing)
function comm_sum(data::Number, comm::Nothing)
return data
end

Expand Down

0 comments on commit 704dad3

Please sign in to comment.