gurobipy.GurobiError: Invalid argument to LinExpr multiplication
Awaiting user inputHello! I'm trying to apply a quicksum function to the following expression. But I'm receiving the following error: gurobipy.GurobiError: Invalid argument to LinExpr multiplication
sample_list: {list: 150}
sample_list = [[Wp_0, u_value_0, Qsol_0],....,[Wp_149, u_value_149, Qsol_149]]
Wp: Gurobi Binary variable
u_value: float
Qsol: {ndarray(2, 8760)}
it works fine when I only do the following operation-->
for t in range(8760):
x1 = ((i.Wp * i.u_value * i.Qsol[t])for i in sample_list)
But gives an error when-->
for t in range(8760):
x1 = quicksum((i.Wp * i.u_value * i.Qsol[t])for i in sample_list)
Could you please suggest on this?
0
-
Official comment
This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support. -
Could you please provide a minimal reproducible example? An example with a sample_list of 2-3 elements and a few hard-coded u_values and Wp variables would make providing help way easier.
From the snippet you showed, it looks like the term
((i.Wp * i.u_value * i.Qsol[t])for i in sample_list)does not generate a list as required by the quicksum function.
0
Post is closed for comments.
Comments
2 comments