add solver for calculate_weight_distribution, and add test case for it