Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
1Activity
0 of .
Results for:
No results containing your search query
P. 1
Worst C project ever!

Worst C project ever!

Ratings: (0)|Views: 53|Likes:
Published by Secret Squirrel

More info:

Published by: Secret Squirrel on Oct 10, 2011
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

10/10/2011

pdf

text

original

 
proj3-page 1 of 2
ECE 3331 Project 3 – Fall 2011
(due 10/10/11 5 pm)
All fields of engineering involve situations where the proper allocation of resources is a critical problem. Consider forexample a situation in which four kinds of resources--labor, metals, plastics, and electronic components--are required toproduce each unit of four different types of computers. This information may be summarized in a "resource" matrix A asshown below:
Product | Labor Metals Plastics ElectronicsCharlie | 3 20 10 10Snoopy | 4 25 15 8Lucy | 7 40 20 10Linus | 20 50 22 15
The total number of each computer produced is constrained by the total resources available. If R is the vector showing thetotal amounts of each resource available, and we assume that all resources are to be used, then the system of linearequations A
T
X = R determines the amount of each product that can be produced.Now suppose that we have the option of increasing any one of the available resources. The linear system thenbecomes A
T
Y = R+E where E is zero except for the particular resource to be increased. If A is invertible, thenY =(A
T
)
-1
R+(A
T
)
-1
E = X+(A
-
1)TE so that Y-X = (A
-1
)
T
E. Since E has only one non-zero entry, we see that the impact of a unitincrease in a specific resource can be seen by examining the inverse of the resource matrix:
 A
=
    
1
00817010660136800888003960225601728002130146504085019090007101918001070113700089................ 
Each element of the inverse refers to the effect of increasing resource i on product j. The rows of the inverse correspond toresources while the columns correspond to products. For example, the (2,1) element specifies that an increase of 0.0396unit of Charlie will result from an additional unit of metal. Notice that some of the entries are negative, signifying that aunit increase in some resources will actually decrease the production of certain of the computers.The profit per unit of each computer is summarized in a profit vector:
Product ProfitCharlie | 1000Snoopy | 700Lucy | 1100Linus | 400
To evaluate the benefit to be gained by increasing each resource, multiply the resource inverse by the vector givingthe profit per product to get the
 
expected change in profit due to a unit increase in each resource:
 
    
12204632467707778.... 
Thus an increase in electronics(j=4) will yield the greatest increase in profit, followed closely by an increase in the amountof metals, while increases in labor or plastics will result in profit decreases.You are to write a C program that will do the following:(1)Input from a data file named cp3.dat a sequence of resource and profit arrays together with the names of the resourcesand products. The first line of the file contains a single integer which should be stored in a variable named 
num
, thenumber of resources and products. The second line contains the names of the individual resources, separated bysemicolons. These should be stored in a character array
reslbl
, one name per row. The third line contains the names of theindividual products, separated by semicolons. These should be stored in a character array
prdlbl
, one name per row. Thenext
num
lines contain the rows of the resource matrix. These should be stored in a matrix named 
resource
. The next linecontains the profit vector. This should be stored as a row vector named 
profit
, of course. Your program should be designed to read one set, perform the analysis described below, and then loop back to read another set until all data has beenprocessed. You may assume that the maximum number of resources and products is 10, and that the maximum number of characters in a name is 8. Thus you should #define the constants MAXNUM as 10 and MAXLEN as 9 (which allows forthe null at the end of the names).

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->