Presentation is loading. Please wait.

Presentation is loading. Please wait.

LINGO TUTORIAL 2.

Similar presentations


Presentation on theme: "LINGO TUTORIAL 2."— Presentation transcript:

1 LINGO TUTORIAL 2

2 EXAMPLE : A cookie store can produce drop cookies and decorated cookies , which sell for $1 and $3 apiece ,respectively. The two bakers each work 8 hours per day and can produce up to 400 drop cookies and 200 decorated cookies. It takes 1 minute to produce each drop cookie and 3 minutes to produce each decorated cookie. What combination of cookies produced will maximize the baker's profit?

3 SOLUTION: Model: ! variables X1 : The number of drop cookies
X2 : The number of decorated cookies Objective function; MAX = 1*X1 + 3*X2; ! S.t.; X1 <= 400; X2 <= 200; 1/60*X1 + 3/60*X2 <=16; X1,X2>=0

4

5

6

7 Example 2 Let's imagine that the Computer factory produces two models of computers - Standard and Turbo. Factory can sell every Standard unit it produces for a profit contribution of $100, and each Turbo unit for a contribution of $150. At the factory, the Standard computer production line can produce, at most, 100 computers per day. At the same time, the Turbo computer production line can turn out 120 computers per day. Furthermore, the company has a limited supply of daily labor. In particular, there is a total of 160 hours of labor available each day. Standard computers require 1 hour of labor, while Turbo computers are relatively more labor intense requiring 2 hours of labor.

8 The company want to maximize total profit without exceeding line and labor capacity limits. We will let the variables X1 : Denote the number of Standard computers produce. X2 : Denote the number of Turbo computers to produce. Total profit is calculated as the sum of the profit contribution of the Standard computer ($100) multiplied by the total Standard computers produced (X1) and the profit contribution of the Turbo computer ($150) multiplied by the total Turbo computers produced (X2). Finally, we tell LINGO we want to maximize an objective function by preceding it with "MAX =".

9 Therefore, our objective function is written on the first line of our model window as: MAX = 100 * X * X2; The number of Standard and Turbo computers produced must be constrained to the production line limits of 100 and 120, respectively. X1 <= 100; X2 <= 120; The constraint on the amount of labor used can be expressed as: X1+ 2 * X2 <= 160; Non Negativity constraint; X1,X2>=0

10

11

12

13 Using Variable Domain Functions
Unless otherwise stated, variables are defaulted to being non-negative and continuous by Lingo. At times, more specifically variables can assume any real value from zero to positive infinity thereby making this default domain for such variable to be inappropriate. For instance, variable may take negative values, or it might be a specification to restrict a variable to purely integer values. LINGO provides seven variable domain functions, which allow overriding of the default domain of a variable.

14 Using Variable Domain Functions
These functions and their usage are listed as: @GIN restricts a variable to being an integer value @BIN makes a variable binary (i.e., 0 or 1) @FREE allows a variable to assume any real value, positive or negative @BND limits a variable to fall within a finite range @SOS defines a set of binary variables and places restrictions on their collective values @CARD defines a set of binary variables and places an upper limit on their sum @SEMIC restricts variables to being either zero or greater-than a specified constant @PRIORITYused to assign branching priorities to variables.

15 Example 1 Solve the following problem by LINGO MAX Z= 18X1+14X2+8X3+4X4 Subject to 15x1+12x2+7x3+4x4+x5 ≤ 37 x1,x2,x3,x4,x5 =(0,1)

16

17

18


Download ppt "LINGO TUTORIAL 2."

Similar presentations


Ads by Google