Artificial intelligent assistant

Optimization path avoiding a set of points I have a random polygon, convex or non-convex, defined by its vertices and two random points outside of the polygon (A and B) all of them defined in ${\rm I\\!R}^{2}$, how can I get an optimized path, the shortest path, from the point A to point B rounding the polygon, i.e., the path cannot go through the polygon, it is important to note that the polygon is defined as a set of points, its vertices, where the first one and last one are equals and counter-clockwise, i.e., joining the points you get a counter-clockwise polygon.

I would think you can use the convex hull generated by $A$, $B$ and the polygon. Clearly then $A$, $B$ are located on the boundary of the convex hull. Then $A$, $B$ dissect the boundary in 2 parts. Choose the part which is shorter than the other.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 575afa2c874f4eb6b89592fc644f0d58