Ozan
Ozan

Reputation: 51

Longest path algorithm with "can" have loop and negative edge in certain amount step

I've done my own research ,However I couldn't find a proper solution for my demand.

The problem is , I have a truck which needs to spend it's load(let's say garbage). There are cities(node) and edges(way) which can be positive edge or negative . While truck takes the a way , it can loose or have to get more(waste) depends on the selected way(edge). If it selected positive edge , it loose the waste exactly same amount of the selected way value. And vice versa.

So , truck driver has to make a certain amount of step(every step take a constant time whatever the value of the edge) and driver has limited time to come back his home(origin node)(time will be a given parameter)

So in this graph , we have nodes , we have edges which is one direction to , this edge can have negative or positive value , and in the graph there can be loops which driver is allowed to use or not to use . And nodes can point each other with different edges. (from A to B edge val is 5 ) (from B to A edge val is -3 and so on..)

So I want to give to the driver the best way to spend it's maximum load in the best possible shortest time.

So , the problem is this.

What I want is, note the actual code.

If you know the name of the problem you can specify , you're welcome. If you'd like to share your own algorithm with pseudo code or just words. You're welcome ,too. If you'd like to share a link which you think a similar problem is asked. You're also welcome.

And if you think it's not possible to solve. Please share your thoughts or a link that proves .

Thanks in advance.

Upvotes: 0

Views: 175

Answers (0)

Related Questions