Closed

Completion of the project and executing it in c++

This project has been awarded to usamamw141 for $30 USD.

Get free quotes for a project like this
Employer working
Project Budget
$10 - $30 USD
Total Bids
4
Project Description

Gifting Problem

Problem statement:

Suppose you are in charge of a non-profit organization that receives donated gifts and distributes them to various institutions that deliver them to disadvantaged children. For each institution, you are given the following information: List of children with their ages Limit on total volume of presents For each gift, you are given the following information: Retail price Size of gift (cubic feet) Range of suitable ages Eye appeal (binary value: 0 = no, 1 = yes) 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 or two medium sized gifts, where 1 ft3 <= medium gift <= 2 ft3, and 2 ft3 < large gift. 4. Each child must receive at least one gift with ‘eye appeal’. 5. The number of gifts received by each child can be no less than the average – 1 and no more than the average + 1. 6. For each institution, the total volume of gifts assigned to children in that institution must not exceed its limit. Important: the sum of the e_i values should be the lowest value that is possible for the given input file.

Input format:

Plain text tab-delimited file. See example on next page.

numInstitutions 3 Institution1 volumeLimit 16 Child1 age 8 Child2 age 6 Child3 age 4 Child4 age 9

Institution2 volumeLimit 14 Child5 age 7 Child6 age 5 Child7 age 6

Institution3 volumeLimit 26 Child8 age 2 Child9 age 6 Child10 age 4 Child11 age 3 Child12 age 10

Gifts Price Size Ages EyeAppeal

G1 12 1.3 4-7 1 G2 15 2.5 any 1 G3 8 0.5 11-16 0 G4 22 0.8 0-3 1 G5 10 1.5 any 1 G6 11 1.1 any 1 G7 4 2.3 any 0 G8 8 0.7 11-16 1 G9 15 0.9 3-8 1 G10 10 1.5 any 1 G11 12 [url removed, login to view] 4-7 1 G12 16 2.2 any 0 G13 7 2.5 any 0 G14 19 0.9 0-3 1 G15 11 1.5 any 1 G16 12 1.4 6-14 1 G17 15 2.1 any 1 G18 16 0.4 11-16 0 G19 24 0.8 0-7 1 G20 1 1.4 any 1

Output format:

The output should be a plain text tab-delimited file. It should 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 [url removed, login to view] Child1 G9 G13 G20 [url removed, login to view] Child2 G1 G16 [url removed, login to view] etc.

Awarded to:
Skills Required

Browse Related Skills

Related Projects

Other things people do on Freelancer

Related Articles

Latest Articles

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online