optimize coloring of cells