UndefVarError: with_optimizer not defined with ProxSDP

I just installed ProxSDP, but when I tried this test code,

# Load packages
using ProxSDP, JuMP, LinearAlgebra

# Number of vertices
n = 4
# Graph weights
W = [18.0  -5.0  -7.0  -6.0
     -5.0   6.0   0.0  -1.0
     -7.0   0.0   8.0  -1.0
     -6.0  -1.0  -1.0   8.0]

# Build Max-Cut SDP relaxation via JuMP
model = Model(with_optimizer(ProxSDP.Optimizer, log_verbose=true, tol_gap=1e-4, tol_feasibility=1e-4))
@variable(model, X[1:n, 1:n], PSD)
@objective(model, Max, 0.25 * dot(W, X))
@constraint(model, diag(X) .== 1)

# Solve optimization problem with ProxSDP
JuMP.optimize!(model)

# Retrieve solution
Xsol = JuMP.value.(X)

I get the following error

UndefVarError: with_optimizer not defined

Stacktrace:
 [1] top-level scope
   @ In[1]:13
 [2] eval
   @ ./boot.jl:373 [inlined]
 [3] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
   @ Base ./loading.jl:1196
1 Like

The README example is out-of-date. Do instead:

model = Model(ProxSDP.Optimizer)
set_optimizer_attribute(model, "log_verbose", true)
set_optimizer_attribute(model, "tol_gap", 1e-4)
set_optimizer_attribute(model, "tol_feasibility", 1e-4)

I’ll update the README: Update README example by odow · Pull Request #92 · mariohsouto/ProxSDP.jl · GitHub

Thank you!

I am not sure if this can be fixed, but why doesn’t the solver output results in more digits or in exponential forms (Rather than meaningless 0.00000). Here is the output

Constraints:
       13 linear equalities and 
    Cones:
       1 psd cone of size 4
       2 psd cones of size 2
---------------------------------------------------------------------------------------
    Initializing Primal-Dual Hybrid Gradient method
---------------------------------------------------------------------------------------
|  iter  | prim obj | rel. gap |  feasb.  | prim res | dual res | tg. rank |  time(s) |
---------------------------------------------------------------------------------------
|   1000 |    0.000 |  0.00006 |  0.00008 |  0.00015 |  0.00026 |        6 |   0.0272 |
|   2000 |    0.000 |  0.00020 |  0.00001 |  0.00003 |  0.00007 |        6 |   0.0417 |
|   3000 |    0.000 |  0.00003 |  0.00000 |  0.00000 |  0.00001 |        6 |   0.0563 |
|   4000 |    0.000 |  0.00001 |  0.00000 |  0.00000 |  0.00001 |        6 |   0.0708 |
|   5000 |    0.000 |  0.00001 |  0.00000 |  0.00000 |  0.00001 |        6 |   0.0862 |
|   6000 |    0.000 |  0.00000 |  0.00000 |  0.00000 |  0.00000 |        6 |   0.1015 |
|   7000 |    0.000 |  0.00000 |  0.00000 |  0.00000 |  0.00000 |        6 |   0.1161 |
|   8000 |    0.000 |  0.00000 |  0.00000 |  0.00000 |  0.00000 |        6 |   0.1311 |
|   9000 |    0.000 |  0.00000 |  0.00000 |  0.00000 |  0.00000 |        6 |   0.1465 |
|  10000 |    0.000 |  0.00000 |  0.00000 |  0.00000 |  0.00000 |        6 |   0.1620 |
|  11000 |    0.000 |  0.00000 |  0.00000 |  0.00000 |  0.00000 |        6 |   0.1770 |
|  12000 |    0.000 |  0.00000 |  0.00000 |  0.00000 |  0.00000 |        6 |   0.1918 |
|  13000 |    0.000 |  0.00000 |  0.00000 |  0.00000 |  0.00000 |        6 |   0.2066 |
|  14000 |    0.000 |  0.00000 |  0.00000 |  0.00000 |  0.00000 |        6 |   0.2219 |
|  15000 |    0.000 |  0.00000 |  0.00000 |  0.00000 |  0.00000 |        6 |   0.2364 |
|  16000 |    0.000 |  0.00000 |  0.00000 |  0.00000 |  0.00000 |        6 |   0.2508 |
|  17000 |    0.000 |  0.00000 |  0.00000 |  0.00000 |  0.00000 |        6 |   0.2662 |
|  18000 |    0.000 |  0.00000 |  0.00000 |  0.00000 |  0.00000 |        6 |   0.2818 |
|  19000 |    0.000 |  0.00000 |  0.00000 |  0.00000 |  0.00000 |        6 |   0.2965 |

This is a question for @joaquimg

Thanks for the feedback @horvetz. I modified the output of the solver on ProxSDP v1.8.2. You just need to upgrade your version.

1 Like