Pattern optimization