Find Jobs
Hire Freelancers

build graph and find the shortest path

$30-5000 USD

已关闭
已发布大约 21 年前

$30-5000 USD

货到付款
Program Specs You MUST write this program by building and traversing a graph, if you find a cute math formula to solve the problem NO credit will be given. Create a [login to view URL] that explains your algorithm, think of it as a design spec. Someone reading it, that can code in any language, should be able to code your algorithm without having to ask you a bunch of questions. In the movie ``Die Hard 3", Bruce Willis and Samuel L. Jackson were confronted with the following puzzle. They were given a 3-gallon jug and a 5-gallon jug and were asked to fill the 5-gallon jug with exactly 4 gallons. The solution they reached was to fill the 5-gallon jug, pour the 5-gallon jug into the 3-gallon jug (this left 2 gallons in the 5-gallon jug) empty the 3-gallon jug, pour the 5-gallon jug into the 3-gallon jug, fill the 5-gallon jug and then fill the 3-gallon jug from the 5-gallon jug, empty the 3 gallon jug, leaving 4 gallons in the 5 gallon jug. Your assignment will be to generalize this problem in the follow manner. You have two jugs, A and B, and an infinite supply of water. There are three types of actions that you can use each with a cost: (1) you can fill jug A or B (2) you can empty jug A or B (3) you can pour from one jug to the other. Pouring from one jug to the other stops when the first jug is empty or the second jug is full, whichever comes first. For example, if A has 5 gallons and B has 6 gallons and a capacity of 8, then pouring from A to B leaves B full and 3 gallons in A. for the complete detail please check the zip file, it contain the complete requirement for the program ## Deliverables A problem is given by (Ca, Cb, N, cfA, cfB, ceA, ceB, cpAB, cpBA), where Ca and Cb are the capacities of the jugs A and B, respectively, and N is the goal. cfA is the cost to fill A, cfB is the cost to fill B, ceA, is the cost to empty A, ceB is the cost to empty B, cpAB is the cost to pour A to B and cpBA is the cost to pour B to A. A solution is a sequence of steps that leaves jug A empty, and exactly N gallons in jug B. The possible steps are fill A fill B empty A empty B pour A B pour B A success X fill means to fill the jug from the infinite water supply empty means to discard the water in the jug where "pour A B" means " pour the contents of jug A into jug B" "success X" means that the goal has been accomplished, jug B contains N gallons at a cost of X. Write a Jug class (located in jug.h / [login to view URL]) that takes 9 parameters in the constructor. (Ca, Cb, N, cfA, cfB, ceA, ceB, cpAB, cpBA) Note: the order IS important, Also checking for valid input is something you should do. Your Jug class must have a Solve() member which will solve and then print the CHEAPEST solution. class Jug { public: Jug(int,int,int,int,int,int,int,int,int); ~Jug(); //Solve is used to check input and find the solution if one exists //returns -1 invalid inputs. Do not print anything. //returns 0 if inputs are valid but a solution does not exist. Do not print anything. //returns 1 if solution is found and also prints solution. int Solve(); private: //anything else you need }; for the complete detail please check the zip file, it contain the complete requirement for the program ## Platform program must run on c++ or linux
项目 ID: 2914421

关于此项目

6提案
远程项目
活跃21 年前

想赚点钱吗?

在Freelancer上竞价的好处

设定您的预算和时间范围
为您的工作获得报酬
简要概述您的提案
免费注册和竞标工作
6威客以平均价$61 USD来参与此工作竞价
用户头像
See private message.
$34 USD 在14天之内
4.9 (167条评论)
5.8
5.8
用户头像
See private message.
$68 USD 在14天之内
5.0 (52条评论)
5.1
5.1
用户头像
See private message.
$68 USD 在14天之内
4.8 (14条评论)
4.5
4.5
用户头像
See private message.
$51 USD 在14天之内
5.0 (4条评论)
1.3
1.3
用户头像
See private message.
$59.50 USD 在14天之内
0.0 (0条评论)
0.0
0.0
用户头像
See private message.
$85 USD 在14天之内
0.0 (0条评论)
0.0
0.0

关于客户

UNITED STATES的国旗
United States
5.0
3
会员自8月 22, 2003起

客户认证

谢谢!我们已通过电子邮件向您发送了索取免费积分的链接。
发送电子邮件时出现问题。请再试一次。
已注册用户 发布工作总数
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
加载预览
授予地理位置权限。
您的登录会话已过期而且您已经登出,请再次登录。