Class 9 Part 1

1[lingo-class-ex]
class 9
LINGO Demo (Continued)
LINGO-run demo of Product-mix Problem on P. 83 and output explanation
Table 1 - Hillier and Lieberman (2005), Table A3.1
! Objective Function;
MAX = 26*p1 + 35*p2 + 25*p3 + 37*p4;
! Constraints;
1.7*p1 + 2.1*p2 + 1.4*p3 + 2.4*p4 <= 28;
1.1*p1 + 2.5*p2 + 1.7*p3 + 2.6*p4 <= 34;
1.6*p1 + 1.3*p2 + 1.6*p3 + 0.8*p4 <= 21;
Global optimal solution found at step:
Objective value:
475.0000
Variable
Value
P1
0.0000000
P2
10.00000
P3
5.000000
P4
0.0000000
Row
1
2
3
4
3
Reduced Cost
3.577922
0.0000000
0.0000000
1.441558
Slack or Surplus
Dual Price
475.0000
1.000000
0.0000000
15.25974
0.5000000
0.0000000
0.0000000
2.272727
1
SET NOTATION EXAMPLE
Again, LINGO-run demo of Product-mix Problem on P. 83 and output
explanation.
SETS:
!The simple sets;
Machine: ProdHoursAvail;
Product: Profit, Produce;
!A derived set;
MaPr(Machine, Product): ProdHoursUsed;
ENDSETS
DATA:
!Get the name of the machines;
Machine= Roll Cut Weld;
2
! Hours available on each machine;
ProdHoursAvail = 28 34 21;
!Get the names of the products;
Product = P01 P02 P03 P04;
!Profit contribution per unit;
Profit = 26 35 25 37;
! Hours needed per unit of product;
ProdHoursUsed =
1.7 2.1 1.4 2.4 ! Roll;
1.1 2.5 1.7 2.6 ! Cut;
1.6 1.3 1.6 0.8; ! Weld;
ENDDATA
! Maximize Total Profit contribution;
[TotalProfit] MAX = @SUM( Product(i): Profit(i) * Produce (i));
! For each machine i;
@FOR (Machine (i):
! Hours used must be <= hours available;
[Capacity] @SUM (Product (j): ProdHoursUsed (i, j) * Produce (j))
<= ProdHoursAvail (i);
);
3
GUIDELINES FOR HOMEWORK ON COMPUTER RUNS
Integral to modern engineering education and practice is the use of computers and
software. Many courses in our curriculum recognize this and include computation
as part of the syllabi. This course is no exception.
Today’s computational resources free the engineer from the drudgeries of hand
calculations. They allow him/her to be more thoughtful and creative in his/her
analyses and designs. While the time limitation in tests and exams usually
prohibits extensive computations, homeworks and projects are the ideal place to
endow students with this capacity. These homeworks or projects are performed in
his/her own pace at home or in the laboratory.
Throughout this semester, numerous computer exercises will be assigned, using
off-the-shelf application software. As a word of advice, please allow plenty of
time before the due date to perform these assignments. There is likely to be a
“learning curve” to familiarize yourself with a particular software, particularly its
application toward the problem at hand.
At due date, these are the submission guidelines for each assignment involving
computer runs:
G
Submit an annotated input file and an annotated output file in hard
copies.
G
Submit a soft copy of the same to the instructor
(by one of the following means):
diskettes
zip disks
flash drive, USB hard-drive, or pen drive
CDs
Observing these guidelines will make your job and my job a lot easier. Happy
computing!
4
SYEN 3312 Optimization Methods in Systems Engineering
Computer Exercises using LINGO
Note: The following LINGO exercises are to be completed during today’s class
period. For this in-class exercise, submit only soft input-output files to
[email protected] for grading. No hard copy or annotation is necessary.
Exercise 1.(H&L Homework Problem 3.4-10).
A Medical Equipment company produces precision medical diagnostic equipment
at two factories. Three medical centers have placed orders for this month’s
production output. The following table has sufficient data.
To
Unit Shipping Cost
Customer 1
Customer 2
Customer 3
Factory 1
$600
$800
$700
Maximum
Output
400 units
Factory 2
$400
$900
$600
500 units
Order Size
300 units
200 units
400 units
From
A decision needs to be made about the shipping plan for how many units to ship
from each factory to each customer. Using the attached input in the long-hand
notation, please solve the model using LINGO. (Notice you can check your
numerical answer against the answer given at the back of the book.)
! Class Exercise, Medical Equipment Mfr and Shipping problem;
! Variables are:
x11 = Number of units produced in Factory 1 for Customer 1
x21 = "
"
"
"
" Factory 2 "
"
1
x12 = "
"
"
"
" Factory 1 "
"
2
x22 = "
"
"
"
" Factory 2 "
"
2
x13 = "
"
"
"
" Factory 1 "
"
3
x23 = "
"
"
"
" Factory 2 "
"
3;
! Objective function;
MIN = 600*x11 + 400*x21 + 800*x12 + 900*x22 + 700*x13 + 600*x23;
! Constraints;
x11 + x21 >= 300;
x12 + x22 >= 200;
x13 + x23 >= 400;
x11 + x12 + x13 <=400;
5
x21 + x22 + x23 <=500;
Exercise 2.
Four jobs 1, 2, 3, and 4 are to be assigned to four workers A, B, C, and D. A
worker is assigned only one job. The cost of assigning job j to worker i, cij , is
given by the following matrix
job
1
2
3
4
worker
A
9
5
4
5
[cij] = B
4
3
5
6
C
3
1
3
2
D
2
4
2
6
The problem can now be formulated as an LP as follows:
min z =
s.t.
cijxij = 9xA1 + 5xA2 + 4xA3 + 5xA4 + 4xB1 + 3xB2 + ...
xij = 1
I = A,B,C,D
or
xA1 + xA2 + xA3 + xA4 = 1
xB1 + xB2 + xB3 + xB4 = 1 etc.
xij = 1
j = 1,2,3,4
or
xA1 + xB1 + xC1 + xD1 = 1
xA2 + xB2 + xC2 + xD2 = 1 etc.
xij = {0, 1}
or
xA1 , xA2 , xA3, xA4, xB1, xB2, ... = {0, 1}
In this case, xij being zero means that worker i is not assigned to job j, and one
means s/he is assigned.
Review the attached example of “Derived Set Notation,” which describes the set
notation input format for Exercise 1. For example, the set notation for the medical
supply problem looks like the following:
SETS:
!The simple sets;
Factory: MaxOutputAvail;
Customers: OrderSize;
!A derived set;
FaCu(Factory, Customers): ShipCost, Unit;
6
ENDSETS
DATA:
!Get the name of the factories;
Factory= Fact1 Fact2;
! Maximum Output available of each factory;
MaxOutputAvail = 400 500;
!Get the names of the customers;
Customers = Customer1 Customer2 Customer3;
!Order size per customer;
OrderSize = 300 200 400;
! Shipping cost per unit of product;
ShipCost = 600 800 700 ! Factory1;
400 900 600; ! Factory2;
ENDDATA
! Minimize the shipping costs;
[TotalShippingCost] MIN = @SUM( FaCu(i, j): ShipCost(i, j) * Unit (i, j));
! For each factory i;
@FOR (Factory (i):
! Output used must be <= output available;
[Capacity] @SUM (Customers (j): Unit(i,j))
<= MaxOutputAvail (i); );
! For each customer j;
@FOR (Customers (j):
! Supply must be greater than order size;
[Supply] @SUM (Factory (i): Unit(i, j)) >= OrderSize(j));
a) Using the set notation in LINGO, solve this “Min-cost Job-Assignment”
problem.
b) Show that the LP for the “Min-cost Job-Assignment” problem will yield the
desired binary solution. This means that the decision variable, xij, which
assigns a worker A,B,C, or D to a job 1,2,3, or 4 will assume either zero or
unity in value. This would be automatic without specifying the decision
variables to be binary in LINGO.
7
8
9
10