These days software is better than people at playing chess, identifying faces in crowds and answering weird questions on Jeopardy.

Maybe we should ask it to improve our politics.

That’s the idea behind a bill with a particularly high geek quotient that is before the New Hampshire legislature. It would take re-districting out of the hands of quarrelsome human beings and give it to algorithms, in hopes that the every-10-year process of deciding which towns are in which state senate and house districts could be made fairer.

“It suddenly came to me: Redistricting is an optimization problem,” said Jerry Knirk, a retired physician in his first term as legislator who is the prime sponsor of House Bill 320.

Optimization, as you probably know, is a term for maximizing the result in a system that has a bunch of often conflicting variables – such as when Google Maps balances speed limits, mileage and traffic patterns to give you the optimal directions. In general, software does it much better than people do.

“Every time you’re finding a flight with Expedia, or are doing a traffic route on a map, that’s optimization,” Knirk said.

View all Granite Geek columns.

His bill, which has its first hearing Wednesday before the House Election Law committee, “establishes procedures and guidelines for apportioning electoral districts after the decennial census using a mathematical optimization process.” If this were to become law, it would apparently be unique in the country.

Knirk’s bill is the only bill this year with the word “mathematical” in its description, but to my surprise it’s not the only place in New England where mathematics and redistricting overlap.

In August, there’s a five-day summer school being held at Tufts University titled “Geometry and Redistricting,” with one of the most unusual course descriptions I’ve ever seen: “The principal purpose (is) training mathematicians to be expert witnesses for court cases on redistricting and gerrymandering.”

Although it was just announced a few days ago, it is already a hit, said Moon Duchin, an associate professor of mathematics at Tufts, who is organizing the course.

“Initially I thought it was going to (enroll) 30 math professors for a five-day seminar. Now, I think we’ll have two days that will be open to the public, also streamed online because I’ve been getting requests from all over the world,” Duchin said.

The idea for the summer course came up when Duchin was teaching a long-standing Tufts class called Mathematics of Social Choice. “I was teaching it last year during the primaries, and I got really into thinking about gerrymandering and the shapes of districts.”

She was particularly attracted to the issue because Duchin’s research is in metric geometry, part of which involves “analyzing qualitative features of different shapes using numerical scores.” That’s exactly what gerrymandering analysis calls for.

So Duchin looked into the issue and found that judges have said over and over that there’s no objective way to say whether electoral districts are laid out fairly or not, even though courts sometimes overturn a particular redistricting. The geometer in her bristled at this assertion.

“It’s like that saying about obscenity – ‘I can’t define it but I know it when I see it,’ ” Duchin said. “We want to tell them: There actually are some good ways to say how unreasonable a shape is.”

I’ll have more details of my talk with Duchin on the Granite Geek email newsletter this week. To subscribe to the free newsletter, which comes out on Thursday, go to bit.ly/monitornewsletters and sign up.

This whole idea of gerrymandering and redistricting being a math and software issue is new to me, but as soon as Knirk brought it up, I realized that it seems obvious.

Districting’s goal, after all, is to create a certain number of districts (24 in the state senate, 400 in the house) each containing a roughly equal number of people, with one other main variable: The borders have to follow existing borders of towns and cities, or of wards in places like Concord that are divvied up. That seems like something software could optimize in no time.

However, there’s another complicating variable: Politics. The party in power in the Legislature controls the committee that does the redistricting and wants to draw boundaries to help its own candidates, such as by lumping together towns that support the other side into one district, to maximize the number of other districts that just barely support your side.

It wouldn’t be hard to get software to do this, too, but it’s illegal. Fiddling districts to benefit your party is done, as everybody knows, but it’s not done openly. The parties pretend they’re objectively drawing boundaries even though they’re favoring themselves as much as possible.

And it works. A Monitor analysis of the last New Hampshire election, for example, found that the Republican-majority state Senate would have been Democratic-majority if the voting had taken place before district boundaries were redrawn by the GOP in 2011. And federal courts in two other states have issued rulings saying that electoral boundaries were drawn to favor the ruling partly so blatantly that they are illegal.

Knirk thinks the timing is in his bill’s favor. Redistricting won’t happen until 2021, after two more election cycles, so neither party can be sure right now who will be in charge of the process. That might make them more willing to hand the job over to software, he said.

Put more geek in your week. Sign up for the free weekly Granite Geek newsletter.

The New Hampshire Legislature will consider a couple of other bills this year that seek to sidestep the partisanship problem by creating “independent” redistricting committees, as has been done in California, but Knirk thinks that doesn’t go far enough. Forget about trying to remove the politics, he says – just remove the people.

“This has the ability to put on the table a fair and transparent way to do it,” he argued.

However, there is a caveat. It has become obvious recently that subtle biases can sneak into algorithms because of assumptions made when setting them up, so we’d have to be sure that doesn’t happen. It seems to me this could be avoided with something as straightforward as redistricting, but you never know.

If nothing else, if Knirk’s bill becomes law – although I doubt that it will – it would be one of the more unusual additions to the growing list of jobs where people were replaced by automation.

(David Brooks can be reached at 369-3313 or dbrooks@cmonitor.com or on Twitter @GraniteGeek.)