dwavesystems / dwave-optimization

Enables the formulation of nonlinear models for industrial optimization problems.
https://docs.ocean.dwavesys.com/en/stable/docs_optimization/index.html#index-optimization
Apache License 2.0
7 stars 18 forks source link

Consider adding `logical_xor` to mathematical functions #125

Closed jlalbers closed 3 weeks ago

jlalbers commented 1 month ago

Currently, an XOR symbol can be created by composing different logical function symbols, i.e.:

sym_1 = model.binary(...)
sym_2 = model.binary(...)
xor = logical_and(
    logical_not(logical_and(sym_1, sym_2)),
    logical_or(sym_1, sym_2)
)
...

However, I imagine it would be more efficient and expressive to have a separate XOR symbol.

arcondello commented 1 month ago

Do you have a specific use case in mind? I agree it could be there for symmetry, but I'd like to add new nodes lazily rather than eagerly.