Surface subgroups from linear programming