SAT solver for AYTO
parallelized constraint SAT solver designed specific for the reality television show Are You The One? (AYTO)
Mathematical Formulation of the AYTO Solver
Constraint Satisfaction & Surjective Bipartite Matching
1. Variables and Sets
Let be the first group (e.g., group 1 candidates) of size , and be the second group (e.g., group 2 candidates) of size , where .
- The algorithm seeks to find all valid mappings between the two groups.
- Mathematically, it searches for all valid surjective functions .
- Surjectivity implies that every person in must be matched with at least one person in .
2. Constraints
The function must satisfy two primary types of constraints:
2.1. Allowed Mappings (Truth Booths)
Let represent the set of allowed matches for a given . Initially, for all . The "Truth Booths" apply absolute constraints:
- Confirmed Match (True): If is a confirmed match, then .
- Confirmed Non-Match (False): If is a confirmed non-match, then .
In the implementation, is efficiently represented as an -bit integer, where the -th bit is 1 if , and 0 otherwise.
2.2. Ceremony Constraints
Let be the set of all ceremonies. Each ceremony consists of a set of guessed pairs and a score (the "beams"), representing the exact number of correct matches in that guess.
For every ceremony , a valid function must satisfy:
where is the indicator function that equals 1 if the condition is true and 0 otherwise.
3. Search Space and Pruning
The algorithm explores the search space using a Depth-First Search (DFS) tree, building the function sequentially. Let be a partial assignment of the first elements of .
Pruning by the Pigeonhole Principle: At depth , let be the set of elements in that have already been assigned a match.
- The number of elements in still needing an assignment is .
- The number of unassigned elements in is .
Because the final function must be surjective, if the number of required assignments is greater than the number of available slots, the branch is physically impossible and is pruned immediately:
4. Objective
Let be the set of all fully assigned, valid functions that survive the pruning and satisfy all ceremony constraints. The algorithm outputs two standard metrics:
- Total Possibilities:
- Marginal Probabilities: A matrix , representing the likelihood of each specific pairing across all valid universes.
For each and , the probability is calculated as the ratio of valid functions that contain that specific match over the total number of valid functions:
Rust Implementation
Here is an example implementation in Rust: AYTO-Solver
