This repository has been archived by the owner on Dec 7, 2021. It is now read-only.
optimization/converters/integer_to_binary.py: OverflowError: cannot convert float infinity to integer #1238
Labels
type: bug
Something isn't working
Information
What is the current behavior?
I get the following error when converting a MIP to QUBO:
Steps to reproduce the problem
The InequalityToEquality() converter creates slack variables with same upperbund and lowerbound (both zero). This results in
_encode_var(
) function crashing at following line asvar_range
equals zero.power = int(np.log2(var_range))
This can be reproduced by trying to encode a least or equal constraint with all positive coefficients in LHS and zero in RHS, e.g.
x[1] + x[2] <= 0
, which can naturally happen in automatically converting large problems. This can be safely encoded asx[1] + x[2] = 0
without slack variables.What is the expected behavior?
The expected behaviour is not to create such slack variables at first place.
Suggested solutions
This should be fixed at two places.
var_range
before trying to implement binary encoding.The text was updated successfully, but these errors were encountered: