Open ACE07-Sev opened 2 years ago
In here, Y, X, K_i are binary variables, list is just a list of values
Hi @ACE07-Sev , we do not support strict inequality. You need to use <=
, possibly with a constant offset. E.g. sum(Binary(v) for v in range(10)) < 0
should be sum(Binary(v) for v in range(10)) <= -1
Are you not going to support this either?
TypeError: '>=' not supported between instances of 'BinaryQuadraticModel' and 'BinaryQuadraticModel'
Unfortunately that is also not supported at the moment, though you can do bqm0 - bqm1 >= 0
.
Can't this be added in the backend? For instance given your understanding of offsets which simply resolve the issue without affecting the result, you could add this offset interpretation given the expectation being risen, same case for @angystallone 's issue. Given the "TypeError: '>=' not supported between instances of 'BinaryQuadraticModel' and 'BinaryQuadraticModel' ", the function could automatically return the BQM - BQM>= or <= 0.
Simply an idea, you're absolutely much much more familiar with the backend process hence I am sure given more time D-wave will find more sophisticated resolves.
Thank you as always for the early replies.
Hi, I am trying to set an inequality constraint (I want the sum of some terms to be negative, less than 0 essentially), but get this error :
Traceback (most recent call last): File "C:\Users\elmm\Desktop\CQM\CQM Assignment JRP\CQM_JRP.py", line 182, in
cqm.add_constraint(upper_bound_eq < 0,
TypeError: '<' not supported between instances of 'BinaryQuadraticModel' and 'int'
I don't think there is a need for a minimal reproducible example, as any cqm with a < sense which has binary vars will get this error but mine is :
for i in range(M): for j in range(N): X.append(Binary('X' + str(i + 1) + "_" + str(j + 1))) if j == 0: lower_boundeq = quicksum(Y[y] list[0][y] X_[j] - D[i] k_i[i] k_val[k] * T for k in range(38) for y in range(3))