Jump to content

Asking help from smart math people (Again)

Go to solution Solved by Dash Lambda,

It uses i as an index, so xi is the distance to the ith gas station from the starting point and ci is how long it takes the ith gas station to fill up. So a gas station that's 20 miles from SF that takes 5 minutes to fill up would have xi = 20 and ci = 5.

 

As for hints: Since you're trying to find the path that will spend the least time filling up, the distance between the gas stations only matters for determining which ones can connect. You can use that fact to directly apply an algorithm you're familiar with.

763612008_Screenshotfrom2019-03-2002-12-12.png.059a0f242d74cbee4aacfe27aa7e50cd.png

 

I am currently stuck with this problem. I know this can be done with dynamic programming(question says so) but I am having difficulty pinpointing the optimal substructure/subproblem. I was thinking I would consider stopping at whichever gas station within 100 miles of stony brook that fills up the most gas per second as the optimal subsolution and then go to whichever next fastest gasoline refilling gas station within 100 miles of that station as the next optimal subsolution and so on until all the way to San Francisco but the ci minutes is confusing me. what does that mean? Is it saying C7 is going to take the most time refilling and c1 takes the least? 

 

@Dash Lambda

Can you please kindly explain what ci means and give me some hints if you have a moment to spare? I would really appreciate it.   

Sudo make me a sandwich 

Link to comment
https://linustechtips.com/topic/1046321-asking-help-from-smart-math-people-again/
Share on other sites

Link to post
Share on other sites

It uses i as an index, so xi is the distance to the ith gas station from the starting point and ci is how long it takes the ith gas station to fill up. So a gas station that's 20 miles from SF that takes 5 minutes to fill up would have xi = 20 and ci = 5.

 

As for hints: Since you're trying to find the path that will spend the least time filling up, the distance between the gas stations only matters for determining which ones can connect. You can use that fact to directly apply an algorithm you're familiar with.

"Do as I say, not as I do."

-Because you actually care if it makes sense.

Link to post
Share on other sites

4 hours ago, Dash Lambda said:

It uses i as an index, so xi is the distance to the ith gas station from the starting point and ci is how long it takes the ith gas station to fill up. So a gas station that's 20 miles from SF that takes 5 minutes to fill up would have xi = 20 and ci = 5.

 

As for hints: Since you're trying to find the path that will spend the least time filling up, the distance between the gas stations only matters for determining which ones can connect. You can use that fact to directly apply an algorithm you're familiar with.

I see, so I can pretty much construct stations as the nodes, their refilling rate as the edge weight and connect all the stations within 100 miles of each other with an edge. I can then apply bellman Ford algorithm. I think that works. Thanks again. You are my math hero.  

Sudo make me a sandwich 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×