Answers.Body: <p>Welcome to AI.SE Adarsh!</p>
  
  <p>This is fairly simple to do with Q-Learning.</p>
  
  <p>If you assign a reward equal to -1 for each location other than the goals, and 0 for the goals, then Q-learning with no discount factor will learn the length of the shortest path from each location to the goal. Alternatively, you can use a discounting factor, and then invert the equation on the learned values of the Q function to obtain the number of steps.</p>
  
  <p>Hope this helps!</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-02T14:05:09.663Z
Answers.LastActivityDate: 2018-09-02T14:05:09.663Z
Answers.UserDisplayName: John Doucette
Body: <p>Is it possible to form a table that will have simply the shortest distance from each source to destination using q learning?</p>
  
  <p>If not, suggest any other learning algorithm.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-09-02T18:34:41.763Z
Comments.Text: It is not clear what the learning environment is here, and I think that is important. For instance, if the sources and destinations are in the real world, without accurate mapping, and you must actually physically explore the environment, then RL might be a reasonable choice. If the sources and destinations are on some kind of computer grid or maze, then simpler search algorithms might be better. Could you give more details about the learning problem you are faced with?
Comments.UserDisplayName: Neil Slater
Tags: <machine-learning><reinforcement-learning><q-learning>
Title: Can Q-learning be used to find the shortest distance from each source to destination?
UserDisplayName: Adarsh R Jayan
ThreadText: # Can Q-learning be used to find the shortest distance from each source to destination?
  
  (Asked by: username_0 on 2018-09-02)
  
  Is it possible to form a table that will have simply the shortest distance from each source to destination using q learning?
  
  If not, suggest any other learning algorithm.
  
  **Tags:** machine-learning, reinforcement-learning, q-learning
  > **Comments:**
  > **username_1**: It is not clear what the learning environment is here, and I think that is important. For instance, if the sources and destinations are in the real world, without accurate mapping, and you must actually physically explore the environment, then RL might be a reasonable choice. If the sources and destinations are on some kind of computer grid or maze, then simpler search algorithms might be better. Could you give more details about the learning problem you are faced with?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2018-09-02. Score: 2
  
  Welcome to AI.SE Adarsh!
  
  This is fairly simple to do with Q-Learning.
  
  If you assign a reward equal to -1 for each location other than the goals, and 0 for the goals, then Q-learning with no discount factor will learn the length of the shortest path from each location to the goal. Alternatively, you can use a discounting factor, and then invert the equation on the learned values of the Q function to obtain the number of steps.
  
  Hope this helps!
  
  
  ---
  
  