Shortest root using machine learning/AI
This is not a machine learning problem but an optimization problem. 

So you need a greedy algorithm for the shortest path

Indeed it could be solved this way but the challenge is to represent your grid as a graph... 
For example, decomposing the grid in a n x n matrix. In your shortest path algorithm, a node is an element of your matrix (so you exclude the elements of the matrice that contains the scattered points) and the weight of the arcs are the distance. 
However n must be small since shortest path algotithms are np-hard problems...
Maybe other algorithms exist for this specific problem but I'm not aware of.
Assume that I have set of points scattered on the XY plane, and i have two points say start and end point any where in XY plane. I want to find the shortest path between start and end point without touching scattered points. The path has to maintain certain offset ( i.e assume path has some width ). 
How to approach this kind of problems in programming, Are there any algorithms in machine learning.