Presentation is loading. Please wait.

Presentation is loading. Please wait.

LINGO LAB 3/4.

Similar presentations


Presentation on theme: "LINGO LAB 3/4."— Presentation transcript:

1 LINGO LAB 3/4

2 Example 2 Suppose that we have 3 jobs (1, 2, 3) waiting for being performed and 3 machines (A, B, C) that can be used to perform these jobs. The assignment costs of the jobs to the machines are given in the following table. Find the minimum total cost one-to-one assignment between the jobs and the machines by using lingo programming.

3 Min z= 9x11+6x12+3x13+4x21+5x22+6x23+3x31+7x32+11x33
Subject to x11+x12+x13=1 x21+x22+x23=1 x31+x32+x33=1 x11+x21+x31=1 x12+x22+x31=1 x13+x23+x33=1 x11, x12,x13,x21,x22,x23,x31,x32 and x33 are binary variables

4

5

6 Example 3 Find the optimal solution by using LINGO Max z= 3x1+x2+3x3 Subject to -x1+2x2+x3≤4 4x2-3x3 ≤ 2 X1-3x2+2x3 ≤ 3 x1,x2 and x3 ≥ 0 and integer

7

8

9 Solve the following knapsack problem by using lingo software :
Example 4 Solve the following knapsack problem by using lingo software : Maximize z= 5X1+3X2+8X3+9X4+4X5 Subject to 3X1+X2+5X3+4X4+X5=25 0≤X1 ≤2 , 0 ≤X2 ≤1 , 0 ≤X3 ≤4 , 0 ≤X4 ≤2, 0 ≤X5 ≤1 X1,X2,X3,X4,and X5 and integer.

10

11

12 Example 1 : Find the optimal solution of the following model Min z = 200X X X3 s.t. 13X1 + 11X2 +9X3≥12000 X1 ≤ 5000 X2 ≤ 4000 X3 ≤ X3 ≥ 100 X1, X2, X3 ≥ 0 and integer

13

14

15 Example : Solve the following LP problem MAX 4X1+2X2+3X3+6X4-4X5-11X6 3X1+X2+5X3+2X4-2X5-X6 ≤ 9 -X1+X2+X3+2X4-3X6 ≤ 3 2X1-X2-4X3+X4+X5-X6 ≤ -2 X1,X2,X3,X4,X5and X6 are binary variables

16

17

18 Toolco has contracted with Automate to supply their automotive discount stores with wrenches and chisels. Automate weekly demand consists of 1500 wrenches and 1200 chisels. Toolco’s present one-shift capacity is not large enough to produce the requested units and must use overtime and possibly subcontracting with other tool shops. The result is an increase in the production cost per unit, as shown in the following table. The market restricts wrenches to chisels to a ratio of at least 2:1. Tool Production type Weekly production range (units) Unit cost ($) Wrenches regular 0-540 2.00 overtime 2.80 subcontracting 801-∞ 3.00 Chisel 0-620 2.10 3.20 901-∞ 4.20

19 Min 2x1+2.8x2+3x3+2.1x4+3.2x5+4.2x6 S.T x1+x2+x3>=1500 x4+x5+x6>=1200 2(x1+x2+x3)-(x4+x5+x6)=0 0<=x1<= <=x2<= <=x3 0<=x4<= <=x5<= <=x5

20

21

22 The Maximum Flow Problem

23

24

25

26 Fred has $3200 to invest over the next six years
Fred has $3200 to invest over the next six years. At the beginning of each year he can invest money in one- or two year time deposit. The bank pays 9 percent interest on one-year time deposits and 18 percent interest on two- year time deposits. In addition, West World Limited will offer three-year certificates stating at the beginning of the second year. These certificates will return 29 percent (total). If Fred reinvests his money available every year, formulate a linear program to show him how to maximize his total cash at hand at the end of the sixth year.

27 Max = S5+1.09X5+1.18Y4+1.29Z3; !S.T; X1+Y1+S1=3200 X2+Y2+Z2+S2=S1+1.09X1 X3+Y3+Z3+S3=S2+1.09X2+1.18Y1 X4+Y4+S4=S3+1.09X3+1.18Y2 X5+S5=S4+1.09X4+1.18Y3+1.29Z2

28

29

30

31 Model: Max = 6500X1+7000X2+2250X3+2500X4; !S.T; 700X1+850X2+300X3+350X4<=1200; 550X1+550X2+150X3+200X4<=700; 400X1+350X2+100X3+170X4<=400; X1+X2>=1; -X3+X4<=1;

32 Model: Max = 6500*X1+7000*X2+2250*X3+2500*X4; !S.T; 700*X1+850*X2+300*X3+350*X4<=1200; 550*X1+550*X2+150*X3+200*X4<=700; 400*X1+350*X2+100*X3+170*X4<=400; X1+X2>=1; -X3+X4<=1; @BIN(X1); @BIN(X2); @BIN(X3); @BIN(X4); End

33

34 A cargo plane has three compartments for storing cargo: front, centre and rear. These compartments have the following limits on both weight and space: Compartment Weight capacity (tonnes) Space capacity (cubic metres) Front Centre Rear Furthermore, the weight of the cargo in the respective compartments must be the same proportion of that compartment's weight capacity to maintain the balance of the plane.The following four cargoes are available for shipment on the next flight: Cargo Weight (tonnes) Volume (cubic metres/tonne) Profit (£/tonne) C C C C Any proportion of these cargoes can be accepted. The objective is to determine how much (if any) of each cargo C1, C2, C3 and C4 should be accepted and how to distribute each among the compartments so that the total profit for the flight is maximised. Formulate the above problem as a linear program

35 Modeling Variables We need to decide how much of each of the four cargoes to put in each of the three compartments. Hence let: xij be the number of tonnes of cargo i (i=1,2,3,4 for C1, C2, C3 and C4 respectively) that is put into compartment j (j=1 for Front, j=2 for Centre and j=3 for Rear) where xij >=0 i=1,2,3,4; j=1,2,3 Note here that we are explicitly told we can split the cargoes into any proportions (fractions) that we like.

36 Constraints cannot pack more of each of the four cargoes than we have available x11 + x12 + x13 <= 18 x21 + x22 + x23 <= 15  x31 + x32 + x33 <= 23  x41 + x42 + x43 <= 12 the weight capacity of each compartment must be respected x11 + x21 + x31 + x41 <= 10  x12 + x22 + x32 + x42 <= 16  x13 + x23 + x33 + x43 <= 8 the volume (space) capacity of each compartment must be respected 480x11 + 650x21 + 580x31 + 390x41 <= 6800  480x12 + 650x22 + 580x32 + 390x42 <= 8700  480x13 + 650x23 + 580x33 + 390x43 <= 5300 the weight of the cargo in the respective compartments must be the same proportion of that compartment's weight capacity to maintain the balance of the plane [x11 + x21 + x31 + x41]/10 = [x12 + x22 + x32 + x42]/16 = [x13 + x23 + x33 + x43]/8

37 Objective The objective is to maximise total profit, i.e. Max 310[x11+ x12+x13] + 380[x21+ x22+x23] + 350[x31+ x32+x33] + 285[x41+ x42+x43]

38 Max 310[x11+ x12+x13] + 380[x21+ x22+x23] + 350[x31+ x32+x33] + 285[x41+ x42+x43] x11 + x12 + x13 <= 18 x21 + x22 + x23 <= 15  x31 + x32 + x33 <= 23  x11 + x21 + x31 + x41 <= 10  x12 + x22 + x32 + x42 <= 16  x13 + x23 + x33 + x43 <= x11 + 650x21 + 580x31 + 390x41 <= 6800  480x12 + 650x22 + 580x32 + 390x42 <= 8700  480x13 + 650x23 + 580x33 + 390x43 <= [x11 + x21 + x31 + x41]/10 = [x12 + x22 + x32 + x42]/16 = [x13 + x23 + x33 + x43]/8

39

40

41


Download ppt "LINGO LAB 3/4."

Similar presentations


Ads by Google