At that scale it seems like you could just solve the KKT conditions directly. Exaggerating but only a little