Gifting Problem Problem statement: Suppose you are in charge of

 

Gifting Problem
 Problem statement:

Suppose you are in charge of a non-profit organization that receives donated gifts and distributes them to
needy children. You are given a list of children with their ages (0 to 16 years old).
 For each gift, you are given the following information:
Retail price
Size of gift (cubic feet)
Range of suitable ages

Let: P = sum of retail prices of the gifts
N = total number of children
ei = | P/N – sum of retail prices for gifts given to child i |
You must minimize Σ ei  for the N children, subject to the following constraints:
1. Each gift must be given to exactly one child.
2. No child may be given a gift that is not intended for their age.
3. Each child must receive at least one large and one medium gift, where 1 ft3 <= medium gift <= 2 ft3, and
2 ft3 < large gift.
4. The number of gifts received by each child can be no less than the average – 1 and no more than the
average + 1.

Important:
The sum of the e_i values MUST be the absolute lowest value that is possible for the given input file.

Command line: ./gifting inputFileName outputFileName

Rubric:
Compiles, good programming style, processes command line arguments 15 pts.
Produces  correctly  formatted  output  file  with  all  children  and  gifts  included  10  pts.
Produces optimal solution 70 pts.
Compute time/space efficiency, creativity 5 pts. + extra credit possible
Notes:
1. Extra credit could possibly be large
2. Programming style based on Department Standards (see Programming Standards file on Canvas)
3. A signed Academic Integrity statement must be submitted to receive credit
Programs that do not compile and produce an executable on Clark will not be graded
Programs MUST be written in C/C++

Input format:

Plain text tab-delimited file. See example on next page. Child1 age 8
Child2 age 6
Child3 age 4

Gifts Price Size Ages
G1 12 1.3 7-14
G2 15 2.5 any
G3 8 1.5 0-5
G4 22 2.8 6-16
G5 10 1.5 any
G6 11 2.1 any

Output format:

The output should be a plain text tab-delimited file. It must begin with ‘Sum_e_i x’, where x is the sum of the ei
values. This should be followed by N rows, one for each child (in order), with their assigned gifts and ei value
as follows:

Sum_e_i 12.0   
Child1 G1 G6 3
Child2 G5 G4 6
Child3 G3 G2 3

 

Share This Post

Email
WhatsApp
Facebook
Twitter
LinkedIn
Pinterest
Reddit

Order a Similar Paper and get 15% Discount on your First Order

Related Questions

In this class, you have the opportunity to receive credit

In this class, you have the opportunity to receive credit for attending Live Chats or reviewing the chat archive. This opportunity is available once per week. To receive these points, you can either: Attend the Live Chat session.or Review the archived chat session and submit a 200-word summary of the

Public health nutrition programme

 You are a public health nutrition advisor. Your local health authority has asked you to review one of the existing international public health nutrition programmes below: ‘Community-based physical activity and nutrition programme for adults with metabolic syndrome in Vietnam’ ‘Effects of a multi-component nutritional telemonitoring intervention on nutritional status, diet

Everything You Know About Addiction Is Wrong Directions: Answer the

   Everything You Know About Addiction Is Wrong Directions: Answer the questions below after watching the TED Talk video. You must answer each question with at least 8 sentences.  Addiction is a major part of our society and hurts many of us either directly or indirectly. After watch the video

Legal Underpinnings of Business Law Imagine that you own each

Legal Underpinnings of Business Law Imagine that you own each of the following businesses: Tinker’s Home Security Service (sole proprietorship)Tinker & Tailor’s Home Security Service (general partnership)Tinker & Tailor’s Home Security Service (LP)Tinker & Tailor’s Home Security Service, Inc. (corporation)Tinker & Tailor’s Home Security Service, LLC (LLC) The businesses are

World affairs: Contemporary Europe

Students need to write a min. 3 page/800-1000 word book review, on a book related to the topics of the course, or on a book related to the topic of their paper. You will need to get the approval of the instructor for the book you are proposing to review

Use the HeartDesease_DataFile.xls file as training data set and create

 Use the HeartDesease_DataFile.xls file as training data set and create a decision tree, and a Naïve Bayes Classifier in R that will predict the following records (AKA test data) for Heart Disease. For the Decision Tree section of this assignment, show your tree in R based on the training data

the search area is about pets. find the pet company

the search area is about pets. find the pet company that located in BC, Canada Lab 7 – IC 1 – Communicating Culture. The following links provide excellent context for the importance of communication in human resource management and leadership as well as examples of types of internal communication and

NEED ASAP Information systems Nursing Assignment Help

Information systems are an essential competitive resource for health care organizations and are critical in supporting strategic decision making, administrative operations, and patient care in an increasingly information intensive industry. What changes are information systems, in general, and the electronic medical record (EMR), specifically, bringing to health care and how

After reading the story of Almeada and baby in Chapter

 After reading the story of Almeada and baby in Chapter 1, in what ways are social care, social control and social rehabilitation applied to Almeada and baby Anne?  What role does case management play in the life of Almeada and baby Anne?  What challenges would Almeada face without the support

Deliverable Length: 4–6 pages (not including cover page and resource

 Deliverable Length:  4–6 pages (not including cover page and resource page)   The National Labor Relations Act (NLRA) of 1935 was established to help protect the rights of employees and employers, encourage collective bargaining, and discourage harmful labor and management practices. It also created the National Labor Relations Board (NLRB). When

Explain the organizational structure of your healthcare organization to your

  Explain the organizational structure of your healthcare organization to your peers/colleagues. Does one of the common management theories support this structure? If yes, which theory?  Where is the formal leadership?  Where is the informal leadership?  Describe how this structure impacts the process of change (positively or negatively).   Support your discussion

Watch the video: Van Gogh’s Bedroom. Summarize the features of

   Watch the video: Van Gogh’s Bedroom. Summarize the features of style in Vincent van Gogh’s Bedroom. Identify and describe the colors, lines, texture, pattern, shape, and space. Explain the emotional mood that the artist creates with these visual elements. ·  Explain the difference between period and regional style. Define personal

Watch the attached video linked at the bottom of this

Watch the attached video linked at the bottom of this post and answer each of the following questions in at least 4 complete sentences; then respond to AT LEAST two classmates’ posts.  1. What made certain civilizations thrive while others struggled? Think in regards to food, animals, and geography. 2.

The course textbook lists the ten most frequently cited OSHA

The course textbook lists the ten most frequently cited OSHA standards. Select the standard that you believe presents the greatest risk to employees. Describe why you feel violating the selected standard presents a greater risk to employees than the others. Support your response by describing some hazards you have encountered

You are serving on a jury for a murder trial.

You are serving on a jury for a murder trial. The evidence presented at trial was largely circumstantial and, in your mind, equivocal. During closing, the prosecutor argued that you must find the defendant guilty because he confessed to the crime. The defense attorney immediately objected and the judge sternly

In this paper, the student will provide a detailed Nursing Assignment Help

In this paper, the student will provide a detailed description of the relationship between the category from the NCLEX-RN examination blueprint, the priority concept (Health promotion and maintenance in regard to Health screening methods and early detection.)  1)     Write a 4–6-page paper (not including the title page or reference page)

Community Teaching on Immunizations

Details: 1. Benchmark – Community Teaching Plan: Community Presentation 2. Benchmark – Community Teaching Plan: Community Teaching Work Plan Proposal 3. Community Teaching Plan: Teaching Experience Paper Note: This is an individual assignment. Based on the feedback offered by the provider, identify the best approach for teaching. Prepare a presentation

Half Page .. Need in 3 hours Search the web

 Half Page .. Need in 3 hours Search the web for online tools that will help you track an IP address. (Such tools can be valuable if your system is attacked by a hacker and if you can cull the hacker’s IP address from system logs.) Evaluate several of these