execute
Executes the fixed‑K swap mutation on candidate. If the candidate is not a BestSubsetSolution, it is lifted to one (bitset and objectives are copied).
Steps:
Early exit if mutation does not trigger or there are no bits.
Snapshot current mask into a primitive array.
Collect indices with
1
and with0
.Perform:
Swap if both pools have elements (K preserved).
Repair if the mask is all‑zeros or all‑ones (K set to 1 or N‑1).
Record swap/repair metadata for delta‑evaluation.
Return
the mutated BestSubsetSolution (same instance if already compatible; otherwise lifted).
Parameters
candidate
input solution (possibly a DefaultBinarySolution).