We’ll take a moment to deconstruct this. In our preferred case that x1 = 1 and x2 = 0, the three statments resolve to:
The only value of $y_1$ that fulfils each of these is 1.
In any other case, however, y1 will be zero. Let’s take another example, say x1 = 0 and x2 = 1. This resolves to:
Given that y1 is a binary variable and must be 0 or 1, the only value of y1 that can fulfil each of these is 0.
You can construct 3 constraints so that y1 is equal to 1, only in the case you’re interested in out of the 4 following options:
- x1 = 1 and x2 = 1
- x1 = 1 and x2 = 0
- x1 = 0 and x2 = 1
- x1 = 0 and x2 = 0
I have created a function for exactly this purpose to cover all cases: