Solver for Hardy-Weinberg problems