check_if_logical_type

(function from pyomo.common.numeric_types)

pyomo.common.numeric_types.check_if_logical_type(obj)[source]

Test if the argument behaves like a logical type.

We check for “logical types” by checking if the type returns sane results for Boolean operators (^, |, &) and if it maps 1 and 2 both to the same equivalent instance. If that works, then we register the type in native_logical_types.