Project 3: Linear Programming

Linear Programming Example:

Suppose we want to optimize the amount of profit we can make by producing jackets and hats.

It takes 4 hours to produce jackets and 1 hour to produce a hat.

We only have 1000 hours available to produce items.

Each Jacket produces a profit of 60 dollars and each hat produces a profit of 20 dollars.

We have minimum requirements for the number of each item:

We must produce at least 200 hats and 50 jackets.


If we let X = # of jackets and Y = # of hats, we have the following constraints:

1) X  50  (We must make at least 50 jackets)

2) Y   200 (We must make at least 200 hats)

3) 4X + Y 1000 (The number of hours spent must be less than or equal to 1000)


The region (purple region) below shows the region of feasibility.  The x and y-scales are both 50 units.

We know the optimum strategy must occur at an endpoint of the region of feasibility.  The endpoints are:

(50, 200)  The intersection of x = 50 and y = 200

(200,200) The intersection of 4x + y = 1000 and y = 200

(50, 800) The intersection of 4x + y = 1000 and x = 50


The Profit Equation is: 60X + 20Y

With 50 jackets and 200 hats, our profit is $7,000

With 200 jackets and 200 hats, our profit is $16,000

With 50 jackets and 800 hats, our profit is $19,000

We should produce 50 jackets, 800 hats, to produce a profit of $19,000.


Project 3: Variables 'minHats', 'minJackets', 'maxHours', 'profitJacket', 'profitHat' have been assigned.

minHats is the smallest number of hats we can produce (200 in the example above)

minJackets is the smallest number of hats we can produce (50 in the example above)

maxHours is the largest number of hours we can take(1000 in the example)

profitJacket is the amount of profit for each jacket produced (60 in the example above)

profitHat is the amount of profit for each hat produced (20 in the example above)

A jacket always takes 4 hours to produce and a hat always takes 1 hour to produce.

Task: Initialize the values of 'numJackets', 'numHats', 'profit' that are represent the number of jackets and hats we should produce to have the higest profit (50, 800, 19000 in the example above)

**If your code works for 5 test cases in a row, you can enter your e-mail address.