-
Notifications
You must be signed in to change notification settings - Fork 11
Detect unbounded and infeasible problems #332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -102,7 +102,12 @@ If adopted, the Hessian is accessed as an abstract operator and need not be the | |
|
|
||
| - `x::AbstractVector`: a primal initial guess (default: `reg_nlp.model.meta.x0`) | ||
| - `y::AbstractVector`: a dual initial guess (default: `reg_nlp.model.meta.y0`) | ||
| - `atol::T = √eps(T)`: absolute optimality tolerance; | ||
| - `atol::T = eps(T)^(1/3)`: absolute tolerance | ||
| - `diverging_iterates_tol::T = 1/eps(T)`: tolerance to detect divergence of the iterates (divergence occurs when the iterate norm exceeds the tolerance for `diverging_max_iter` consecutive iterations); | ||
| - `diverging_obj_tol::T = -1/eps(T)`: tolerance to detect unboundedness of the objective (unboundedness occurs when the objective value is less than the tolerance for `diverging_max_iter` consecutive iterations); | ||
| - `cviol_tol::T = 1/eps(T)`: tolerance to detect local infeasibility (local infeasibility occurs when ... [PLEASE COMPLETE] ...); | ||
| - `diverging_max_iter::Int = 5`: number of consecutive iterations used to detect divergence or unboundedness (see `diverging_iterates_tol` and `diverging_obj_tol`); | ||
| - `cviol_max_iter::Int = 5`: maximum number of iteration at which the regularisation parameter is increasing and the constraints are still violated; | ||
| - `ctol::T = atol`: absolute feasibility tolerance; | ||
| - `verbose::Int = 0`: if > 0, display iteration details every `verbose` iteration; | ||
| - `max_iter::Int = 10000`: maximum number of iterations; | ||
|
|
@@ -209,7 +214,12 @@ function SolverCore.solve!( | |
| callback = (args...) -> nothing, | ||
| x::V = reg_nlp.model.meta.x0, | ||
| y::V = reg_nlp.model.meta.y0, | ||
| atol::T = √eps(T), | ||
| atol::T = eps(T)^(1/3), | ||
| diverging_iterates_tol::T = 1/eps(T), | ||
| diverging_obj_tol::T = -1/eps(T), | ||
| cviol_tol::T = 1/eps(T), | ||
| diverging_max_iter::Int = 5, | ||
| cviol_max_iter::Int = 5, | ||
| verbose::Int = 0, | ||
| max_iter::Int = 10000, | ||
| max_time::Float64 = 30.0, | ||
|
|
@@ -225,6 +235,9 @@ function SolverCore.solve!( | |
| ) where {T, V} | ||
| reset!(stats) | ||
|
|
||
| diverging_iter::Int = 0 | ||
| cviol_iter::Int = 0 | ||
|
|
||
| # Retrieve workspace | ||
| nlp = reg_nlp.model | ||
| h = reg_nlp.h | ||
|
|
@@ -315,6 +328,8 @@ function SolverCore.solve!( | |
| # objective | ||
| fx = obj(nlp, solver.x) | ||
| hx = @views h(solver.x[selected]) | ||
| improper = (hx == -Inf) | ||
|
|
||
| objx = fx + hx | ||
| set_objective!(stats, objx) | ||
| set_solver_specific!(stats, :smooth_obj, fx) | ||
|
|
@@ -345,19 +360,19 @@ function SolverCore.solve!( | |
| set_time!(stats, time() - start_time) | ||
| set_status!( | ||
| stats, | ||
| SolverCore.get_status( | ||
| nlp, | ||
| get_status( | ||
| reg_nlp; | ||
| elapsed_time = stats.elapsed_time, | ||
| iter = stats.iter, | ||
| optimal = optimal, | ||
| infeasible = false, | ||
| parameter_too_large = false, | ||
| unbounded = false, | ||
| stalled = false, | ||
| exception = false, | ||
| improper = improper, | ||
| diverging_iter = diverging_iter, | ||
| cviol_iter = cviol_iter, | ||
| max_eval = max_eval, | ||
| max_time = max_time, | ||
| max_iter = max_iter, | ||
| diverging_max_iter = diverging_max_iter, | ||
| cviol_max_iter = cviol_max_iter, | ||
| ), | ||
| ) | ||
|
|
||
|
|
@@ -372,6 +387,13 @@ function SolverCore.solve!( | |
| if !done | ||
| if cviol > max(ctol, factor_primal_linear_improvement * cviol_old) | ||
| mu *= factor_penalty_up | ||
| if cviol > cviol_tol | ||
| cviol_iter += 1 | ||
| end | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, my mistake, this has been implemented in |
||
| end | ||
| if (fx + hx < diverging_obj_tol) || (norm(solver.x) > diverging_iterates_tol) | ||
| mu *= factor_penalty_up | ||
| diverging_iter = diverging_iter + 1 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. |
||
| end | ||
| update_μ!(solver.sub_problem.model, mu) | ||
| cviol_old = cviol | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main question is to find out if the criteria you implemented result in a lot of "false positives", i.e., problems that are falsely detected as (locally) infeasible.