Penn professor Michael Kearns developed an algorithm to find a middle ground between national security and personal security.