Constraint has no bool value (are you trying "lb <= expr <= ub"?)
回答済みI have the following decision variables
r_max = bilevel.addVar(lb= 0 , ub= gp.GRB.INFINITY, vtype=gp.GRB.CONTINUOUS, name="r_max")
x_ij_km = {}
for i, j in edges:
for k in K:
for m in M:
x_ij_km[i, j, k, m] = bilevel.addVar(lb=0, ub=gp.GRB.INFINITY, vtype=gp.GRB.CONTINUOUS, name=f"x_{i}_{j}_{k}_{m}")
When I run the following constraint (
bilevel.addConstrs(sum(x_ij_km[i, j, k, m] * l_ij_mk_c[i, j, k, m, c] * l_ij_mk_c * phi_k[k] for k in K for m in M for i,j in edges) <= r_max for c in C)
Note: l_ij_mk_c, l_ij_mk_c, phi_k are all parameters
I receive the following error:
bilevel.addConstrs(sum(x_ij_km[i, j, k, m] * l_ij_mk_c[i, j, k, m, c] * sigma_ij_km[i, j, k, m] * phi_k[k] for k in K for m in M for i,j in edges) <= r_max for c in C)
File src/gurobipy/tempconstr.pxi:57 in gurobipy.TempConstr.__bool__
GurobiError: Constraint has no bool value (are you trying "lb <= expr <= ub"?)
What might be the reason? How can I fix that?
-
正式なコメント
This post is more than two 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. -
Please check the article Constraint has no bool value (are you trying "lb <= expr <= ub"?) for a solution.
If you do not find any, then please create a minimum reproducible example (Tutorial: Preparing a Minimal Reproducible Example).
0
投稿コメントは受け付けていません。
コメント
2件のコメント