python - Gurobi: Prod() in addConstrs() -


when set constraint, code

m.addconstr(binary_var.prod(cost_con) <= budget[k]) 

binary_var variable name, cost_con coefficients of variables. constraint linear expression,

cost_con[0]*binary_var[0]+cost_con[1]*binary_var[1]+cost_con[2]*binary_var[2]+.... 

here problem. since number of variables large, 5000. code binary_var.prod(cost_con) costs lot of time. please tell me if have better solutions decrease running time?

thanks


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -