Any attempt to completely automate this process is destined to fail, for all the reasons given in this thread. Weighting factors matter, and it is naive to assume that nobody is going to attempt to subvert a nonpartisan board, when so much power is at stake.
Don't despair! There's an alternative that generates an equitable outcome between two parties that are trying to screw their rivals: Cake Cutting.
You've probably heard the basic version of how to fairly divide a piece of cake between two children. Have one of them cut it, then the other choose which piece to keep. The cutter guarantees the largest possible piece of cake by cutting the cake in half.
This is the same idea, just extended: one party divides the state into districts, then the other chooses one district to "lock" and divides the remainder, then the process repeats.
It doesn't have to entrench the political parties, depending on the system used. For example the people tasked with drawing each district could be selected from the general public by sortition, i.e. like jury duty.
These people would be given access to every tool and expert help they need, and if they wanted to just rubber-stamp the suggestion of whichever party they support, then they would be free to do so.
A slightly more deterministic process would be to generate a list of all parties (or independent candidates) who received more than 10% of the vote at the last election, and allow each of them to draw a number of districts in proportion to the share of the vote they received.
Don't despair! There's an alternative that generates an equitable outcome between two parties that are trying to screw their rivals: Cake Cutting.
https://arxiv.org/abs/1710.08781v1
You've probably heard the basic version of how to fairly divide a piece of cake between two children. Have one of them cut it, then the other choose which piece to keep. The cutter guarantees the largest possible piece of cake by cutting the cake in half.
This is the same idea, just extended: one party divides the state into districts, then the other chooses one district to "lock" and divides the remainder, then the process repeats.