Clarabel optimization brings different result from other optimizers

Because Clarabel gives different results from other optimizers, since the same implementation was used, only changing the name of the solver in JuMP?

**           Clarabel.jl v0.5.1  -  Clever Acronym              **
**                   (c) Paul Goulart                          **
**                University of Oxford, 2022                   **

**  variables     = 721**
**  constraints   = 721**
**  nnz(P)        = 222912**
**  nnz(A)        = 721**
**  cones (total) = 1**
**    : Nonnegative = 1,  numel = 721**

**  linear algebra: direct / qdldl, precision: Float64**
**  max iter = 200, time limit = Inf,  max step = 0.990**
**  tol_feas = 1.0e-08, tol_gap_abs = 1.0e-08, tol_gap_rel = 1.0e-08,**
**  static reg : on, ϵ1 = 1.0e-08, ϵ2 = 4.9e-32**
**  dynamic reg: on, ϵ = 1.0e-13, δ = 2.0e-07**
**  iter refine: on, reltol = 1.0e-13, abstol = 1.0e-12, **
**               max iter = 10, stop ratio = 5.0**
**  equilibrate: on, min_scale = 1.0e-04, max_scale = 1.0e+04**
**               max iter = 10**

**iter    pcost        dcost       gap       pres      dres      k/t        μ       step      **
**  0  -1.8868e+00  -4.1203e-04  1.89e+00  6.57e-01  9.21e-01  1.00e+00  2.07e+00    **
** 17  -2.4005e+03  -2.4005e+03  4.18e-09  6.43e-17  2.20e-14  1.07e-05  7.46e-14  9.90e-01  **
** 18  -2.4005e+03  -2.4005e+03  3.86e-10  7.49e-17  9.36e-15  8.56e-07  6.00e-15  9.90e-01  **
**Terminated with status = solved**
**solve time =  6.58s*
*Gurobi Optimizer version 9.5.2 build v9.5.2rc0 (win64)*
*Thread count: 2 physical cores, 4 logical processors, using up to 4 threads*
*Optimize a model with 721 rows, 721 columns and 721 nonzeros*
*Model fingerprint: 0x442e118e*
*Model has 203425 quadratic objective terms*
*Coefficient statistics:*
*  Matrix range     [1e+00, 1e+00]*
*  Objective range  [9e-08, 3e-02]*
*  QObjective range [1e-13, 2e-06]*
*  Bounds range     [0e+00, 0e+00]*
*  RHS range        [0e+00, 0e+00]*
*Presolve removed 721 rows and 122 columns*
*Presolve time: 1.56s*
*Presolved: 0 rows, 599 columns, 0 nonzeros*
*Presolved model has 155942 quadratic objective terms*
*Ordering time: 0.00s*

*Barrier statistics:*
* Free vars  : 598*
* AA' NZ     : 1.785e+05*
* Factor NZ  : 1.791e+05 (roughly 2 MB of memory)*
* Factor Ops : 7.146e+07 (less than 1 second per iteration)*
* Threads    : 2*

*                  Objective                Residual*
*Iter       Primal          Dual         Primal    Dual     Compl     Time*
*   0  -4.57446938e+06 -1.42070050e+05  2.88e+04 5.02e+01  9.88e+05     2s*
*   1   2.16194849e+07 -2.18945862e+07  3.41e+02 3.41e-13  8.40e+04     2s  *
*  16   1.19509684e+02  1.19509684e+02  5.67e-11 2.99e-14  1.01e-09     3s*

*Barrier solved model in 16 iterations and 3.45 seconds (1.13 work units)*
*Optimal objective 1.19509684e+02*

*User-callback calls 162, time in user-callback 0.05 sec*

Do you have a reproducible example? This is probably a bug in Clarabel. What happens if you use Ipopt?

Note that your objective contains very small coefficients. Clarabel probably encounters numerical issues and ignores the small values. What happens if you re-scale all terms in the objective by +1e8?

Ipopt behaved the same as Gurobi, but I would like to know what Clarabel’s problem is, because I’m testing different solvers.

This program contains Ipopt, a library for large-scale nonlinear optimization.
 Ipopt is released as open source code under the Eclipse Public License (EPL).
         For more information visit

This is Ipopt version 3.14.4, running with linear solver MUMPS 5.5.1.

Number of nonzeros in equality constraint Jacobian...:        0
Number of nonzeros in inequality constraint Jacobian.:      721
Number of nonzeros in Lagrangian Hessian.............:   222912

Total number of variables............................:      721
                     variables with only lower bounds:        0
                variables with lower and upper bounds:        0
                     variables with only upper bounds:        0
Total number of equality constraints.................:        0
Total number of inequality constraints...............:      721
        inequality constraints with only lower bounds:      721
   inequality constraints with lower and upper bounds:        0
        inequality constraints with only upper bounds:        0

iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
   0  2.5200000e+03 0.00e+00 5.13e-01  -1.0 0.00e+00    -  0.00e+00 0.00e+00   0
   1  2.5199054e+03 0.00e+00 3.54e-02  -1.7 3.03e-02    -  9.65e-01 1.00e+00f  1   
  47  1.1950969e+02 0.00e+00 2.51e-14  -8.6 7.98e-01    -  1.00e+00 1.00e+00f  1
  48  1.1950969e+02 0.00e+00 9.09e-15  -9.0 3.75e-01    -  1.00e+00 1.00e+00f  1

Number of Iterations....: 48

                                   (scaled)                 (unscaled)
Objective...............:   1.1950968677914057e+02    1.1950968677914057e+02
Dual infeasibility......:   9.0910352162909547e-15    9.0910352162909547e-15
Constraint violation....:   0.0000000000000000e+00    0.0000000000000000e+00
Variable bound violation:   0.0000000000000000e+00    0.0000000000000000e+00
Complementarity.........:   3.2345284045149366e-09    3.2345284045149366e-09
Overall NLP error.......:   3.2345284045149366e-09    3.2345284045149366e-09

Number of objective function evaluations             = 49
Number of objective gradient evaluations             = 49
Number of equality constraint evaluations            = 0
Number of inequality constraint evaluations          = 49
Number of equality constraint Jacobian evaluations   = 0
Number of inequality constraint Jacobian evaluations = 1
Number of Lagrangian Hessian evaluations             = 1
Total seconds in IPOPT                               = 2.797

When optimizing Clarabel, it does not show the value of the objective function, which in general in other solvers is the last iteration. It was necessary to use a

> status = termination_status(m)
> if status == MOI.OPTIMAL
>     obj_value = objective_value(m)
>     println("O valor ótimo da função objetivo é: ", obj_value)

Is the issue here that you want the Clarabel solver to report the final objective value in the output, or that the solver is not reporting the same optimal value as some other solver?

For the first case, you are right that Clarabel is not printing out the final objective. If the problem solves though, then the objective will be the final entry in the “pcost” column (i.e. last row, first entry after the iteration number). We could add it to the output as well if you make a feature request on github.

For the second case : I don’t know of any other examples where the solver is reporting a high accuracy solution but then getting a totally different optimal value than some other solver. The solver doesn’t ignore or zero out small entries in the objective or anything.

If you have a reproducible example then we would appreciate you filing it as a bug report.

I think the problem was just that the optimal objective value was not printed to the screen. It is available via objective_value(model).