Solving MCP with PathSolver with indexing

You’d have to provide a reproducible example. What J?

It’s probably something to do with a maximum number of elements in a tuple or splatting. JuMP’s user-defined operators are not designed for a very large number of input variables.

One obvious thing that struck me: you don’t need to pass J^2 variables to the function. Do something like:

function example_one_go(
    J::Int,
    S::Int,
    A::Matrix,
    Guess_y::Vector{Float64},
    z::Vector{Float64},
    C::Matrix,
    Guess::Matrix,
)
    denom_i, v, last = zeros(S), zeros(S), nothing
    function update_cache(i, j, x)
        if (i, j, x) != last
            denom_i .= A * collect(x)
            for s in 1:S
                v[s] = A[s, j] / denom_i[s]^2
            end
            last = (i, j, x)
        end
        return
    end
    function f(x_i, x_j, x...)
        i, j = round(Int, x_i), round(Int, x_j)
        update_cache(i, j, x)
        return sum(A[s, j] / denom_i[s] for s in 1:S) / S
    end
    function ∇f(g, x_i, x_j, x...)
        i, j = round(Int, x_i), round(Int, x_j)
        update_cache(i, j, x)
        fill!(g, 0.0)
        for q in 1:J
            g[2+q] = -sum(A[s, q] * v[s] for s in 1:S) / S
        end
        return
    end
    model = Model(PATHSolver.Optimizer)
    @operator(model, op_f, 2 + J, f, ∇f)
    @variable(model, x[i = 1:J, j = 1:J] >= 0, start = Guess[i, j])
    @variable(model, y[i = 1:J] >= 0, start = Guess_y[i])
    fix(y[1], 1.0; force = true)
    @constraints(model, begin
        [i in 1:J, j in 1:J],
            -y[i] * op_f(i, j, x[i:J:end]...) + y[j] * C[i, j] / z[j] ⟂ x[i, j]
        # 0.0 ⟂ y[1]  # Added by default
        [i in 2:J], -sum(x[j, i] * C[i, j] for j in 1:J) + z[i] ⟂ y[i]
    end)
    optimize!(model)
    @assert is_solved_and_feasible(model)
    X, Y = value.(x), value.(y)
    return X, Y, Y ./ z .* C .* X
end
1 Like

Yes, this is totally right. Thanks so much!

1 Like

It will still struggle with large J but you should be able to scale much better than before.

1 Like

With J = 100, it goes from 1600seconds to 60seconds, the improvement is huge!!

However, something weird is still happening. The performance worsens very nonlinearly as J increases. For example, with J = 110 it takes 70s, which is great, with J=120 it takes 520s, with J = 125 it explodes…

J = 110
 73.061723 seconds (345.94 M allocations: 14.264 GiB, 2.40% gc time, 8.68% 

J = 120
519.714881 seconds (1.93 G allocations: 74.770 GiB, 1.29% gc time, 0.11% compilation time)

with J = 125 it has taken most than two hours.

I understand that the complexity of the problem increases quadratically in J, however, this very nonlinear behavior cannot be an issue of the increase in J only.

However, I do not see any particular Performance Issues on my Task Manager.

Edit: with J = 125, I got:

SLOW_PROGRESS
Raw status: A stationary point was found
10669.760478 seconds (10.48 G allocations: 401.437 GiB, 0.38% gc time, 0.06% compilation time: <1% of which was recompilation)

Is the issue that JuMP is taking a long time to setup the problem or compute iterations? Or that PATH requires a large number of iterations to converge?

Optimization problems do not have linear complexity. Increasing J may result in arbitrarily increased computation times.

The time it takes to compute iterations grows a lot when moving from J = 121 to J = 122.

See the outputs:

J = 121
Major Iterations. . . . 69
Minor Iterations. . . . 74480
Restarts. . . . . . . . 1
Crash Iterations. . . . 3
Gradient Steps. . . . . 3
Function Evaluations. . 132
Gradient Evaluations. . 74
Basis Time. . . . . . . 84.246000
Total Time. . . . . . . 299.281000
Residual. . . . . . . . 4.800432e-07
Postsolved residual: 4.8004e-07
LOCALLY_SOLVED
Raw status: The problem was solved

J = 122
Major Iterations. . . . 91
Minor Iterations. . . . 144747
Restarts. . . . . . . . 1
Crash Iterations. . . . 1
Gradient Steps. . . . . 6
Function Evaluations. . 242
Gradient Evaluations. . 94
Basis Time. . . . . . . 2673.072000
Total Time. . . . . . . 3056.640000
Residual. . . . . . . . 1.643969e-07
Postsolved residual: 1.6440e-07
LOCALLY_SOLVED
Raw status: The problem was solved

I don’t know exactly what Basis Time measures, but I don’t think it’s Julia callback time. I assume it includes the time spent factorizing the basis matrix. You could try: GitHub - chkwon/PATHSolver.jl: provides a Julia wrapper for the PATH Solver for solving mixed complementarity problems

I am trying to write the code calling GAMS to see if there are any performance gains, but somehow it does not allow me to put lower bounds of my variables.

If I put the lower bounds x[i=1:J,j=1:J]>=0 and y[i=1:J]>=0, and use this function, in the MWE above

function example_gams(
    J::Int,
    S::Int,
    A::Matrix,
    Guess_y::Vector{Float64},
    z::Vector{Float64},
    C::Matrix,
    Guess::Matrix,
    )
    model = Model(GAMS.Optimizer)
    set_optimizer_attribute(model, GAMS.ModelType(), "MCP")

    # Define variables
    @variable(model, x[i=1:J, j=1:J]>=0, start = Guess[i, j])
    @variable(model, y[i=1:J]>=0, start = Guess_y[i])
    JuMP.fix(y[1], 1.0; force=true)
    
    @constraint(
            model,[i in 1:J, j in 1:J],complements(
            -y[i]*(
                (1/S)*sum(
                    A[s,j] / ( sum( A[s,q]*x[i,q] for q=1:J ) )
                for s in 1:S)
            ) + y[j]*C[i,j]/z[j], x[i,j])
        )

        @constraint(
            model,[i in 2:J],
            -sum(x[j, i] * C[i, j] for j in 1:J) +
             z[i]  ⟂ y[i]
        )
    optimize!(model)
    @assert is_solved_and_feasible(model)
    X, Y = value.(x), value.(y)
    return X, Y, Y ./ z .* C .* X
end

I get:

--- Job moi.gms Start 01/25/25 18:33:13 48.5.0 5f05ac2f WEX-WEI x86 64bit/MS Windows
--- Applying:
    C:\GAMS\48\gmsprmNT.txt
--- GAMS Parameters defined
    Input C:\Users\XXX\AppData\Local\Temp\gams_jl_9saPJq\moi.gms
    ScrDir C:\Users\XXX\AppData\Local\Temp\gams_jl_9saPJq\225a\
    SysDir C:\GAMS\48\
    CurDir C:\Users\XXX\AppData\Local\Temp\gams_jl_9saPJq\
    LimRow 0
    LimCol 0
    SolPrint 0
    SavePoint 1
    SolveLink 5
Licensee: GAMS Demo, for EULA and demo limitations see   G241001/0001CB-GEN
          https://www.gams.com/latest/docs/UG%5FLicense.html         DC0000
          C:\GAMS\48\gamslice.txt
          Demo license for demonstration and instructional purposes only
Processor information: 1 socket(s), 16 core(s), and 22 thread(s) available
GAMS 48.5.0   Copyright (C) 1987-2024 GAMS Development. All rights reserved
--- Starting compilation
--- moi.gms(27819) 8 Mb
--- Starting execution: elapsed 0:00:00.099
--- moi.gms(27753) 9 Mb
--- Generating MCP model m
--- moi.gms(27785) 11 Mb 101 Errors
---   309 rows  310 columns  1,680 non-zeroes
---   1 fixed-and-unmatched column(s) will be treated as constant
---   230,420 nl-code  1,100 nl-non-zeroes
--- Range statistics (absolute non-zero finite values)
--- RHS       [min, max] : [ 1.027E-01, 2.781E-01] - Zero values observed as well
--- Bound     [min, max] : [ 1.000E+00, 1.000E+00] - Zero values observed as well
--- Matrix    [min, max] : [ 9.011E-03, 1.217E+01]
--- moi.gms(27785) 9 Mb
*** SOLVE aborted
--- moi.gms(27785) 9 Mb 101 Errors
*** Status: Execution error(s)
--- Job moi.gms Stop 01/25/25 18:33:13 elapsed 0:00:00.139
ERROR: GAMS compilation failed:
GAMS 48.5.0  5f05ac2f Dec 20, 2024          WEX-WEI x86 64bit/MS Windows - 01/25/25 18:33:13 Page 1
G e n e r a l   A l g e b r a i c   M o d e l i n g   S y s t e m
C o m p i l a t i o n


   1  *
   2  * GAMS Model generated by GAMS.jl
   3  *
   4


COMPILATION TIME     =        0.079 SECONDS      8 MB  48.5.0 5f05ac2f WEX-WEI
GAMS 48.5.0  5f05ac2f Dec 20, 2024          WEX-WEI x86 64bit/MS Windows - 01/25/25 18:33:13 Page 2
G e n e r a l   A l g e b r a i c   M o d e l i n g   S y s t e m
Model Analysis      SOLVE m Using MCP From line 27785


**** Unmatched variable not free or fixed
     x1

**** Unmatched variable not free or fixed
     x2

**** Unmatched variable not free or fixed
     x3

**** Unmatched variable not free or fixed
     x4

**** Unmatched variable not free or fixed
     x5

**** Unmatched variable not free or fixed
     x6

**** Unmatched variable not free or fixed
     x7

**** Unmatched variable not free or fixed
     x8

**** Unmatched variable not free or fixed
     x9

**** Unmatched variable not free or fixed
     x10

**** Unmatched variable not free or fixed
     x11

**** Unmatched variable not free or fixed
     x12

**** Unmatched variable not free or fixed
     x13

**** Unmatched variable not free or fixed
     x14

**** Unmatched variable not free or fixed
     x15

**** Unmatched variable not free or fixed
     x16

**** Unmatched variable not free or fixed
     x17

**** Unmatched variable not free or fixed
     x18

**** Unmatched variable not free or fixed
     x19

**** Unmatched variable not free or fixed
     x20

**** Unmatched variable not free or fixed
     x21

**** Unmatched variable not free or fixed
     x22

**** Unmatched variable not free or fixed
     x23

**** Unmatched variable not free or fixed
     x24

**** Unmatched variable not free or fixed
     x25

**** Unmatched variable not free or fixed
     x26

**** Unmatched variable not free or fixed
     x27

**** Unmatched variable not free or fixed
     x28

**** Unmatched variable not free or fixed
     x29

**** Unmatched variable not free or fixed
     x30

**** Unmatched variable not free or fixed
     x31

**** Unmatched variable not free or fixed
     x32

**** Unmatched variable not free or fixed
     x33

**** Unmatched variable not free or fixed
     x34

**** Unmatched variable not free or fixed
     x35

**** Unmatched variable not free or fixed
     x36

**** Unmatched variable not free or fixed
     x37

**** Unmatched variable not free or fixed
     x38

**** Unmatched variable not free or fixed
     x39

**** Unmatched variable not free or fixed
     x40

**** Unmatched variable not free or fixed
     x41

**** Unmatched variable not free or fixed
     x42

**** Unmatched variable not free or fixed
     x43

**** Unmatched variable not free or fixed
     x44

**** Unmatched variable not free or fixed
     x45

**** Unmatched variable not free or fixed
     x46

**** Unmatched variable not free or fixed
     x47

**** Unmatched variable not free or fixed
     x48

**** Unmatched variable not free or fixed
     x49

**** Unmatched variable not free or fixed
     x50

**** Unmatched variable not free or fixed
     x51

**** Unmatched variable not free or fixed
     x52

**** Unmatched variable not free or fixed
     x53

**** Unmatched variable not free or fixed
     x54

**** Unmatched variable not free or fixed
     x55

**** Unmatched variable not free or fixed
     x56

**** Unmatched variable not free or fixed
     x57

**** Unmatched variable not free or fixed
     x58

**** Unmatched variable not free or fixed
     x59

**** Unmatched variable not free or fixed
     x60

**** Unmatched variable not free or fixed
     x61

**** Unmatched variable not free or fixed
     x62

**** Unmatched variable not free or fixed
     x63

**** Unmatched variable not free or fixed
     x64

**** Unmatched variable not free or fixed
     x65

**** Unmatched variable not free or fixed
     x66

**** Unmatched variable not free or fixed
     x67

**** Unmatched variable not free or fixed
     x68

**** Unmatched variable not free or fixed
     x69

**** Unmatched variable not free or fixed
     x70

**** Unmatched variable not free or fixed
     x71

**** Unmatched variable not free or fixed
     x72

**** Unmatched variable not free or fixed
     x73

**** Unmatched variable not free or fixed
     x74

**** Unmatched variable not free or fixed
     x75

**** Unmatched variable not free or fixed
     x76

**** Unmatched variable not free or fixed
     x77

**** Unmatched variable not free or fixed
     x78

**** Unmatched variable not free or fixed
     x79

**** Unmatched variable not free or fixed
     x80

**** Unmatched variable not free or fixed
     x81

**** Unmatched variable not free or fixed
     x82

**** Unmatched variable not free or fixed
     x83

**** Unmatched variable not free or fixed
     x84

**** Unmatched variable not free or fixed
     x85

**** Unmatched variable not free or fixed
     x86

**** Unmatched variable not free or fixed
     x87

**** Unmatched variable not free or fixed
     x88

**** Unmatched variable not free or fixed
     x89

**** Unmatched variable not free or fixed
     x90

**** Unmatched variable not free or fixed
     x91

**** Unmatched variable not free or fixed
     x92

**** Unmatched variable not free or fixed
     x93

**** Unmatched variable not free or fixed
     x94

**** Unmatched variable not free or fixed
     x95

**** Unmatched variable not free or fixed
     x96

**** Unmatched variable not free or fixed
     x97

**** Unmatched variable not free or fixed
     x98

**** Unmatched variable not free or fixed
     x99

**** Unmatched variable not free or fixed
     x100

**** Counts do not match
     Single equations in unmatched =E= blocks      200
     Unmatched single free variables               100

**** Unmatched free variables = 100
     x111
     x113
     x115
     x117
     x119
     x121
     x123
     x125
     x127
     x129
     x131
     x133
     x135
     x137
     x139
     x141
     x143
     x145
     x147
     x149
     x151
     x153
     x155
     x157
     x159
     x161
     x163
     x165
     x167
     x169
     x171
     x173
     x175
     x177
     x179
     x181
     x183
     x185
     x187
     x189
     x191
     x193
     x195
     x197
     x199
     x201
     x203
     x205
     x207
     x209
     x211
     x213
     x215
     x217
     x219
     x221
     x223
     x225
     x227
     x229
     x231
     x233
     x235
     x237
     x239
     x241
     x243
     x245
     x247
     x249
     x251
     x253
     x255
     x257
     x259
     x261
     x263
     x265
     x267
     x269
     x271
     x273
     x275
     x277
     x279
     x281
     x283
     x285
     x287
     x289
     x291
     x293
     x295
     x297
     x299
     x301
     x303
     x305
     x307
     x309

**** Number of unmatched =E= rows : 200
     eq1
     eq2
     eq3
     eq4
     eq5
     eq6
     eq7
     eq8
     eq9
     eq10
     eq11
     eq12
     eq13
     eq14
     eq15
     eq16
     eq17
     eq18
     eq19
     eq20
     eq21
     eq22
     eq23
     eq24
     eq25
     eq26
     eq27
     eq28
     eq29
     eq30
     eq31
     eq32
     eq33
     eq34
     eq35
     eq36
     eq37
     eq38
     eq39
     eq40
     eq41
     eq42
     eq43
     eq44
     eq45
     eq46
     eq47
     eq48
     eq49
     eq50
     eq51
     eq52
     eq53
     eq54
     eq55
     eq56
     eq57
     eq58
     eq59
     eq60
     eq61
     eq62
     eq63
     eq64
     eq65
     eq66
     eq67
     eq68
     eq69
     eq70
     eq71
     eq72
     eq73
     eq74
     eq75
     eq76
     eq77
     eq78
     eq79
     eq80
     eq81
     eq82
     eq83
     eq84
     eq85
     eq86
     eq87
     eq88
     eq89
     eq90
     eq91
     eq92
     eq93
     eq94
     eq95
     eq96
     eq97
     eq98
     eq99
     eq100
     eq101
     eq102
     eq103
     eq104
     eq105
     eq106
     eq107
     eq108
     eq109
     eq110
     eq111
     eq112
     eq113
     eq114
     eq115
     eq116
     eq117
     eq118
     eq119
     eq120
     eq121
     eq122
     eq123
     eq124
     eq125
     eq126
     eq127
     eq128
     eq129
     eq130
     eq131
     eq132
     eq133
     eq134
     eq135
     eq136
     eq137
     eq138
     eq139
     eq140
     eq141
     eq142
     eq143
     eq144
     eq145
     eq146
     eq147
     eq148
     eq149
     eq150
     eq151
     eq152
     eq153
     eq154
     eq155
     eq156
     eq157
     eq158
     eq159
     eq160
     eq161
     eq162
     eq163
     eq164
     eq165
     eq166
     eq167
     eq168
     eq169
     eq170
     eq171
     eq172
     eq173
     eq174
     eq175
     eq176
     eq177
     eq178
     eq179
     eq180
     eq181
     eq182
     eq183
     eq184
     eq185
     eq186
     eq187
     eq188
     eq189
     eq190
     eq191
     eq192
     eq193
     eq194
     eq195
     eq196
     eq197
     eq198
     eq199
     eq200
GAMS 48.5.0  5f05ac2f Dec 20, 2024          WEX-WEI x86 64bit/MS Windows - 01/25/25 18:33:13 Page 3
G e n e r a l   A l g e b r a i c   M o d e l i n g   S y s t e m
Range Statistics    SOLVE m Using MCP From line 27785


RANGE STATISTICS (ABSOLUTE NON-ZERO FINITE VALUES)

RHS       [min, max] : [ 1.027E-01, 2.781E-01] - Zero values observed as well
Bound     [min, max] : [ 1.000E+00, 1.000E+00] - Zero values observed as well
Matrix    [min, max] : [ 9.011E-03, 1.217E+01]

GAMS 48.5.0  5f05ac2f Dec 20, 2024          WEX-WEI x86 64bit/MS Windows - 01/25/25 18:33:13 Page 4
G e n e r a l   A l g e b r a i c   M o d e l i n g   S y s t e m
Model Statistics    SOLVE m Using MCP From line 27785


MODEL STATISTICS

BLOCKS OF EQUATIONS         309     SINGLE EQUATIONS          309
BLOCKS OF VARIABLES         310     SINGLE VARIABLES          310
NON ZERO ELEMENTS         1,680     NON LINEAR N-Z          1,100
CODE LENGTH             230,420     CONSTANT POOL           1,027


GENERATION TIME      =        0.046 SECONDS      9 MB  48.5.0 5f05ac2f WEX-WEI

**** SOLVE from line 27785 ABORTED, EXECERROR = 101


EXECUTION TIME       =        0.046 SECONDS      9 MB  48.5.0 5f05ac2f WEX-WEI


USER: GAMS Demo, for EULA and demo limitations see   G241001/0001CB-GEN
      https://www.gams.com/latest/docs/UG%5FLicense.html         DC0000


**** FILE SUMMARY

Input      C:\Users\XXX\AppData\Local\Temp\gams_jl_9saPJq\moi.gms
Output     C:\Users\XXX\AppData\Local\Temp\gams_jl_9saPJq\moi.lst

**** USER ERROR(S) ENCOUNTERED

If I were to remove the lower bounds, I get negative x’s.

@renke.kuhlmann ??

Replied in issue Trouble setting up MCP · Issue #28 · GAMS-dev/gams.jl · GitHub

@odow

Can you help me understand this error? I get this with J=401.

Optimizing
Path 5.0.03 (Fri Jun 26 10:05:33 2020)
Written by Todd Munson, Steven Dirkse, Youngdae Kim, and Michael Ferris

Preprocessed size   : 161201

Crash Log
major  func  diff  size  residual    step       prox   (label)
    0     0             4.3367e+01             0.0e+00 ()
    1     6  7760 13168 3.5554e+01  1.7e-01    4.3e-01 ()
    2    15  8493 14989 3.5162e+01  1.2e-02    3.6e-01 ()
pn_search terminated: no progress.

Major Iteration Log
major minor  func  grad  residual    step  type prox    inorm  (label)
    0     0    28     3 3.5162e+01           I 3.2e-01 1.1e+01 ()

Minor Iteration Log
minor      t          z     w     v   art ckpts  enter    leave
  500 -1.6551e-04 13720 147480     0     0     9 w[152063] z[131430]
 1000 -1.5535e-03 13304 147896     0     0    19 w[67170] z[52975]

Minor Iteration Log
minor      t          z     w     v   art ckpts  enter    leave
  500 -1.4606e+00   499 160701     0     0     9 z[76907] w[52841]
 1000 -1.3016e+00   999 160201     0     0    19 z[76901] w[135936]
 1500 -1.2033e+00  1495 159705     0     0    29 z[52852] w[127020]
 2000 -1.0935e+00  1989 159211     0     0    39 z[91813] w[14374]
 2500 -9.8852e-01  2461 158739     0     0    49 z[118258] w[62939]
 3000 -8.9133e-01  2931 158269     0     0    58 z[109854] w[46464]
 3500 -7.9419e-01  3384 157816     0     0    68 z[31238] z[130255]
 4000 -7.0301e-01  3823 157377     0     0    78 z[116245] w[141118]
 4500 -6.3134e-01  4197 157003     0     0    88 z[86606] w[101035]
 5000 -5.7737e-01  4425 156775     0     0    98 z[15622] w[89809]
 5500 -5.3505e-01  4655 156545     0     0   107 w[141048] w[10329]
 6000 -5.0512e-01  4833 156367     0     0   117 w[102558] w[95414]
 6500 -4.7452e-01  5047 156153     0     0   127 z[132271] w[53280]
 7000 -4.4930e-01  5229 155971     0     0   137 z[15638] w[101417]
 7500 -4.3000e-01  5445 155755     0     0   147 z[18038] w[19618]
 8000 -4.1383e-01  5598 155602     0     0   156 z[102232] z[102548]
 8500 -4.0043e-01  5767 155433     0     0   166 z[26803] w[78486]
 9000 -3.8907e-01  5929 155271     0     0   176 z[161076] w[90149]
 9500 -3.7844e-01  6103 155097     0     0   186 z[14322] w[66510]
10000 -3.6861e-01  6245 154955     0     0   196 w[53222] w[36071]

Major Iteration Log
major minor  func  grad  residual    step  type prox    inorm  (label)
    1 10000    29     4 3.2613e+01  1.0e+00 IM 1.3e-01 1.6e+00 ()

Minor Iteration Log
minor      t          z     w     v   art ckpts  enter    leave
  500  1.0033e-07  6744 154456     0     0     9 z[17100] w[85305]
 1000  2.2054e-07  7244 153956     0     0    19 z[ 5131] w[82063]

Major Iteration Log
major minor  func  grad  residual    step  type prox    inorm  (label)
    2  1000    30     5 3.2613e+01  1.0e+00 IO 5.1e-02 1.6e+00 ()

Minor Iteration Log
minor      t          z     w     v   art ckpts  enter    leave
  500  2.6203e-07  7743 153457     0     0     9 z[64045] w[35983]
 1000  6.0940e-06  8241 152959     0     0    19 z[ 7531] w[68055]

Major Iteration Log
major minor  func  grad  residual    step  type prox    inorm  (label)
    3  1000    31     6 3.2613e+01  1.0e+00 IO 2.0e-02 1.6e+00 ()

Minor Iteration Log
minor      t          z     w     v   art ckpts  enter    leave
  500  5.6697e-07  8740 152460     0     0     9 z[50438] w[70870]
 1000  1.1703e-06  9240 151960     0     0    19 z[47182] w[45578]

Major Iteration Log
major minor  func  grad  residual    step  type prox    inorm  (label)
    4  1000    32     7 3.2613e+01  1.0e+00 IO 8.2e-03 1.6e+00 ()

Minor Iteration Log
minor      t          z     w     v   art ckpts  enter    leave
  500  1.1210e-07 103233 57967     0     0     9 w[147935] z[147933]
 1000  2.5095e-07 102733 58467     0     0    19 w[110652] z[110649]

Major Iteration Log
major minor  func  grad  residual    step  type prox    inorm  (label)
    5  1000    33     8 3.2613e+01  1.0e+00 IO 3.3e-03 1.6e+00 ()

Minor Iteration Log
minor      t          z     w     v   art ckpts  enter    leave
  500 -3.1006e-01   459 160741     0     0     9 z[123108] w[160987]
 1000 -5.8364e-02   887 160313     0     0    19 z[ 3602] w[17213]
 1500 -4.4257e-02  1377 159823     0     0    29 z[95831] w[51708]
 2000 -3.7159e-02  1871 159329     0     0    39 z[ 5207] w[99846]
 2500 -3.2178e-02  2353 158847     0     0    49 z[95806] w[55704]
 3000 -2.8736e-02  2747 158453     0     0    58 z[111415] w[55662]
 3500 -2.6041e-02  3211 157989     0     0    68 w[ 7189] w[51581]
 4000 -2.3850e-02  3577 157623     0     0    78 z[78511] w[50123]
 4500 -2.2071e-02  3923 157277     0     0    88 z[55287] w[51304]
 5000 -2.1406e-02  4221 156979     0     0    98 z[15126] w[ 5474]
 5500 -2.1116e-02  4493 156707     0     0   107 z[42858] w[161075]
 6000 -2.0911e-02  4576 156624     0     0   117 w[136277] z[139085]
 6500 -2.0717e-02  4735 156465     0     0   127 z[64123] w[68901]
 7000 -2.0544e-02  4897 156303     0     0   137 w[84576] w[26442]
 7500 -2.0391e-02  5019 156181     0     0   147 z[47643] w[26012]
 8000 -2.0257e-02  5143 156057     0     0   156 z[33179] w[ 2393]
 8500 -2.0123e-02  5192 156008     0     0   166 w[48500] z[ 5163]
 9000 -2.0008e-02  5171 156029     0     0   176 z[48923] w[100248]
 9500 -1.9895e-02  5161 156039     0     0   186 z[86194] w[11629]
10000 -1.9788e-02  5101 156099     0     0   196 z[11207] w[35217]

Major Iteration Log
major minor  func  grad  residual    step  type prox    inorm  (label)
    6 10000    48     9 3.1869e+01  4.3e-08 IG 1.3e-03 1.6e+00 ()
ERROR: LoadError: UndefVarError: `SIGINT` not defined in `Main`
Suggestion: check for spelling errors or missing imports.
 [2] top-level scope
   @ .\timing.jl:581
in expression starting at \example_code.jl:1883

caused by: ReadOnlyMemoryError()
Stacktrace:
  [1] c_api_Path_Solve
    @ C:\Users\ \.julia\packages\PATHSolver\I2W8G\src\C_API.jl:567 [inlined]
  [2] solve_mcp(F::PATHSolver.var"#F#10"{MathOptInterface.Nonlinear.Evaluator{MathOptInterface.Nonlinear.ReverseAD.NLPE
valuator}}, J::PATHSolver.var"#J#11"{Vector{Int64}, Vector{Int64}, Vector{Tuple{Int64, Int64}}, 
MathOptInterface.Nonlinear.Evaluator{MathOptInterface.Nonlinear.ReverseAD.NLPEvaluator}}, lb::Vector{Float64}, 
ub::Vector{Float64}, z::Vector{Float64}; nnz::Int64, variable_names::Vector{String}, constraint_names::Vector{String}, 
silent::Bool, generate_output::Int64, use_start::Bool, use_basics::Bool, jacobian_structure_constant::Bool, 
jacobian_data_contiguous::Bool, jacobian_linear_elements::Vector{Int64}, 
kwargs::@Kwargs{cumulative_iteration_limit::Int64, convergence_tolerance::Float64, time_limit::Int64, 
minor_iteration_limit::Int64, major_iteration_limit::Int64})
    @ PATHSolver C:\Users\ \.julia\packages\PATHSolver\I2W8G\src\C_API.jl:811
  [3] optimize!(model::MathOptInterface.Utilities.GenericOptimizer{Float64, 
MathOptInterface.Utilities.ObjectiveContainer{Float64}, MathOptInterface.Utilities.VariablesContainer{Float64}, 
PATHSolver.OptimizerFunctionConstraints{Float64}})
    @ PATHSolver C:\Users\ \.julia\packages\PATHSolver\I2W8G\src\MOI_wrapper.jl:398
  [4] optimize!
    @ C:\Users\ \.julia\packages\MathOptInterface\MQX8C\src\Bridges\bridge_optimizer.jl:367 [inlined]
  [5] optimize!
    @ C:\Users\ \.julia\packages\MathOptInterface\MQX8C\src\MathOptInterface.jl:122 [inlined]
  [6] optimize!(m::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.Bridges.LazyBridgeOptimizer{MathOptInte
rface.Utilities.GenericOptimizer{Float64, MathOptInterface.Utilities.ObjectiveContainer{Float64}, 
MathOptInterface.Utilities.VariablesContainer{Float64}, PATHSolver.OptimizerFunctionConstraints{Float64}}}, 
MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}})
    @ MathOptInterface.Utilities 
C:\Users\ \.julia\packages\MathOptInterface\MQX8C\src\Utilities\cachingoptimizer.jl:321
  [7] optimize!(model::Model; ignore_optimize_hook::Bool, 
_differentiation_backend::MathOptInterface.Nonlinear.SparseReverseMode, kwargs::@Kwargs{})
    @ JuMP C:\Users\ \.julia\packages\JuMP\CU7H5\src\optimizer_interface.jl:595
  [8] optimize!
    @ C:\Users\ \.julia\packages\JuMP\CU7H5\src\optimizer_interface.jl:546 [inlined]
  [9] example_one_go(    J::Int,    S::Int,    A::Matrix,    Guess_y::Vector{Float64},    z::Vector{Float64},  C::Matrix,    Guess::Matrix,)    
@ Main Code\example_code.jl:1621
 [10] example_one_go(    
    @ Code\example_code.jl:1565 [inlined]
 [11] macro expansion
    @ .\timing.jl:581 [inlined]
     @ Main Code\example_code.jl:1736
 [13] top-level scope
    @ .\timing.jl:581

I am confused about the ReadOnlyMemoryError().

ReadOnlyMemoryError is thrown when you have run out of memory.

I don’t know where the SIGINT is coming from. It’s not anywhere in our code.