Let’s say you’re making some sort of program with options, and it’s possible to turn on option A or option B, but not both. You could just leave them as two settings and disable one if the other is on, or you could turn them into one setting with three choices: off, A, B.
However, if there are three independent options, it’s better to leave it as three separate settings rather than one setting with eight choices.
What if the three options can’t be turned on all at once but are otherwise independent? I’d say that three settings that just can’t be all turned on at once is best.
A somewhat more formal statement of the general problem:
We have a set of Boolean variables {A,B,…} (options) and some constraint that they have to satisfy.
Each setting controls one or more options, but no option can be controlled by multiple settings.
Each setting has all possibilities for its relevant options available, but no more.
The valid combinations are connected via changing one setting at a time.
I haven’t figured out what exactly should be optimized for, but I know it should follow a few obvious rules:
- Rearranging the options preserves the optimal solution
- Swapping any option’s off with its on preserves the optimal solution
- Taking the disjoint union of two different sets of options and taking the Cartesian product (logical AND) of their constraints yields an optimal solution that is the disjoint union of the two original optimal solutions.
- If a solution is optimal and you can add another possibility to the constraint and have it still be a valid solution, the resulting solution is still optimal.
Let’s say our constraint is (A AND B) OR C. I’d say the optimal solution is one setting for A and C and another for B, or one setting for B and C and another for A.
If our constraint is A XOR B XOR C, it’s forced to be one setting for all three, because I’m not able to represent “One setting each for A and B, and C is whatever it has to be to work” in this system.
What if our constraint is C IMPLIES B AND B IMPLIES A? It seems pretty obvious to me that the answer is just one setting for all three. (If you think about it, this is how difficulty levels in certain games work)
However, for the constraint (A XOR B) OR (A AND B AND C), I feel like there should be one setting for A and B and one setting for C.
I could keep listing examples of various constraints and what I feel like should be the optimal solution, but I think I should stop there. It seems to me that my criteria for an optimal solution is: “Never have two settings that can only change when the other is in a specific state, and of those possibilities, minimize the maximum number of choices for each setting.”
Leave a Reply