Distopia is the backend and a frontend for a research tool that explores how humans and robots collaborate to design voting districts and gerrymander.

Background

M.Eng. CS (masters of engineering in CS) project in Guy Hoffman’s HRI lab, with Matt Law (grad student).

The research project is about how humans collaborate with robots to explore the problem space in a design problem. Specifically, how robots can be helpful to humans when they collaboratively design voting precincts using a touch user interface (TUI) shared by the robot and the human.

Architecture

Components:

Distopia

Distopia is the server that manages the designs (not including the agent) and the frontend that is projected on the table. It is written in Python using OOP and uses Kivy for its frontend. Cython is used to optimize computation bottlenecks such as polygon collision and boundary computation. See the docs for the API.

Districts and precincts

The precinct class describes the low level atomic precincts that are assigned to a district based on the design. There are precinct, district, and state specific metric classes that evaluate the design and are associated with the respective classes. Each metric class knows how to compute its specific type of metric (e.g. a histogram of income for a district, or compactness across the state).

The mapping module manages the state and computes the precinct-districts assignment using the Voronoi method based on SciPy. It uses an internal thread to not block the main Kivy GUI thread.

Apps