Encoding for QUBO programs
# QUBOConstraints.is_valid — Function.
julia
is_valid(x, encoding::Symbol = :none)
Check if x
has a valid format for encoding
.
For instance, if encoding == :one_hot
, at most one bit of x
can be set to 1.
# QUBOConstraints.binarize — Function.
julia
binarize(x[, domain]; binarization = :one_hot)
Binarize x
following the binarization
encoding. If x
is a vector (instead of a number per say), domain
is optional.
# QUBOConstraints.debinarize — Function.
julia
debinarize(x[, domain]; binarization = :one_hot)
Transform a binary vector into a number or a set of number. If domain
is not given, it will compute a default value based on binarization
and x
.