0

I am trying to model the following strict constraint in python with docplex:

mdl.add_constraint(sum(a[i] * mdl.variable[i] for i in range(nrItems)) > b)

but I keep getting the error: docplex.mp.utils.DOcplexException: Unsupported relational operator: only <=, ==, >= are allowed

How can one programm a strict constraint in docplex?

2 Answers2

1

You could use a small epsilon and turn

mdl.add_constraint(sum(a[i] * mdl.variable[i] for i in range(nrItems)) > b)

into

epsilon=0.00001
mdl.add_constraint(sum(a[i] * mdl.variable[i] for i in range(nrItems)) >= b+epsilon)
Alex Fleischer
  • 9,276
  • 2
  • 12
  • 15
0

MIP solvers do not support < and > as these do not make much sense when continuous variables (or relaxations) are involved (both from a mathematical point and from a numerical point of view).

Erwin Kalvelagen
  • 15,677
  • 2
  • 14
  • 39