Kennesaw State University CS 4491 Assigment 7


Kennesaw State University
Department of Computer Science
Advanced Topic in Computer Science CS 4491/2
Assignment # 7 / Bed Company/ Maximize Factory

Dalibor Labudovic

05/6/2013
















Initial Problem Statement:
1)A factory produces three types of beds, A, B, and C. The company that owns the factory sells beds of type A for $250.00 each, beds of type B for $320.00 each, and beds of type C for $625.00 each. management estimates that all beds produced of type A and C will be sold. The number of beds of type B that can be sold is at the most 45. The production of different types of bed require a different amount of resources such as: basic labor hours, specialized hours, and materials. The following table provides this data:
Type A
Type B
Type C
Resources
10ft.
60ft.
80ft.
Material
15h
20h
40h
Basic Labor
5h
15h
20h
Specialized Labor

The amount of resources available are: 450ft. Of material, 210 hours of basic labor, and 95 hours of specialized labor. The problem is to optimize profit. Write the formulation of the mathematical optimization problem. Use LP_solver and GLPK glpsol to find a numerical solution to the linear optimization problem.

2) A factory manufactures 5 different products: P1, P2, P3, P4, and P5. The factory needs to maximize profit. Each product requires machine time on three different devices. A, B, and C, each of which is available 135 hours per week. The following table provides the data:
Product
Device A
Device B
Device C
P1
20
15
8
P2
13
17
12
P3
15
7
11
P4
16
4
7
P5
18
14
6
The unit sales price for products P1, P2, and P3 is $7.50, $6.00, and $8.25 respectively. The first 26 units of P4 and P5 have a sale prices $5.85 each, all excess units have a sale price of $4.50 each. The operations costs of device A and B are $5.25 per hour. And $5.85 for device C. The cost of materials for products P1 and P4 are $2.75. For products P2, P3, and P5 the materials cost is $2.25. Hint: Assume that Xi, i=1...5 are the number of unit produced of the various products and use two new variables Y4 and Y5 for the units produced of P4 and P5 respectively in excess of 26. Write the formulation of the mathematical optimization problem. Use LP_solver and GLPK glpsol to find a numerical solution to the linear optimization problem.
Summary and purpose of the assignment activity:
The summary of the assignment is to utilize an optimization mathematical formalization for optimization and translate it into a simple program. The program then is run through another program LP solver or GLPK glpsol to find the numerical solution to the linear optimization problem.
The purpose of this assignment activity is to utilize deep knowledge of mathematical and invoke real world problem issue to resolve with the use of computational programs.

Detail description of the solution and used in the project:
The solution used in this project is the use of mathematical linear optimization formulation to devise a customized formula then translate it to the computational model. The program lp solve or glpsol will then find a numerical value.


1) SOURCE CODE
/* optim.lp */


Maximize: 250 x1 + 320 x2 + 625 x3;


10 x1 + 60 x2 + 80 x3 <= 450;
15 x1 + 20 x2 + 40 x3 <= 210;
05 x1 + 15 x2 + 20 x3 <= 95;
x1 >= 0;
x2 >= 0;
x3 >= 0;
x2 <= 45;




2.) SOURCE CODE
/* Function objective : total profits */
max: 7.50p1 + 6.00p2 + 8.25p3 + 5.85p4i + 4.50p4 + 5.85p5i + 4.50p5
-2.75p1 - 2.25p2 - 2.25p3 - 2.75p4i - 2.75p4 - 2.25p5i - 2.25p5 - 5.25a - 5.25b - 5.85c;

/*constraints */
20a + 15b + 8c <= 135; /* P1 */
13a + 17b + 12c <= 135; /* P2 */
15a + 7b + 11c <= 135; /* P3 */
16a + 4b + 7c <= 135; /* P4 */
18a + 14b + 6c <= 135; /* P5 */
p4i<= 26; /* first 26 products at $5.85 constraint */
p5i<= 26; /* first 26 products at $5.85 constraint */
p4 > 27;
p5 > 27;
a + b + c <= 135;

bin p1, p2, p3, p4i, p4, p5i, p5;
int a, b, c;

#optim_sales.mod
#Using GLPK glpsol

/*Decision Variables */
var p1 >= 0;
var p2 >= 0;
var p3 >= 0;
var p4 >= 0;
var p4i >= 0;
var p5i >= 0;
var p5 >= 0;
var a >= 0;
var b >= 0;
var c >= 0;

/*Objective Function */
maximize z: 7.50 * p1 + 6.00 * p2 + 8.25 * p3 + 5.85 * p4i + 4.50 * p4 + 5.85 * p5i + 4.50 * p5 - 2.75 * p1 - 2.25 * p2 - 2.25 * p3 - 2.75 * p4i - 2.75 * p4 - 2.25 * p5i - 2.25 * p5 - 5.25 * a - 5.25 * b - 5.85 * c;

/* Constraints */
s.t. R1:20 * a + 15 * b + 8 * c <= 135;
s.t. R2:13 * a + 17 * b + 12 * c <= 135;
s.t. R3:15 * a + 7 * b + 11 * c <= 135;
s.t. R4:16 * a + 4 * b + 7 * c <= 135;
s.t. R5:18 * a + 14 * b + 6 * c <= 135;
s.t. R6:p4i < 27;
s.t. R7:p5i < 27;
s.t. R8:p4 > 26;
s.t. R9:p5 > 26;
s.t. R10: a + b + c <= 135;

bin p1, p2, p3, p4i, p4, p5i, p5;
int a, b, c;

end;


Table of results:
1)LP Solver

Value of objective function: 3500

Actual values of the variables:
x1 14
x2 0
x3 0

GLPK
GLPK 4.45 - SENSITIVITY ANALYSIS REPORT Page 1

Problem: optim
Objective: z = 3500 (MAXimum)

No. Row name St Activity Slack Lower bound Activity Obj coef Obj value at Limiting
Marginal Upper bound range range break point variable
------ ------------ -- ------------- ------------- ------------- ------------- ------------- ------------- ------------
1 z BS 3500.00000 -3500.00000 -Inf 3343.75000 -1.00000 . x3
. +Inf 3500.00000 +Inf +Inf

2 R1 BS 140.00000 310.00000 -Inf . -25.00000 . R2
. 450.00000 280.00000 .28571 3540.00000 x2

3 R2 NU 210.00000 . -Inf . -16.66667 . x1
16.66667 210.00000 285.00000 +Inf 4750.00000 R3

4 R3 BS 70.00000 25.00000 -Inf . -50.00000 . R2
. 95.00000 125.35714 1.60000 3612.00000 x2

5 R4 BS . 45.00000 -Inf . -Inf 3500.00000
. 45.00000 3.00000 13.33333 3500.00000 x2

GLPK 4.45 - SENSITIVITY ANALYSIS REPORT Page 2

Problem: optim
Objective: z = 3500 (MAXimum)

No. Column name St Activity Obj coef Lower bound Activity Obj coef Obj value at Limiting
Marginal Upper bound range range break point variable
------ ------------ -- ------------- ------------- ------------- ------------- ------------- ------------- ------------
1 x1 BS 14.00000 250.00000 . 10.00000 240.00000 3360.00000 x2
. +Inf 14.00000 +Inf +Inf

2 x2 NL . 320.00000 . -Inf -Inf +Inf
-13.33333 +Inf 3.00000 333.33333 3460.00000 R3

3 x3 NL . 625.00000 . -Inf -Inf +Inf
-41.66667 +Inf 3.75000 666.66667 3343.75000 R3

End of report

2) LP Solver

Value of objective function: 25.2

Actual values of the variables:
p1 1
p2 1
p3 1
p4i 1
p4 1
p5i 1
p5 1
a 0
b 0
c 0

Comments and Conclusion:
In conclusion this assignment activity was real well thought out and very difficult to understand and process but this type of assignment will provide me with the knowledge and skills to better my overall understanding of computational model and computational processing. The principles and guides line I learned in this project will be a useful still not only in C programming but also scientific computing.

Script:
1.)
script started on Tue 23 Apr 2013 01:56:48 PM EDT
#]0;dlabudovic@ubuntu: ~/Documents/CS4491/assign_07/P1#dlabudovic@ubuntu:~/Documents/CS4491/assign_07/P1$ lp_solve s##[KS##[K-S4 potim.l##[K##[K##[K##[K##[K##[K##[Koptim.lp

Value of objective function: 3500

Actual values of the variables:
x1 14
x2 0
x3 0

Actual values of the constraints:
R1 140
R2 210
R3 70

Objective function limits:
From Till FromValue
x1 240 1e+30 -1e+30
x2 -1e+30 333.3333 3
x3 -1e+30 666.6667 3.75

Dual values with from - till limits:
Dual value From Till
R1 0 -1e+30 1e+30
R2 16.66667 0 285
R3 0 -1e+30 1e+30
x1 0 -1e+30 1e+30
x2 -13.33333 -1e+30 3
x3 -41.66667 -1e+30 3.75
#]0;dlabudovic@ubuntu: ~/Documents/CS4491/assign_07/P1#dlabudovic@ubuntu:~/Documents/CS4491/assign_07/P1$ exit
exit

Script done on Tue 23 Apr 2013 01:57:11 PM EDT
2.)
Script started on Sun 05 May 2013 10:56:38 PM EDT
#]0;dlabudovic@ubuntu: ~/Documents/CS4491/assign_07/P2#dlabudovic@ubuntu:~/Documents/CS4491/assign_07/P2$ nano optim_sales.mod####################glpsol --model optim_sales.mod -o optim_sales.sol##################################################[29Pnano optim_sales.mod####################glpsol --model optim_sales.mod -o optim_sales.sol
GLPSOL: GLPK LP/MIP Solver, v4.45
Parameter(s) specified in the command line:
--model optim_sales.mod -o optim_sales.sol
Reading model section from optim_sales.mod...
optim_sales.mod:25: strict inequality not allowed
Context: ...; s.t. R5 : 18 * a + 14 * b + 6 * c <= 135 ; s.t. R6 : p4i <
MathProg model processing error
#]0;dlabudovic@ubuntu: ~/Documents/CS4491/assign_07/P2#dlabudovic@ubuntu:~/Documents/CS4491/assign_07/P2$ lp_solve optim_sales.lp

Value of objective function: 25.2

Actual values of the variables:
p1 1
p2 1
p3 1
p4i 1
p4 1
p5i 1
p5 1
a 0
b 0
c 0
#]0;dlabudovic@ubuntu: ~/Documents/CS4491/assign_07/P2#dlabudovic@ubuntu:~/Documents/CS4491/assign_07/P2$ exit
exit

Script done on Sun 05 May 2013 10:58:09 PM EDT

Comments

Popular posts from this blog

How to clear & format SD card

Sharepoint List: Days Elapsed or Countdown

CS4500 Test 4 Study Guide