Cplex Ceil() Function in Python

Hello, I’m working on a published article. One of the limitations in this work necessitates the use of the ceil() function. At the OPL, we can use the ceil() method, but I couldn’t locate the Python equality.

slack_var = model.continuous_var(name="slack")

ceiled_var = model.integer_var(name='ceiled')

Notice: The slack variable has to be less than “1”. ( 0 <= slack < 1)

ceiled_var - slack_var = "your calculations"

P.S. I tried math.ceil() and cp.moduler ceil() but got no results. I haven’t found a Python equivalent, however there is a workaround:

1 Like

The docplex package says it’s numpy friendly, so try numpy.ceil.

1 Like