Constraint has no bool value (are you trying "lb <= expr <= ub"?)
AnsweredI 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?
-
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
Please sign in to leave a comment.
Comments
1 comment