I was wondering if there is any advantage to generate JuMP constraints with @threads
regarding the CPU times.
Threads.@threads for c in set_curtailments
@constraint(model, sum(x[:, c]) .<= y[c] * nrow(data_sites))
@constraint(model, sum(x[s, c] * data_sites[s, 2] for s in set_sites) >= pars.powerContractualized * y[c])
end
and equivalent formulation with container constraints:
@constraint(model, [c in set_curtailments], sum(x[:, c]) .<= y[c] * nrow(data_sites))
@constraint(model, [c in set_curtailments], sum(x[s, c] * data_sites[s, 2] for s in set_sites) >= pars.powerContractualized * y[c])
I would intuitively expect the first to be much faster if the number of CPU cores available is greater than 2.
Also, I could not test it because I get:
[7608] signal (11.1): Erreur de segmentation
which is a segmentation fault
when using the Threads.