Implemented the selection of next state (accept best states, accept with certain probability worst ones)