Answers.Body: <p>If you don't go back to your previous state, the best you will do is get stuck in a local maxima. So, to answer your question, yes, backtrack if your hill climbing has failed. The number of times you want to do this depends on you and your implementation. Hill climbing does not guarantee to find the global maxima and, in many cases, you won't know if it is a local maxima or a possible global maxima, unless you try the hill climbing a few times.</p>
  
  <p>If you haven't already seen <a href="https://en.wikipedia.org/wiki/Hill_climbing" rel="nofollow noreferrer">its Wikipedia article</a>, it has a cool graph showing what I mean.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2017-11-16T05:14:59.187Z
Answers.LastActivityDate: 2019-03-02T10:52:27.993Z
Answers.LastEditDate: 2019-03-02T10:52:27.993Z
Answers.UserDisplayName: solarflare
Body: <p>I have implemented the hill climbing algorithm, with side away steps, which can increase the rate of success, because, when you don't have new generated states, you can go back to previous level and choose from there another state. </p>
  
  <p>What should I do when new generated states have bigger distance to the goal than the parent state?</p>
  
  <p>Do I have to go back to the previous level and choose another state, from which I will continue? Or I continue with one of the states generated which has bigger distance?</p>
  
Tags: <search><hill-climbing>
Title: What should I do when the new generated state has bigger distance to the goal than the parent state?
UserDisplayName: Darius Ionut
ThreadText: # What should I do when the new generated state has bigger distance to the goal than the parent state?
  
  (Asked by: username_0 on 2017-11-15)
  
  I have implemented the hill climbing algorithm, with side away steps, which can increase the rate of success, because, when you don't have new generated states, you can go back to previous level and choose from there another state.
  
  What should I do when new generated states have bigger distance to the goal than the parent state?
  
  Do I have to go back to the previous level and choose another state, from which I will continue? Or I continue with one of the states generated which has bigger distance?
  
  **Tags:** search, hill-climbing
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-11-16. Score: 0 | Accepted answer
  
  If you don't go back to your previous state, the best you will do is get stuck in a local maxima. So, to answer your question, yes, backtrack if your hill climbing has failed. The number of times you want to do this depends on you and your implementation. Hill climbing does not guarantee to find the global maxima and, in many cases, you won't know if it is a local maxima or a possible global maxima, unless you try the hill climbing a few times.
  
  If you haven't already seen [its Wikipedia article](https://en.wikipedia.org/wiki/Hill_climbing), it has a cool graph showing what I mean.
  
  
  ---
  
  