Support for single-binary-variable discrete variable
Application
Currently dimod.ConstrainedQuadraticModel.add_discrete() rejects discrete variables with fewer than two binary variables. I think it makes sense to support a single-binary-variable discrete because that can be a use case for a programmable range of N down to one; something like,
x = dimod.Binaries([f"x{i}" for i in range(USER_SELECTION)])
where for the case of len(x) == 1 the binary var is always 1 (selected).
Proposed Solution Allow single-bainary discrete vars
Additional Context I ran into this in an example where the user can select the supported number of modes, which constitute a discrete variable, and may select a single mode.
That would be a constant, not a variable. At some point we'd like to add support for constants but it's not supported at the moment.
I am warming to this idea. Especially now that we treat discreteness as a marker rather than a true flag. And also because presolve will remove invalid markers and will fix the constant variable.