In Gingleator, if all districts become majority-minority, then an error occurs on line 144 of reward_partial_dist(). In this case, it tries to take the max( ) over an empty list, and the code breaks. The same issue could arise on line 171 of reward_next_highest_close().
It would be great if GerryChain could terminate gracefully in such circumstances, either terminating the chain early because a global max has been found, or finishing the chain as intended but without returning an exception. Either seems reasonable to me.
In Gingleator, if all districts become majority-minority, then an error occurs on line 144 of reward_partial_dist(). In this case, it tries to take the max( ) over an empty list, and the code breaks. The same issue could arise on line 171 of reward_next_highest_close().
https://github.com/mggg/GerryChain/blob/a83acf55a371e42d2de0574e24569e2808b5e0d4/gerrychain/optimization/gingleator.py#L144
https://github.com/mggg/GerryChain/blob/a83acf55a371e42d2de0574e24569e2808b5e0d4/gerrychain/optimization/gingleator.py#L171
It would be great if GerryChain could terminate gracefully in such circumstances, either terminating the chain early because a global max has been found, or finishing the chain as intended but without returning an exception. Either seems reasonable to me.