Longest-path routing problems, which can arise in the design of high-performance printed circuit boards (PCBs), have been proven to be NP-hard. In this article, we propose a constraint programming (CP) formulation and a mixed integer linear programming (MILP) formulation to gridded longest-path routing problems; each of which may contain obstacles. After a longest-path routing problem has been transformed into a CP problem, a CP solver can be used to find optimal solutions. On the other hand, parallel MILP solvers can be used to find optimal solutions after the longest-path routing problem has been transformed into an MILP problem. Also, suboptimal solutions can be generated in exchange for reduced execution time. The proposed formulation methods can also be used to solve shortest-path routing problems. Experimental results show that more than 3,700x speed-up can be achieved by using a parallel MILP solver with 16 threads in solving formulated longest-path routing problems. The execution time can be further reduced if a computer containing more processer cores is available. 1