Trying to build a penalty function for a XOR table
In trying to learn how to formulate a problem to fit a D-Wave system, I am following the steps in the example that uses the AND truth table. Instead of just repeating the steps (which I did) for the AND table, I'm gonna try a XOR table. The XOR's table looks like this --
X1 X2 Z VALID? PENALTY
0 0 0 Yes 0
0 0 1 No 1+
0 1 0 No 1+
0 1 1 Yes 0
1 0 0 No 1+
1 0 1 Yes 0
1 1 0 Yes 0
1 1 1 No 1+
From this I have attempted to develop several penalty functions. For example, the following gets close...
The first set of parentheses makes sure that when everything is zero the penalty is zero. The second parentheses makes sure that when there are two zeroes and a single 1 in the row that the penalty is one or more and when there are two 1s the penalty is zero. All good except for the last row in the table. When everything is 1, the penalty becomes -3. One solution is to square the term inside the second parentheses. However, this produces a term where X1, X2, and Z are multiplied together. It leads to...
The problem here is what do I do with the last term, +12(X1)(X2)(Z)? How does it fit into a quadratic?
I've tried different formulas. And, calculating determinants to solve this, and other equations, down to a quadratic. I also tried Specification from the penaltymodel.core package. Got the error code back that it was impossible. That actually made me feel a little better.
Again, just trying to learn Ocean and how D-Wave machines can solve problems. That's my goal. It could be that my approach is all wrong from the beginning, but that's OK as long as I exhausted all potential solutions in trying to learn.
Any suggestions or hints or criticisms are welcome! :)