Skip to content

Commit

Permalink
fix bug in modify h thru MOI; adjust illposed check
Browse files Browse the repository at this point in the history
  • Loading branch information
chriscoey committed Dec 13, 2021
1 parent 96f57a4 commit 9ea5ad6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
14 changes: 12 additions & 2 deletions src/MathOptInterface/wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,18 @@ function MOI.modify(
ci::MOI.ConstraintIndex{VAF{T}, <:SupportedCone{T}},
chg::MOI.VectorConstantChange{T},
) where {T}
idxs = opt.moi_cone_idxs[ci.value]
Solvers.modify_h(opt.solver, idxs, chg.new_constant)
i = ci.value
idxs = opt.moi_cone_idxs[i]
set = opt.moi_cones[i]
new_h = chg.new_constant
if needs_permute(set)
@assert !needs_rescale(set)
new_h = permute_affine(set, new_h)
end
if needs_rescale(set)
rescale_affine(set, new_h)
end
Solvers.modify_h(opt.solver, idxs, new_h)
return
end

Expand Down
5 changes: 2 additions & 3 deletions src/Solvers/Solvers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ mutable struct Solver{T <: Real}
tol_infeas = default_tol_tight
end
if isnothing(tol_illposed)
tol_illposed = default_tol_tight / 100
tol_illposed = default_tol_tight
end
@assert min(tol_rel_opt, tol_abs_opt, tol_feas,
tol_infeas, tol_illposed, tol_slow) >= 0
Expand Down Expand Up @@ -702,8 +702,7 @@ function check_converged(
end

# TODO experiment with ill-posedness check
max_illp = max(solver.mu, tau / min(one(T), solver.point.kap[]))
if max_illp <= near_factor * solver.tol_illposed
if max(tau, solver.point.kap[]) <= near_factor * solver.tol_illposed
solver.verbose && println("ill-posedness detected; terminating")
solver.status = (check_near ? NearIllPosed : IllPosed)
return true
Expand Down

0 comments on commit 9ea5ad6

Please sign in to comment.