Closed mwetz closed 1 month ago
Is it possible to share your script?
Since our script is in a more complex workflow we created a minimum example to reproduce the issue. The error occurs between 2-3 minutes into the run. The Windows machine was able to complete it, while the Linux machine got stuck again when calling the solver.
import sys
import gamspy as gp
import numpy as np
rng = np.random.default_rng(seed=0)
size = int(5e6)
rands = 1000 * rng.random(size=size)
ct = gp.Container()
S = ct.addSet("S", records=range(len(rands)))
p = ct.addParameter("p", [S], records=rands)
p[S] = 1
x = ct.addVariable("x", domain=S)
eq = ct.addEquation("eq", domain=S)
eq[S] = x[S] >= p[S]
obj = gp.Sum(S, x[S])
m = ct.addModel("m", gp.Problem.LP, [eq], gp.Sense.MIN, obj)
res = m.solve(output=sys.stdout)
And here's the logfile:
--- _5ee820bf-f61c-4734-be64-2f16aaac5447.gms(41) 1839 Mb 125 secs
--- _5ee820bf-f61c-4734-be64-2f16aaac5447.gms(41) 1839 Mb 130 secs
--- _5ee820bf-f61c-4734-be64-2f16aaac5447.gms(41) 1839 Mb 135 secs
--- _5ee820bf-f61c-4734-be64-2f16aaac5447.gms(41) 1839 Mb 140 secsterminate called after throwing an instance of 'nlohmann::json_abi_v3_11_2::detail::type_error'
what(): [json.exception.type_error.316] invalid UTF-8 byte at index 2: 0xB1
--- _5ee820bf-f61c-4734-be64-2f16aaac5447.gms(41) 1839 Mb 145 secs
--- _5ee820bf-f61c-4734-be64-2f16aaac5447.gms(41) 1839 Mb 150 secs
[...]
--- _5ee820bf-f61c-4734-be64-2f16aaac5447.gms(41) 1839 Mb 235 secs
--- _5ee820bf-f61c-4734-be64-2f16aaac5447.gms(46) 1839 Mb
--- _5ee820bf-f61c-4734-be64-2f16aaac5447.gms(46) 1854 Mb
--- _5ee820bf-f61c-4734-be64-2f16aaac5447.gms(46) 1871 Mb
--- _5ee820bf-f61c-4734-be64-2f16aaac5447.gms(46) 1899 Mb
--- _5ee820bf-f61c-4734-be64-2f16aaac5447.gms(46) 1879 Mb
--- _5ee820bf-f61c-4734-be64-2f16aaac5447.gms(46) 1879 Mb 3 secs
--- 5,000,001 rows 5,000,001 columns 10,000,001 non-zeroes
--- Range statistics (absolute non-zero finite values)
--- RHS [min, max] : [ 1.000E+00, 1.000E+00] - Zero values observed as well
--- Bound [min, max] : [ NA, NA]
--- Matrix [min, max] : [ 1.000E+00, 1.000E+00]
--- Executing CPLEX (Solvelink=2): elapsed 0:04:01.582
IBM ILOG CPLEX 47.3.0 125a0e22 Jul 15, 2024 LEG x86 64bit/Linux
This should be fixed with the release of gamspy_base 47.4. Please reopen if you think the problem persists.
Yes, confirmed - the instance now solves successfully. Thank you for the swift fix!
When running gamspy for different optimization problems the log file reports the following error, which then also triggers a core dump, while the process seems to continue running:
We also observed the error with indifferent optimization models. In the small model, the error is thrown while already in the external solver calls - in this case the process terminates with results. In the large model, the error is thrown while gamspy is still executing the temporary gms files. Here the process gets stuck and does no longer continue.
The following software stack was used: Rocky Linux 8.9 python 3.12.4 gamspy 0.13.5