# Solver Notes

## Formula Notes

- The family is a KTF/team-formation encoding. Variables `1..N` are the high-level selectable agent/options. The first positive auxiliary variable in the first clause is `N+1`.
- The initial clause blocks are totalizers over negated selected-agent literals. Each block ends in a negative unit. Decoding the root output run gives a per-skill lower bound: selected agents covering that skill must be at least the recovered `k`.
- After the skill blocks there is a positive unit on an otherwise harmless/dummy variable, then binary clauses of the form `-i -j` over high-level variables. These form small conflict cliques/components.
- The tail after the first positive unit encodes the objective/budget and sometimes extra selected-agent totalizers. Multi-block tails expose binary cost bits through the agent sets in the negative-unit blocks. Single-block tails expose a useful scoring cost through binary clauses containing `-agent`; for those the solver still treats the tail as the final monotone oracle.

## Techniques Used

- Structural detection of the KTF encoding without DIMACS comments.
- Recovery of skill membership and required multiplicity from totalizer blocks.
- Conflict components are searched as ordered levels: choosing a higher option in the same component replaces a lower one.
- Objective feasibility is checked by unit propagation on the objective tail during high-level search, except for decoded multi-block weighted tails where the recovered cost bound is used for fast partial pruning and the full CNF is still checked before SAT output.
- Branching uses recovered option costs and a corrected remaining-coverage availability test: components already covering a deficient skill are not counted as possible future repairs for that skill.
- SAT output is conservative: after a candidate team is found, unit propagation extends all auxiliary variables, all unassigned auxiliaries are set false, and every original clause is checked before printing `SATISFIABLE`.
- A fallback CDCL engine, written in-tree from scratch, runs after the structural SAT search. It decides only on recovered high-level variables, projects learned clauses away from auxiliary variables where possible, and logs learned clauses as VeriPB RUP steps if it reaches UNSAT.

## Remaining Things To Try

- Finish decoding the single positive-unit objective tails. Binary `-agent` occurrence counts exactly match the observed `0.02` oracle, but the `0.04/0.06` single-tail cases still need a more exact cost model.
- Add stronger branch-and-bound lower bounds for deficient skills and objective capacity, especially for `TF-4 k=4 B=52`.
- Strengthen the fallback proof search. The current CDCL fallback did not solve `TF-4 k=2 B=18` within short local 120 second tests, though it may still help under the broker limit.
- Investigate whether the extra post-dummy negative totalizer blocks in several `0.06` instances are separable budget constraints that can be decoded directly.

## Known Limitations

- UNSAT is only emitted by the fallback CDCL path after writing a RUP proof. Most hard UNSAT cases still return UNKNOWN.
- SAT search is heuristic plus bounded DFS over recovered high-level components; hard satisfiable instances may still return UNKNOWN.
- The solver spends most of the per-instance budget before returning UNKNOWN on supported but unresolved formulas.

## Changelog

- Replaced the scaffold with a C++ KTF structure detector, high-level level search, objective-tail propagation guard, and full CNF model checker.
- Added analysis tools in `tools/` for profiling CNFs, extracting high-level skill/conflict structure, probing objective tails, and testing greedy/search strategies.
- Updated metadata for broker submission.
- Added a high-level-variable CDCL fallback with VeriPB RUP logging for potential UNSAT proofs.
- Decoded multi-block objective tails into per-option binary costs and a structural budget bound for faster pruning on large `0.06` SAT instances.
- Changed fallback option scoring for single-tail objectives to use binary tail occurrences of `-agent`, which matches the observed `0.02` weighted objective better than raw component rank.
- Fixed the DFS availability check so already-covered components do not count toward a skill's remaining deficit, added a per-skill cheapest-repair lower bound for decoded budgets, and extended the structural SAT search window before CDCL fallback.
