<?php
/* SIMPLE SIMPLEX SOLVER CODES
created by Donni Ansyari
Contoh Kasus :
The owner of a shop producing automobile trailers wishes to determine the best mix for
his three products: flat-bed trailers, economy trailers, and luxury trailers. His shop is limited to working 24
days/month on metalworking and 60 days/month on woodworking for these products. The following table
indicates production data for the trailers
Let the decision variables of the problem be:
x1 =Number of flat-bed trailers produced per month,
x2 =Number of economy trailers produced per month,
x3 =Number of luxury trailers produced per month.
Assuming that the costs for metalworking and woodworking capacity are fixed, the problem becomes:
Maximize z = 6x1 + 14x2 + 13x3
subject to:
1/2 x1 + 2x2 + x3 <= 24,
x1 + 2x2 + 4x3 <= 60,
x1 >= 0, x2 >= 0, x3 >= 0.
Letting x4 and x5 be slack variables corresponding to unused hours of metalworking and woodworking
capacity, the problem above is equivalent to the linear program
Maximize z = 6x1 + 14x2 + 13x3,
subject to:
1/2 x1 + 2x2 + x3 + x4 = 24,
x1 + 2x2 + 4x3 + x5 = 60
xj >= 0 (j = 1, 2, . . . , 5).
The third row represents the z-equation, which may be rewritten as:
(−z) + 6x1 + 14x2 + 13x3 = 0.
By convention, we say that (−z) is the basic variable associated with this equation. Note that no formal
column has been added to the tableau for the (−z)-variable.
Usage per unit of trailer Resource Availabilities
Flat-bed Economy Luxury
Metalworking days 1/2 2 1 24
Woodworking days 1 2 4 60
Contribution ($ x 100) 6 14 13
----------------------------------------------------------------------------
Number of Trailers produced per month
Flat-bed Economy Luxury
36 0 6 <- Changing Cell
--------------------------------------
Constraints
24 <= 24 Metalworking days is limited to 24 days/month <- Subject to constraint
60 <= 60 Woodworking days is limited to 60 days/month
Total Contribution ($ x 100)
294 <- Target Cell
*/
//TEST DATA 1:
$leftdata=array
(
array(0.5,2,1),
array(1,2,4)
); // Persamaan disebelah kiri
$rightdata=array(24,60); //nilai sebelah kanan <- Subject to constraint
$zdata=array(6,14,13); // Persamaan Maximum atau minimum
?>
|