Calls the restart function. If the number of consecutively rejected iterations is larger than max_it, the best_state is returned. Otherwise the state is returned.
State
The state accepted or rejected state.
The best state until now.
Either the state or best_state.