1 / 90

IENG442

IENG442. LINGO LAB3. Example -1.

Download Presentation

IENG442

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. IENG442 LINGO LAB3

  2. Example -1 A company produces product A and B. Product B sells for $5 per unit, and product A sells for $3 per unit. Producing a unit of product B requires 5 unit of row material 1 and 2 unit of row material 2. Producing a unit of product A requires 2 unit of row material 1 and 1 unit of row material 2. 60 units of row material 1 and 25 unit of row material 2 are available. Formulate an LP that can be used to maximize revenue.

  3. Modeling Variables: x1: units of product A that should be produced x2: units of product B that should be produced Objective Function: Max Z= 5x2 + 3x1 Subject to (constraints): 5x2 + 2x1 ≤ 60 (Row material 1 constraint) 2x2 + 1x1 ≤ 25 (Row material 2 constraint) x1 ≥ 0 x2 ≥ 0

  4. Changing model for LINGO:

  5. Solving a LINGO Model • Each model can be solved by: • Clicking the solve button • Selecting Solve from the LINGO menu • Using Ctrl+S keyboard shortcut. Error (if any) will be reported.

  6. LINGO Solver Status Window

  7. LINGO Solution Report Window

  8. Example -02 • Maximize -5/36Q2 + 160/9Q – 125/9 • Subject to 10 ≤Q ≤ 100

  9. LINGO Model

  10. Example -03 • Minimize 50S+100F • Subject to 5 + 17≥ 40 20+ 7 ≥ 60 S,F ≥ 0

  11. LINGO Model

  12. Example-04 Consider that each student may eat at most 16 units of food stuff per day and the amount of protein taken from animal sources should not be more than the 60% of the total protein intake. Formulate as an LP model.

  13. Example-4(Solution): • Objective: To obtain minimum cost daily diet which satisfying the Nutritional requirements and eating capacity • Decision Variables: Xj number of units of food type j into the daily diet of the student (where j=1 (milk), 2(meat), 3(bread), 4(vegetables)). • MODEL: • Objective Function: Min Z= 0.42X1+0.68X2+0.32X3+0.17X4

  14. Example-4(Solution): • Subject to: • Calories: 160X1+210X2+120X3+150X4 ≤ 2700 • Carbohydrate: 110X1+130X2+110X3+120X4 ≥ 300 • Protein: 90X1+190X2+90X3+130X4 ≥ 250 • Vitamins: 50X1+50X2+75X3+70X4 ≥ 60 • Protein balance: 90X1+190X2 ≤ 0.6(90X1+190X2+90X3+130X4) • Or: 36X1+76X2-54X3-78X4 ≤ 0 • Eating Capacity: X1+X2+X3+X4 ≤ 16 • Non-negativity: Xj ≥ 0 ; j=1,2,3,4

  15. Lingo Model:

  16. Example-05 • A farmer must determine how many acres of corn and wheat to plant this year. You can find relevant data in the table below: • Government regulations require that at least 30 bushels of corn be produced during the current year. • Formulate an LP to maximize the total revenue from wheat and corn.

  17. Example-05 continuing • a) X1 = number of acres of corn planted & X2 = number of acres of wheat planted. • b) Y1 = number of bushels of corn produced & Y2 = number of bushels of wheat

  18. Example-05 (Solution) • a) MAX Z = (10*3) X1 + (25*4) X2 Subject to: X1 + X2 <= 7 4X1 + 10X2 <= 40 10X1 >= 30 X2 >= 0

  19. Example-05 (LINGO MODEL)

  20. Example-05 (LINGO Solution)

  21. Example-05 (Solution) • b) MAX Z = 3Y1 + 4Y2 Subject to: Y1>= 30 Y1/10 + Y2/25 <= 7 Y1/4 + Y2/10 <= 40 Y2 >= 0

  22. Example-05 (LINGO MODEL)

  23. Example-05 (LINGO Solution)

  24. Overview • Using Variable Domain Functions to formulate linear programming problems • @BIN(X): Limits the variable X to a binary integer Value (0 or 1) • @GIN(X): Limits the variable X to only integer values. • @BND(L,X,U): Limits the variable X to greater or equal to L and less than or equal to U. • @FREE(X): Remove the default lower bound of zero on a variable, allowing it to take any positive or negative value.

  25. Integer Programming (IP) • If one or more decision variables must be integer, then we say that an optimization model is an integer model. • An IP in which all variables are required to be integers is called a pure integer programming problem. • An IP in which only some of the variables are required to be integers is called a mixed integer programming problem. • An IPP in which all the variables must equal 0 or 1 is called a 0-1 (or binary) IP.

  26. Example 06(@BIN(X)) • A young couple, Evren and Steven, want to divide their main household chores between them so that each has two tasks but the total time they spend on household duties is kept to a minimum. Their efficiencies on these tasks differ, where the time each would need to perform the task is given by the following table. Formulate a BIP model for this problem.

  27. Example 06-Solution • We have 4 types of tasks; marketing, cooking, dishwashing and laundry • Our decision variables are: Si and Ei (i=1…4). • Si=1 ;if Steven does the ith task • Si=0 ;otherwise • Ei=1 ;if Evren does the ith task • Ei=0 ;Otherwise

  28. Example 06-LINGO Model

  29. Example 06-LINGO Solution

  30. Example 06-LINGO Solution

  31. Example 07(@GIN(X)) • A paper company has machines that produce large rolls of paper of a given diameter and width, say 100 inches. To fill customer order (200 rolls with 45 inches width and 110 rolls with 30 inches width), these large rolls must be cut in to narrow width (using some patterns). Formulate this problem to minimize the number of standard rolls cut in filling the order.

  32. Example 07- Solution • We have some patterns to cut the standard rolls: • So our decision variables are: Xj= number of standard rolls cut by pattern j (It must be integer)

  33. Example 7-LINGO Model

  34. Example 07-LINGO Solution

  35. Example 07-LINGO Solution

  36. Example 08(@BND(L,X,U)) • A factory has two machines and produces two types of products. Selling prices, working hours, current orders amounts and maximum amounts of production are shown in the table. Formulate this problem to maximize the profits.

  37. Example 08- Solution • Decision variables are: Xi =number of product i that should be produced to maximized the profits (i=1,2)

  38. Example 08-LINGO Model

  39. Example 08-LINGO Solution

  40. Example 08-LINGO Solution

  41. Example 09(FREE(X)) • A baker has 30 ounces of flour and 5 packages of yeast (additive material). Baking a loaf of bread requires 5 ounces of flour and 1 package of yeast. Each loaf of bread can be sold for $30. The baker may purchase additional flour at $4 or sell leftover flour at the same price. Formulate this problem to maximize the baker’s profits.

  42. Example 09- Solution • Decision variables: X1= number of loaves of bread baked X2=number of ounces by which flour supply is increased by cash transactions (so, X2 can be positive (purchasing), negative (selling) or zero) Note: The baker can not purchase any additional yeast!

  43. Example 09-LINGO Model

  44. Example 09-LINGO Solution

  45. Example 09-LINGO Solution

  46. Brute Production Process (@GIN): • Rylon Corporation manufactures Brute and Chanelle perfumes. The raw material needed to manufacture each type of perfume can be purchased for 3$ per pound. Processing 1 lb of raw material requires 1 hour of laboratory time. Each pound of processed raw material yiels 3 oz of Regular Brute Perfume and 4 oz of Regular Chanelle Perfume. Regular Brute can be sold for 7$/oz and Regular Chanelle for $6/oz. Rylon also has the option of further processing Regular Brute and Regular Chanelle to produce Luxury Brute, sold at 18$/oz, and Luxury Chanelle,sold at $14/oz. Each ounce of Regular Brute processed further requires an additional 3 hours of laboratory time and 4$ processing cost and yields 1 oz of Luxury Brute. Each ounce of Regular Chanelle processed further requires an additional 2 hours of laboratory time and $4 processing cost and yields 1 oz of Luxury Chanelle. Each year, Rylon has 6,000 hours of laboratory time available and can purchase upto 4,000 lb of raw material. Formulate an LP that can be used to determine how Rylon can maximize profits. Assume that the cost of laboratory hours is a fixed cost.

  47. Solution to Example 1: Determine how much raw material to purchase and mow much of each type of perfume to produce • X1=number of ounces of Regular Brute sold annually • X2=number of ounces of Luxury Brute sold annuallly • X3=number of ounces of Regular Chanelle sold annually • X4=number of ounces of Luxury Chanelle sold annually • X5=number of pounds of raw material purchased annually Profit=revenues from perfume sales-processing costs-costs of purchasing raw material =7X1+18X2+6X3+14X4-(4X2+4X4)-3X5

  48. Solution to Example 1: Max z =7X1+14X2+6X3+10X4-3X5 Subject to X5<=4,000 3X2+2X4+X5<=6,000 X1+X2-3X5=0 X3+X4-4X5=0 Xi>=0 (i=1,2,3,4,5)

More Related