Skip to content
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

update termination message for NearOptimal status #799

Open
lkapelevich opened this issue Feb 2, 2022 · 1 comment
Open

update termination message for NearOptimal status #799

lkapelevich opened this issue Feb 2, 2022 · 1 comment

Comments

@lkapelevich
Copy link
Collaborator

optimal solution found; terminating
can be confusing

@odow
Copy link
Member

odow commented Jan 16, 2025

I came here to say this:

julia> using JuMP, Hypatia

julia> begin
           model = Model(Hypatia.Optimizer)
           @variable(model, 0 <= x <= 1)
           @variable(model, 0 <= y <= 1)
           @objective(model, Min, -x)
           @constraint(model, x^2 <= y)
           @constraint(model, -x^2 + 1 >= y)
           @constraint(model, x^2 + (y - 0.5)^2 <= 1.0)
           optimize!(model)
       end

 iter        p_obj        d_obj |  abs_gap    x_feas    z_feas |      tau       kap        mu | dir_res     prox  step     alpha
    0  -1.6019e-01  -5.9943e+00 | 1.00e+01  4.57e-01  4.20e-01 | 1.00e+00  1.00e+00  1.00e+00 |
    1  -3.8427e-01  -1.3948e+00 | 2.04e+00  7.46e-02  6.86e-02 | 1.22e+00  1.29e-01  2.00e-01 | 8.9e-16  8.2e-01  co-a  8.00e-01
    2  -7.1577e-01  -9.2310e-01 | 3.47e-01  1.62e-02  1.49e-02 | 1.13e+00  4.00e-02  3.57e-02 | 1.1e-16  8.5e-01  co-a  8.00e-01
    3  -7.0013e-01  -7.2075e-01 | 3.86e-02  1.52e-03  1.40e-03 | 1.20e+00  2.56e-03  3.79e-03 | 5.8e-15  9.2e-01  co-a  9.00e-01
    4  -7.0676e-01  -7.1014e-01 | 5.04e-03  2.57e-04  2.36e-04 | 1.07e+00  4.87e-04  5.05e-04 | 1.6e-15  6.4e-01  co-a  8.50e-01
    5  -7.0700e-01  -7.0751e-01 | 7.60e-04  3.86e-05  3.55e-05 | 1.06e+00  6.67e-05  7.55e-05 | 2.8e-14  5.4e-01  co-a  8.50e-01
    6  -7.0709e-01  -7.0717e-01 | 1.09e-04  6.04e-06  5.55e-06 | 1.02e+00  1.03e-05  1.09e-05 | 8.3e-14  3.3e-01  co-a  8.50e-01
    7  -7.0711e-01  -7.0711e-01 | 1.07e-05  6.18e-07  5.68e-07 | 9.98e-01  1.03e-06  1.06e-06 | 3.6e-13  3.0e-01  co-a  9.00e-01
    8  -7.0711e-01  -7.0711e-01 | 5.21e-07  3.18e-08  2.92e-08 | 9.71e-01  4.89e-08  5.17e-08 | 2.0e-12  8.8e-01  co-a  9.50e-01
    9  -7.0711e-01  -7.0711e-01 | 9.85e-08  6.70e-09  6.16e-09 | 9.20e-01  1.00e-08  9.79e-09 | 3.9e-11  3.9e-01  co-a  8.00e-01
   10  -7.0711e-01  -7.0711e-01 | 8.77e-08  6.06e-09  5.57e-09 | 9.16e-01  9.63e-09  8.77e-09 | 6.1e-11  2.6e-02  co-a  1.00e-01
   11  -7.0711e-01  -7.0711e-01 | 8.34e-08  5.76e-09  5.29e-09 | 9.16e-01  9.10e-09  8.34e-09 | 3.9e-12  1.0e-03  co-a  5.00e-02
   12  -7.0711e-01  -7.0711e-01 | 8.25e-08  5.70e-09  5.24e-09 | 9.16e-01  9.01e-09  8.25e-09 | 6.4e-13  8.8e-06  co-a  1.00e-02
   13  -7.0711e-01  -7.0711e-01 | 8.17e-08  5.64e-09  5.19e-09 | 9.16e-01  8.92e-09  8.17e-09 | 6.5e-15  7.9e-08  co-a  1.00e-02
   14  -7.0711e-01  -7.0711e-01 | 8.13e-08  5.61e-09  5.16e-09 | 9.16e-01  8.88e-09  8.13e-09 | 1.1e-16  5.8e-09  co-a  5.00e-03
   15  -7.0711e-01  -7.0711e-01 | 8.12e-08  5.61e-09  5.16e-09 | 9.16e-01  8.87e-09  8.12e-09 | 1.1e-16  5.4e-09  co-a  1.00e-03
   16  -7.0711e-01  -7.0711e-01 | 8.11e-08  5.60e-09  5.15e-09 | 9.16e-01  8.86e-09  8.11e-09 | 5.6e-17  8.4e-09  co-a  1.00e-03
trying combined without adjustment
trying centering with adjustment
   17  -7.0711e-01  -7.0711e-01 | 8.11e-08  5.60e-09  5.15e-09 | 9.16e-01  8.86e-09  8.11e-09 | 1.8e-16  8.6e-09  ce-a  1.00e+00
trying combined without adjustment
trying centering with adjustment
   18  -7.0711e-01  -7.0711e-01 | 8.11e-08  5.60e-09  5.15e-09 | 9.16e-01  8.86e-09  8.11e-09 | 5.6e-17  7.8e-09  ce-a  1.00e+00
trying combined without adjustment
trying centering with adjustment
   19  -7.0711e-01  -7.0711e-01 | 8.11e-08  5.60e-09  5.15e-09 | 9.16e-01  8.86e-09  8.11e-09 | 5.6e-17  7.8e-09  ce-a  1.00e+00
slow progress in consecutive iterations; terminating
optimal solution found; terminating

status is NearOptimal after 19 iterations and 0.013 seconds

I get:

julia> solution_summary(model)
* Solver : Hypatia

* Status
  Result count       : 1
  Termination status : ALMOST_OPTIMAL
  Message from the solver:
  "NearOptimal"

* Candidate solution (result #1)
  Primal status      : NEARLY_FEASIBLE_POINT
  Dual status        : NEARLY_FEASIBLE_POINT
  Objective value    : -7.07107e-01
  Dual objective value : -7.07107e-01

* Work counters
  Solve time (sec)   : 1.35140e-02
  Barrier iterations : 19

but the solution is strictly primal feasible:

julia> primal_feasibility_report(model)
Dict{Any, Float64}()

Seems like the correct solution to me:

julia> value(x), value(y)
(0.7071067705995698, 0.4999999983377382)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants