What is the optimal path between $2$ fixed points around an invisible obstructing wall? Every day you walk from point A to point B, which are $3$ miles apart. There is a $50$% chance each walk that there is an invisible wall somewhere strictly between the two points (never at A or B). The wall extends $1$ mile in each direction perpendicular to the line segment (direct path) between A and B, and its position can be at any random location between the two points. That is, it can be any distance between A and B such as $0.1$ miles away from A, $1.5$ miles away, $2.9$ miles away.... You don't know if the wall is present or where it is until you walk into it.  You must walk around the wall if present as there is no other way to circumvent it.  Assume the wall is negligible thickness (like a force field), all ground is perfectly flat, and the y coordinates at both A and B are $0$ (although I don't think the optimal path will change much if they weren't).
What strategy minimizes the average expected walk distance between A and B?  How do we know for certain this strategy yields the shortest average walking distance?
To get the $100$ bounty points, I would like a convincing argument from you as to why you feel your solution is optimal and cannot be beaten.  For those of you using computer simulation, anything reasonably close to optimal is a candidate for the bounty. 
Can anyone beat the optimal solutions submitted so far?  There are still a few days to try.  Even a slight beat (if not due to roundoff error or some other error) would help prove previous solutions are non-optimal.  You can just use the table of $31$ points (x-y coordinates) and compute that path length and then if you can find better then I will accept that answer.  I think by Sunday night I may have to award the bounty otherwise it may get auto-awarded.
 A: Let $l$ be the length $AB$ ($3$ miles), $h$ the size of the wall ($1$ mile), $p$ the probability that the wall appears $(1/2)$
Suppose our strategy is to walk along the curve $y = f(x)$ where $f(0) = f(l) = 0, 0 \le f(x) \le h$ for $x \in [0 ; l]$ until we hit the wall and then go around it then make  a straight path to $B$.
Call $g(x)$ the length of the curve $(t,f(t))$ for $t \in [0;x]$.
The expected length of the trip is then :
$E(f) = (1-p)g(l) + \frac pl \int_0^l (g(x)+(h-f(x))+\sqrt{(l-x)^2+h^2}) dx$.
Minimizing $E(f)$ is then equivalent to minimizing $(1-p)g(l) + \frac pl \int_0^l (g(x)-f(x)) dx$, which is a combination of the total curve length, the mean curve length, and the area under $f$.
Suppose we modify $f$ locally near a point $x$, making an increase in length of $dg$ and increase in area of $da$.
This modifies $E(f)$ by $(1-p)dg + p/l((l-x)dg - da) = (1-px/l)dg - (p/l)da$, so we improve $f$ when $dg/da < p/(l-px)$ when $da,dp > 0$ and when $dg/da > p/(l-px)$ when $da,dp < 0$.
This shows that if we ever have a convex portion in our curve, we really should just cut straight through it since this modification has $dg/da < 0 (< p/(l-px))$. Therefore the optimal $f$ is concave.
The threshold on $dg/da$ translates directly into the curvature at which we can't improve our score anymore by changing the curvature. When making an infinitesimal change of curvature of an arc or radius $r$, we get an efficiency $dg/da = \kappa = 1/r$ (this is a restatement of the isoperimetric theorem)
If the curvature didn't vary this would be exact, but this method yields only a simple approximation by finding the curve from $(0,0)$ to $(l,0)$ where $\kappa = p/(l-px)$.
the curvature is a increasing function of $x$, we get $r = l/p = 2l$ at the start, down to $r = l(1-p)/p = l$ at the other end.
Interestingly, it seems the solution doesn't care about what $h$ actually is until it crosses the line $y=h$

In our case, starting at $y=0$ with a slope of about $y'=0.3236$ and then numerically solving the differential equation
$y'' = \kappa(x) (1 + y'^2)^\frac 32= \frac{1}{6-x} (1 + y'^2)^\frac 32$
we obtain a curve of length about $3.0621$ miles, and an expected trip length of about $3.648$ miles

Here is what the curve looks like with the two osculating circles at the endpoints.

The correct curvature to minimize $\int A \sqrt{1+f'(x)^2} dx + \int (\int_0^{f(x)} B dy)dx$ is given by $A\kappa = \vec \nabla A . \vec n + B$ where $\vec n$ is the unit vector normal to the curve.
Taking this correction into account, you get @user5713492's solution.
A: Suppose you walk in a straight line and follow the wall if you encounter the wall. Let's call $x$ the distance between the middle of the wall and the point where you would intercept the wall if there was one.
If there is no wall, your travel distance will be $2\sqrt{x^2+1.5^2}$
If there is a wall, your travel distance will be $\sqrt{x^2+1.5^2}+1-x+\sqrt{1+1.5^2}$ (suppose $x>0$)
Hence, your expected travel distance is 
$$f(x) = \sqrt{x^2+1.5^2}+ \frac{ \sqrt{x^2+1.5^2}+1-|x|+\sqrt{1+1.5^2} }{2}$$
A quick study of this function gives you a minimum at $x = \frac{3}{4\sqrt{2}} \simeq 0.53 \text{miles}$
A: Well, I had given this answer last night on the post here, which scaled everything by a factor of 3:
Optimal path around an invisible wall
To save time, I will copy-and-paste my answer here, and will assume the length of AB is 1 and the wall length is 1/3 in each direction.  You can multiply everything by a factor of 3 later. 

[I am changing my $y$-discretization to make it finer, in response to another Michael comment below.]
One approach is via dynamic programming (which works the solution backwards). For simplicity, let's chop the $x$-axis into $n$ segments of size $\delta_x = 1/n$, and suppose the wall is on one of these chopping points (including point 0, but not point 1).  Chop the $y$-axis into $m$ segments of length $\delta_y = (1/3)/m$.  Define the value function $J(x,y)$ as the expected remaining travel distance to the destination under the optimal policy, given we are at a horizontal distance $x$, a vertical distance $y$, and none of our previous moves encountered a wall. The $J(x,y)$ function is defined over: 
$$ x \in \mathcal{X} = \{0, \delta_x, 2\delta_x, ..., 1\} \quad , \quad y \in \mathcal{Y}=\{0, \delta_y, 2\delta_y, ..., 1/3\}$$ 
Suppose we start at $(x_0,y_0)=(0,0)$. Working backwards, and assuming there is no wall at $x=1$, we get: 
$$J(1,y) =  y \quad \forall y \in \mathcal{Y} $$
Now assume $J(k\delta_x, y)$ is known for all $y$ and for some $k$.  Then: 
\begin{align}
J((k-1)\delta_x, y) &= P[\mbox{wall is here | have not yet seen it}]\left[1/3-y + \sqrt{1/9+ (1-(k-1)\delta_x)^2}\right]\\
&+P[\mbox{wall is not here | have not yet seen it}]\min_{v\in\mathcal{Y}}\left[J(k\delta_x,v)+\sqrt{\delta_x^2 +(y-v)^2}  \right]
\end{align}
Since we have discretized the problem, if a wall exists then it is located uniformly over one of the the $n$ points $\{0, \delta_x, ..., (n-1)\delta_x\}$.
Thus, if we are at location $(k-1)\delta_x$ and have not yet seen a wall at any of the locations $\{0, \delta_x, ..., (k-2)\delta_x\}$, we get: 
$$ P[\mbox{Wall here | not before}]=\frac{\frac{1}{2n} }{\frac{1}{2}+\frac{1}{2}\left(\frac{n-(k-1)}{n}\right)} $$

Note: I wrote a C program to implement the above.  Using $m=n$ restricts the slope options and leads to trapezoid-trajectories. That led me to incorrectly conjecture that trapezoids were optimal. Using a finer-grained slope option (as suggested by another Michael in a comment below), such as $m=100n$, gives curvy trajectories that seems consistent with two more recent answers here that look at optimizing the entire trajectory via variational analysis.  Here is an optimization over the (suboptimal) trapezoid functions and for the continuous version of the problem: Let $f(x)$ be the height as a function of $x$, being the trajectory to follow until we bump into the wall (if we ever do). So we start at $f(0)=0$. A class of functions is: 
$$ f(x) = \left\{ \begin{array}{ll}
x/3 &\mbox{ if $x \in [0, \theta]$} \\
\theta/3  & \mbox{ if $x \in [\theta, 1-\theta]$}\\
-(x-1)/3 & \mbox{ if $x \in [1-\theta, 1]$}  
\end{array}
\right.$$  
The best $f(x)$ over this class gives a minimum average distance of:
\begin{align}
dist^* &= -7 + 5\sqrt{\frac{5}{2}} + \frac{1}{2}\int_{0}^1 \sqrt{1/9 + x^2}dx  \approx 1.21973\\
3dist^* &\approx 3.6592
\end{align}
This is achieved by $\theta = 5 - 3\sqrt{5/2}$. This is strictly better than the naive policy of going straight until you bump into a wall, so it shows the naive policy is suboptimal.
A: At any point the ideal position would be either in the middle or at the corner, depending on if this point is the wall or not. The probability for this position $x_b$ being a wall position given that we already are at another point $x_a$ is $\frac{1}{2}\frac{1-x_a}{n}$ where $n$ is the resolution of a simulation. That is n steps in the dimension from start to goal.
So two cases for each pair of points $(x_a,x_b)$: 


*

*direction $(x_b-x_a,y-y_a)$ with probability $\frac{1}{2}\frac{1-x_a}{n}$

*direction $(x_b-x_a,0-y_a)$ with probability $1-\frac{1}{2}\frac{1-x_a}{n}$


Calculting the expected vector from each ($x_a,y_a$) as a weighted sum of the above cases would give us a set of vectors from each point which we could interpolate our way forward through.
This is probably not the best way as I probably forgot something, but at least presents one important way to think : calculate a vector field which we then use as the help to calculate a path through following the arrows.
