Find path from A to B which length ≈ L I have an undirected weighted graph.

I want to find the path from A to B which length (sum of the weights) is as close as possible to a specific value "L".

To do that, I have been doing a DFS to check all the possible paths... When L is relatively small, it's ok. But when I ask for a bigger L, it takes too much time to complete. I added some criteria to stop searching useless paths but that cannot solve the problem.

So I was wondering how to do what I am searching for. Is DFS the only solution ? I thought about genetic algorithms but I don't know if it would work.

Thank you !
There are no known efficient algorithms for your problem. Consider the case where every edge has weight&nbsp;$1$ and there are $n$&nbsp;vertices in the graph. A path from $A$ to&nbsp;$B$ with weight (approximately) $n-1$ is (approximately) a Hamiltonian path from $A$ to&nbsp;$B$ and finding Hamiltonian paths is NP-hard.