Results 1 to 3 of 3
  1. #1
    sthack99 is offline Member
    Join Date
    Mar 2008
    Posts
    3
    Rep Power
    0

    Question Power Station Problem

    I need help on a homework assignment.

    Let's say we have a power station on one side of a river and a factory on the other side of the river. For this example, we will say the river is half a mile wide, and the factory is 8 miles downstream from the power station. We'll also say it costs $9 to run power lines underwater, and $7 to run them overland. My objective is to determine the most economical path to lay the power line. That is, determine how long the power line should run under water and how long it should run over land, to achieve the minimum total cost of laying the power line.
    THEN I need to create a program that will prompt the user to enter:
    - the width of the river
    - the distance of the factory downstream on the other side of the river
    - the cost of laying the power line underwater
    - the cost of laying the power line overland
    The program should then output the length of the power line that should be run underwater, the length overland, and the total cost of constructing the power line.

    I've been working my brain at this one all day and I just can't anymore. Can anyone help me?

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,728
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by sthack99 View Post
    I need help on a homework assignment.

    Let's say we have a power station on one side of a river and a factory on the other side of the river. For this example, we will say the river is half a mile wide, and the factory is 8 miles downstream from the power station. We'll also say it costs $9 to run power lines underwater, and $7 to run them overland. My objective is to determine the most economical path to lay the power line. That is, determine how long the power line should run under water and how long it should run over land, to achieve the minimum total cost of laying the power line.
    THEN I need to create a program that will prompt the user to enter:
    - the width of the river
    - the distance of the factory downstream on the other side of the river
    - the cost of laying the power line underwater
    - the cost of laying the power line overland
    The program should then output the length of the power line that should be run underwater, the length overland, and the total cost of constructing the power line.

    I've been working my brain at this one all day and I just can't anymore. Can anyone help me?
    Maybe a bit of ASCII art helps:

    Java Code:
                       0   1   2   3   4   5   6   7   8
                       +---+---+---+---+---+---+---+---+ <--- factory
                    0.5|                               |
    power station ---> +---+---+---+---+---+---+---+---+
                              ^
                              |
                              x
    The rectangular block is the river; the bottom left point is the power station and the top right point is the factory. Point x is where the cable has crossed the river. So the cable runs over land for 8-x miles and the length of the cable in the river is sqrt(x*x+0.25). The total costs are 7*(8-x)+9*sqrt(x*x+0.25).

    Minimizing that function gives you a value for x where the costs are minimal. Maybe you can do it analytically (differentiate w.r.t. x and solve for f'(x) == 0) or maybe you have to do it numerically.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

Similar Threads

  1. Power*MatchMaker 0.9.2
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 11-27-2007, 09:21 PM
  2. Power*MatchMaker 0.9.1
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 11-17-2007, 03:05 PM
  3. Power*Architect 0.9.7
    By levent in forum Java Software
    Replies: 0
    Last Post: 07-31-2007, 07:52 PM
  4. Power*Architect 0.9.6
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 07-07-2007, 03:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •