INFSCI 0010 2015 Summer Term LEC2.ppt Becoming Skilled at Information Technology.
M328 lec2 2015
Transcript of M328 lec2 2015
Math 328: Linear Optimization, Jan.13-May.6, 2015 MSU, Lecture Note #02 1
Math 328: Linear Optimization
Hongxia Yin
Department of Mathematics and Statistics
Minnesota State University, Mankato
271 Wissink Hall 389-2216
Email: [email protected]
Math 328: Linear Optimization, Jan.13-May.6, 2015 MSU, Lecture Note #02 2
1 General Linear Programming Model
max(min) z = c1x1 + c2x2 + · · ·+ cnxn (1)
subject to (s.t.) a11x1 + a12x2 + · · ·+ a1nxn{≤,=,≥}b1, (2)
a21x1 + a22x2 + · · ·+ a1nxn{≤,=,≥}b2, (3)
· · · , (4)
am1x1 + am2x2 + · · ·+ amnxn{≤,=,≥}bm, (5)
xj {≥,≤}0 j = 1, 2, · · · , n. (6)
Math 328: Linear Optimization, Jan.13-May.6, 2015 MSU, Lecture Note #02 3
A linear programming problem (LP) is an optimization problem for which we do
the following:
1. We attempt to maximize (or minimize) a linear function of the decision
variables. The function that to be maximized or minimized is called the
objective function.
2. The value of the decision variables must satisfy a set of constraints. Each
constraint must be a linear equation or linear inequality.
3. A sign restriction is associated with each variable. For any variable xi, the
sign restriction specifies either that xi must be nonnegative (xi ≥ 0) or that
xi may be unrestricted in sign (urs).
Math 328: Linear Optimization, Jan.13-May.6, 2015 MSU, Lecture Note #02 4
2 Characteristics of LP
• Proportionality and additivity: The contribution of the objective function
from each decision variable is proportional to the value of the decision
variable.
The contribution to the objective function for any variable is independent of
the value of the other variables. same for the left hand sides of constraints
• Divisibility: variables should be allowed to assume fractional values.
• Certainty: each parameter is known with certainty.
Math 328: Linear Optimization, Jan.13-May.6, 2015 MSU, Lecture Note #02 5
? Feasible region of LP: The set in which all the points satisfy the constraints
and signal restriction
Example 1:
max z = 3x1 + 2x2
subject to (s.t.) 2x1 + x2 ≤ 100
x1 + x2 ≤ 80
x1 ≤ 40
x1 ≥ 0
x2 ≥ 0
(7)
(x1 = 40, x2 = 20) is a point in the feasible set, we call it a feasible point.
(x1 = 15, x2 = 70), (x1 = 40, x2 = −20) is not in the feasible set, we
call it an infeasible point.
– bounded set; unbounded set; empty set.
Math 328: Linear Optimization, Jan.13-May.6, 2015 MSU, Lecture Note #02 6
? Optimal Solution of LP: For Maximize problem, the optimal solution of LP is
the point at which the objective function have its maximum value.
For Minimize problem, the optimal solution of LP is the point at which the
objective function have its minimum value.
An LP problem may
– have unique optimal solution;
– have no optimal solution; the problem is infeasible;
– have more that one, even infinite number of optimal solutions;
– be unbounded.
Example 1: has unique optimal solution (x∗1 = 20, x∗
2 = 60), Optimal
objective value is:
z∗ = 3x∗1 + 2x∗
2 = 3× 20 + 2× 60 = 180.
Math 328: Linear Optimization, Jan.13-May.6, 2015 MSU, Lecture Note #02 7
? binding constraints/active constraints and nonbinding constraints/inactive
constraints
Example 1: 2x∗1 + x∗
2 = 2× 20 + 60 = 100 =⇒ Finishing constraint is
a binding constraint.
x∗1 = 20 < 40 =⇒ Constraint on demand for soldiers is an nonbinding
constraint.
Math 328: Linear Optimization, Jan.13-May.6, 2015 MSU, Lecture Note #02 8
3 Other forms of LP
? Brief Form:
max(ormin)∑n
j=1 cjxj
s.t.∑n
j=1 aijxj ≤ (=,≥)bi, (i = 1, · · · ,m)
xj ≥ 0 (j = 1, · · · , n).
(8)
Let
c = (c1, · · · , cn), x =
x1
...
xn
, pj =
a1j
...
amj
, b =
b1...
bn
, (9)
Math 328: Linear Optimization, Jan.13-May.6, 2015 MSU, Lecture Note #02 9
A =
a11 a12 . . . a1n
a21 a22 . . . a2n...
......
am1 am2 . . . amn
(10)
? Vector Form:
max(ormin) cx
s.t.∑n
j=1 pjxj ≤ (=,≥)b,x ≥ 0.
(11)
? Matrix-vector Form(A is called the coefficient matrix of the constraints)
max(ormin) cx
s.t. Ax ≤ (=,≥)b,x ≥ 0.
(12)
Math 328: Linear Optimization, Jan.13-May.6, 2015 MSU, Lecture Note #02 10
? Important concepts in LP
– decision variable/activity, data/parameter
– objective/goal/target
– constraint/limitation/requirement
– equality/inequality constraint
– constraint function/the right-hand side
– direction of inequality
– coefficient vector/coefficient matrix
– nonnegativity constraint
– satisfied/violated
Math 328: Linear Optimization, Jan.13-May.6, 2015 MSU, Lecture Note #02 11
– extreme point
A set of points S is a convex set if the line segment joining any pair of
points in S is wholly contained in S.
For any convex set S, a point is an extreme point if each line segment
that lied completely in S and contains the point P has P as an endpoint of
the line segment.
– slack/surplus (introduce later)
Math 328: Linear Optimization, Jan.13-May.6, 2015 MSU, Lecture Note #02 13
Example 2 Suppose my diet requires that all the food I eat come from one of the
four ”basic food groups” (chocolate cake, ice cream, soda, and cheesecake). At
present, the following four foods are available for consumption: brownies,
chocolate ice cream, cola, and pineapple cheesecake. Each brownie costs 50c,
each scoop of chocolate ice cream costs 20c, each bottle of cola costs 30c, and
each piece of pineapple cheesecake costs 80c. Each day, I must ingest at least
500 calorie, 6 oz of chocolate, 10 oz of sugar, and 8 oz of fat. The nutritional
content per unit of each food is shown in the table below,
Calories Chocolate oz sugar (oz) fatoz
Brownie 400 3 2 2
Chocolate ice cream 200 2 2 4
Cola 150 0 4 1
Pineapple cheesecake 500 0 4 5
Formulate a mathematical model that can be used to satisfy my daily nutritional
requirements at minimum cost.
Math 328: Linear Optimization, Jan.13-May.6, 2015 MSU, Lecture Note #02 14
∗ Define decision variables
x1 =number of brownies eaten daily;
x2 =number of scoops of chocolate ice cream eaten daily;
x3 =bottles of cola drunk daily;
x4 = pieces of pineapple cheesecake eaten daily.
∗ Objective function; The total cost of the foot for each day:
z = 50x1 + 20x2 + 30x3 + 80x4.
∗ The decision variables must satisfy the following constraints
1: 400x1 + 200x2 + 150x3 + 500x4 ≥ 500, (Calorie constraint)
2: 3x1 + 2x2 ≥ 6, (Chocolate constraint)
3: 2x1 + 2x2 + 4x3 + 4x4 ≥ 10, (Sugar constraint)
4: 2x1 + 4x2 + x3 + 5x4 ≥ 8, (Fat constraint)
∗ Sign limitation xi ≥ 0, i = 1, 2, 3, 4.
Math 328: Linear Optimization, Jan.13-May.6, 2015 MSU, Lecture Note #02 15
Thus, we obtain the LP model for the problem
min z = 50x1 + 20x2 + 30x3 + 80x4
subject to (s.t.) 400x1 + 200x2 + 150x3 + 500x4 ≥ 500
3x1 + 2x2 ≥ 6
2x1 + 2x2 + 4x3 + 4x4 ≥ 10
2x1 + 4x2 + x3 + 5x4 ≥ 8
xi ≥ 0, i = 1, 2, 3, 4.
(13)
Math 328: Linear Optimization, Jan.13-May.6, 2015 MSU, Lecture Note #02 16
5 A work-scheduling problem
Math 328: Linear Optimization, Jan.13-May.6, 2015 MSU, Lecture Note #02 17
Example 3: A post office requires different number of full-time employees on
different days of the week. The number of full-time employees required on each
day is given in the following table:
Number of Employees Required
Day 1=Mon. 17
Day 2=Tue. 13
Day 3=Wed. 15
Day 4=Thur. 19
Day 5=Fri. 14
Day 6=Sat. 16
Day 7=Sun. 11
Each full-time employee must work 5 consecutive days and then receive 2 days
off. Formulate an LP to minimize the number of full-time employees must be hired.
Math 328: Linear Optimization, Jan.13-May.6, 2015 MSU, Lecture Note #02 18
Solution:
? Decision Variables:
– xi = the number of employees beginning work on day i i = 1, 2, · · · , 7.For example, x1 is the number of people beginning work on Monday, these
people work Monday to Friday.
? Objective Function:
Since each employee begins work on exactly one day of the week, thus we
can obtain the objective function:
– z = x1 + x2 + x3 + x4 + x5 + x6 + x7
? Constraints:
The post office must ensure that enough employees are working on each day
of the week. For example, at least 17 employees must be working on Monday.
Who is working on Monday?
Math 328: Linear Optimization, Jan.13-May.6, 2015 MSU, Lecture Note #02 19
Everybody except the employee who begin work on Tuesday or on
Wednesday (they get, respectively, Sunday and Monday, and Monday and
Tuesday off). This means that
– Constraint 1: x1 + x4 + x5 + x6 + x7 ≥ 17.
– Constraint 2: at least 13 employees must be working on Tuesday⇒x1 + x2 + x5 + x6 + x7 ≥ 13.
– Constraint 3: at least 15 employees must be working on Wednesday⇒x1 + x2 + x3 + x6 + x7 ≥ 15.
– Constraint 4: at least 19 employees must be working on Thursday⇒x1 + x2 + x3 + x4 + x7 ≥ 19.
– Constraint 5: at least 14 employees must be working on Friday⇒x1 + x2 + x3 + x4 + x5 ≥ 14.
– Constraint 6: at least 16 employees must be working on Saturday⇒x2 + x3 + x4 + x5 + x6 ≥ 16.
– Constraint 7: at least 11 employees must be working on Sunday⇒
Math 328: Linear Optimization, Jan.13-May.6, 2015 MSU, Lecture Note #02 20
x3 + x4 + x5 + x6 + x7 ≥ 11.
? Sign Restrictions:
xi ≥ 0, i = 1, · · · , 7.
Math 328: Linear Optimization, Jan.13-May.6, 2015 MSU, Lecture Note #02 21
? LP model for post office work-scheduling problem:
min z = x1 + x2 + x3 + x4 + x5 + x6 + x7
s.t. x1 + x4 + x5 + x6 + x7 ≥ 17
x1 + x2 + x5 + x6 + x7 ≥ 13
x1 + x2 + x3 + x6 + x7 ≥ 15
x1 + x2 + x3 + x4 + x7 ≥ 19
x1 + x2 + x3 + x4 + x5 ≥ 14
x2 + x3 + x4 + x5 + x6 ≥ 15
x3 + x4 + x5 + x6 + x7 ≥ 11
xi ≥ 0, i = 1, · · · , 7.
(14)
Math 328: Linear Optimization, Jan.13-May.6, 2015 MSU, Lecture Note #02 22
The optimal solution for (14) is
x1 = 4/3, x2 = 10/3, x3 = 2, x4 = 22/3, x5 = 0, x6 = 10/3, x7 =
5, z = 67/3
Since we are only allowing full-time employees, the variables must be integers,
and the Divisibility Assumption is not satisfied.
In am attempt to find a reasonable answer in which all variable are integer, we
could try to round the fractional variables up, yielding the feasible solution:
x1 = 2, x2 = 3, x3 = 2, x4 = 8, x5 = 0, x6 = 4, x7 = 5. and z = 25.
Math 328: Linear Optimization, Jan.13-May.6, 2015 MSU, Lecture Note #02 23
Integer programming model ( in which the variables are integer) can be used
the solve this problem. An optimal solution to the post office problem is
x1 = 4, x2 = 4, x3 = 2, x4 = 6, x5 = 0, x6 = 4, x7 = 3, and z = 23.
Notice: There is no way that the optimal linear programming solution could have
been rounded to obtain the optimal all-integer solution.
Math 328: Linear Optimization, Jan.13-May.6, 2015 MSU, Lecture Note #02 24
6 Homework
Graph the feasible set and solve the problems
max z = x1 + x2
s.t. x1 + x2 ≤ 4
x1 − x2 ≥ 5
x1, x2 ≥ 0.
(15)
max z = 4x1 + x2
s.t. 8x1 + 2x2 ≤ 16
5x1 + 2x2 ≤ 12
x1, x2 ≥ 0.
(16)
Math 328: Linear Optimization, Jan.13-May.6, 2015 MSU, Lecture Note #02 25
max z = −x1 + 3x2
s.t. x1 − x2 ≤ 4
x1 + 2x2 ≥ 4
x1, x2 ≥ 0.
(17)
max z = 3x1 + x2
s.t. 2x1 + x2 ≤ 6
x1 + 3x2 ≥ 9
x1, x2 ≥ 0.
(18)
Math 328: Linear Optimization, Jan.13-May.6, 2015 MSU, Lecture Note #02 26
Homework:
In the post office example (Example 2 of Lecture 2), suppose that each full-time
employee works 8 hours per day. Thus, Mondays requirement of 17 workers may
be viewed as a requirement of 8(17)=136 hours. The post office may meet its
daily labor requirements by using both full-time and part-time employees. during
each week, a full-time employee works 8 hours a day for five consecutive days,
and a part-time employee works 4 hours a day for five consecutive days. A
full-time employee costs the post office $15per hour, whereas a part-time
employee (with reduced fringe benefits) costs the post office only 10 per hour.
Union requirements limit part-time labor to25% of weekly labor requirements.
Formulate an LP to minimize the post offices weekly labor costs.