Find closest point, subject to linear inequality constraints

This can be done in $O(N log(N))$ time, where $N$ is the number of rows in $A$.

The matrix inequality $Ax \leq b$ is equivalent to half-plane inequalities: $(a_i, x) \leq b_i, i = 1, \ldots, N$. We can obtain the vertices of polygon that is the intersection of these half-planes by the following procedure:

  1. Transform lines $\{(a_i, x) = b_i\} \mapsto d_i$ using duality transformation: $\delta(\{a x + b y = 1\}) = (a, b)$.

  2. Construct the convex hull of $d_i$ using one of known algorithms.

  3. Map the vertices and sides of the obtained convex hull back to the primal space: $\delta((a, b)) = \{a x + b y = 1\}$, $\delta(\{a x + b y = 1\}) = (a, b)$ and obtain the polygon $C_1 C_2 \ldots C_N$ which is this the intersection of initial half-planes.

  4. Now you know all the vertices of the polygon and can apply the above cited methods to your problem.

I'm not quite sure that this is the best solution, though.

If your task is repeatable, i.e. you have to repeat the problem for different $p$'s many times, you can construct the dynamic convex hull and find the distance in $O(log(N))$ for each query.