And this will be more efficient if it is writing like
for i in range(num_B):
if s_vals[i] != 0:
demand_exprs[(k, i)] += s_vals[i] * y
------------------------------
Athira Babu
------------------------------
Original Message:
Sent: Fri June 13, 2025 09:30 AM
From: Athira Babu
Subject: Slow column generation
Hai
When using column generation in models, there is possibility to constraint coefficients (e.g., s_vals
) be sparse. It's efficient to identify only those constraints where the new variable y
has a nonzero contribution. By updating only these relevant constraints with the corresponding terms, the column addition process becomes significantly faster. You can try like
for i in range(num_B):
if abs(s_vals[i]) > 0:
demand_exprs[(k, i)] += s_vals[i] * y
------------------------------
Athira Babu
Original Message:
Sent: Thu June 05, 2025 09:37 AM
From: Abderrahmane DRIOUCH
Subject: Slow column generation
Hey,
I am trying to use docplex for a column generation problem with +12K constraints. The sub master problem is built and solved quite fast but whenever I need to add a column, I have to add a term to every constraints which is very slow since it seems that I can't just add the column directly. For example I have something like this in my code where s_vals is already computed and y is the new variable:
for i in range(num_B):
demand_exprs[(k, i)] += s_vals[i] * y
Thanks in advance.
------------------------------
Abderrahmane DRIOUCH
------------------------------