mggg / GerryChain

Use MCMC to analyze districting plans and gerrymanders
https://mggg.github.io/GerryChain/
Other
132 stars 74 forks source link

Ignore constraints in initial partition? #356

Closed frnsys closed 3 years ago

frnsys commented 3 years ago

I'm starting from a partition that doesn't satisfy a set of constraints but want to use it as a starting point for a map that does satisfy those constraints.

However, the chain can't start because the initial partition doesn't satisfy those constraints. Is there a way to ignore the constraints for the initial partition? Or is there some other way that I should be approaching this?

pizzimathy commented 3 years ago

Hi @frnsys, I have a clarifying question before getting to a more substantive discussion. You said you're

starting from a partition that doesn't satisfy a set of constraints but want to use it as a starting point for a map that does satisfy those constraints.

What are those constraints, specifically?

frnsys commented 3 years ago

I'm experimenting with different ones, but for example--that every district has at least x hospitals per capita. After posting this I realized maybe this isn't what the library is designed to do; this is more of a search question.

pizzimathy commented 3 years ago

To answer your question, there's no way to get around a binary constraint failing (e.g. your hospitals one), but it seems like you are already there! I'll close this issue, but we can continue this discussion if you'd like – what's your search question? I'm more than happy to help!

frnsys commented 3 years ago

Thanks! Right now what I'm trying is randomly flipping districts from an existing map and using A* search to find at least one map that satisfies the constraint. Then I can apply GerryChain on that map to explore alternative plans. This seems like it works decently so far.