Presentation is loading. Please wait.

Presentation is loading. Please wait.

Explorations in Artificial Intelligence Prof. Carla P. Gomes Module 6 Intro to Linear Programming.

Similar presentations


Presentation on theme: "Explorations in Artificial Intelligence Prof. Carla P. Gomes Module 6 Intro to Linear Programming."— Presentation transcript:

1 Explorations in Artificial Intelligence Prof. Carla P. Gomes gomes@cs.cornell.edu Module 6 Intro to Linear Programming

2 Constraint Programming 1- Problem Formulation: A problem is a finite set of constraints involving a finite set of variables. –Constraint Satisfaction Problems (CSP)  feasibility problem only and --- SAT is a particular case of CSP; –Constraint Optimization Problems (COP) if in addition the solution is required to maximize an objective function 2- Problem Solution: –Domain specific methods –General Solution Methods Mathematical Programming

3 3 Mathematical Program Optimization problem in which the objective and constraints are given as mathematical functions and functional relationships. Optimize: Z = f(x 1, x 2, …, x n ) Subject to: g1(x1, x2, …, xn) =,, b1 … g2(x1, x2, …, xn) =,, b2 gm(x1, x2, …, xn) =,, bm Linear Programming problem  special type of a mathematical programming problem (all functions are linear)

4 Linear Programming (LP) One of the most important scientific advances of the 20 th century A variety of applications: Financial planning, Marketing, E-business, Telecommunications, Manufacturing, Transportation Planning, System Design, Health Care Remarkably efficient solution procedures to solve LP models – simplex method and interior point methods --- Very fast LP solvers (CPLEX – from 1981-2001 2,000,000X faster!)

5 Linear Programming Significance. –Powerful tool for optimal allocation of scarce resources, among a number of competing activities. –Powerful model generalizes many classic problems: shortest path, max flow, multicommodity flow, MST, matching, 2- person zero sum games –Ranked among most important scientific advances of 20th century. accounts for a major proportion of all scientific computation –Helps find "good" solutions to NP-hard optimization problems. optimal solutions (branch-and-cut) provably good solutions (randomized rounding)

6 Linear Programming (LP) Linear – all the functions are linear (f and g functions are linear. Ex: f (x 1, x 2, …, x n )= c 1 x 1 + c 2 x 2 + … c n x n Programming – does not refer to computer programming but rather “planning” - planning of activities to obtain an optimal result i.e., it reaches the specified goal best (according to the mathematical model) among all feasible alternatives.

7 Prototype Example – Wyndor Glass (Hillier and Liebermnan)

8 Wyndor Glass Co. Product Mix Problem Wyndor Co. has developed the following new products: –An 8-foot glass door with aluminum framing. –A 4-foot by 6-foot double-hung, wood-framed window. The company has three plants –Plant 1 produces aluminum frames and hardware. –Plant 2 produces wood frames. –Plant 3 produces glass and assembles the windows and doors.

9

10 Wyndor Glass Co. Product Mix Problem Questions: –Should they go ahead with launching these two new products? –If so, what should be the product mix? How to formulate this problem as an Linear Programming problem?

11 Steps in setting up a LP Determine and label the decision variables. Determine the objective and use the decision variables to write an expression for the objective function. Determine the constraints - feasible region. 1.Determine the explicit constraints and write a functional expression for each of them. 2.Determine the implicit constraints (e.g., nonnegativity constraints).

12 Algebraic Model for Wyndor Glass Co. LetD = the number of doors to produce W = the number of windows to produce Maximize P = 3 D + 5 W subject to D ≤ 4 2W ≤ 12 3D + 2W ≤ 18 and D ≥ 0, W ≥ 0.

13 Finding the Optimal Solution Our objective function is: maximize 3D+5W The vector representing the gradient of the objective function is: The line through the origin that contains this vector is: isoprofit line Maximize P = 3 D + 5 W subject to D ≤ 4 2W ≤ 12 3D + 2W ≤ 18 and D ≥ 0, W ≥ 0.

14 LP: Geometry Geometry. –Forms an n-dimensional polyhedron. –Convex: if y and z are feasible solutions, then so is ½y + ½z. –Extreme point: feasible solution x that can't be written as ½y + ½z for any two distinct feasible solutions y and z. z y z y Convex Not convex Extreme points

15 LP: Geometry Extreme Point Theorem. If there exists an optimal solution to standard form LP (P), then there exists one that is an extreme point. –Only need to consider finitely many possible solutions. Greed. Local optima are global optima.

16 Graphical Method Draw the constraint boundary line for each constraint. Use the origin (or any point not on the line) to determine which side of the line is permitted by the constraint. Find the feasible region by determining where all constraints are satisfied simultaneously. Determine the slope of one objective function line (perpendicular to its gradient vector). All other objective function lines will have the same slope. Move a straight edge with this slope through the feasible region in the direction of improving values of the objective function (direction of the gradient). Stop at the last instant that the straight edge still passes through a point in the feasible region. This line given by the straight edge is the optimal objective function line. A feasible point on the optimal objective function line is an optimal solution.

17 Terminology and Notation Resources – m (plants) Activities – n (2 products) Wyndor Glass problem  optimal product mix --- allocation of resources to activities i.e., choose the levels of the activities that achieve best overall measure of performance

18 Terminology and notation (cont.) Z – value of the overall measure of performance; value of the objective function, x j – level of activity j (for j = 1, 2, …, n)  decision variables c j – increase in Z for each unit increase in the level of activity j; coefficient of objective function associated with activity j b i – amount of resource i that is available (for i=1,2,…, m). Right-hand-side of constraint associated with resource i. a ij – amount of resource i consumed by each unit of activity j. Technological coefficient. (The values of c j, b i, and a ij are the input constants for the model  the parameters of the model. )

19 x i >= 0, (i =1,2,…,n) Other forms: Minimize Z (instead of maximizing Z) Some functional constraints have signs >= (rather than <=) Some functional constraints are equalities Some variables have unrestricted sign, i.e., they are not subject to the non-negativity constraints Standard form of the LP model

20 Terminology of solutions in LP model Solution – not necessarily the final answer to the problem!!! Feasible solution – solution that satisfies all the constraints Infeasible solution – solution for which at least one of the constraints is violated Feasible region – set of all points that satisfies all the constraints (possible to have a problem without any feasible solutions) Binding constraint – the left-hand side and the right-hand side of the constraint are equal, I.e., constraint is satisfied in equality. Otherwise the constraint is nonbinding. Optimal solution – feasible solution that has the best value of the objective function. Largest value  maximization problems Smallest value  minimization problems Multiple optimal solutions No optimal solutions Unbounded Z

21 Corner Point Solutions Corner-point feasible solution – special solution that plays a key role when the simplex method searches for an optimal solution. Relationship between optimal solutions and CPF solutions: –Any LP with feasible solutions and bounded feasible region  (1) the problem must possess CPF solutions and at least one optimal solution (2) the best CPF solution must be an optimal solution  f the problem has exactly one optimal solution it must be a CFP solution If the problem has multiple optimal solutions, at least two must be CPF solutions

22 Wyndor Glass CPF Edge of Feasible region 0 1 Z=0 Z=30 LetD = the number of doors to produce W = the number of windows to produce Maximize P = 3 D + 5 W 2 Z=36 Z=27 3

23 No Feasible Solutions – Why? Maximize P = 3 D + 5 W subject to D ≤ 4 2W ≤ 12 3D + 2W ≤ 18 3 D + 5 W  50 and D ≥ 0, W ≥ 0. Previous Feasible Region

24 Multiple Optimal Solutions. Why? Maximize P = 3 D + 2 W subject to D ≤ 4 2W ≤ 12 3D + 2W ≤ 18 and D ≥ 0, W ≥ 0. Every point on this line is An optimal solution with P=18

25 Unbounded Objective Function. Why? Maximize P = 3 D + 2 W subject to D ≤ 4 and D ≥ 0, W ≥ 0. (4,2) P=16 (4,4) P=20 (4,8) P=28 (4, ) P=

26 Sensitivity Analysis 0 2 468 8 6 4 2 Production rate for windows Production rate for doors Feasible region x*=(2, 6) Optimal solution c 2 >2 10 W D P = 3600 = 300D + 500W P = 3000 = 300D + 500W P = 1500 = 300D + 500W Our objective function is: maximize 3x 1 +c 2 x 2 How does the optimal solution change as c 2 changes? Multiple Optimal solution c 2 =2 P=18 x* = (2,6) ; x*=(4,3) And any convex combination Optimal solution 0 <c 2 <2 x*=(4,3) Multiple Optimal solution c 2 =0 P=12 x*=(4,3) and (4,0) and any Convex combination Optimal solution c 2 <0 x*=(4,0)

27 LP Assumptions PProportionality – The contribution of each activity to the value of the objective function Z is proportional to the level of the activity xj as represented by the cjxj term; The contribution of each activity to the left-hand side of each functional constraint is proportional to the level of the activity xj as represented by the term aij. This assumption implies that all the x terms of the linear equations cannot have exponents greater than 1. Note: if there is a term that is a product of different variables, even though the proportionality assumption is satisfied, the additivity assumption is violated.

28 LP Assumptions Additivity The contribution of all variables to the objective function and to the left- hand side of the functional constraints has to be additive, i.e., it has to be the sum of the individual contributions of the respective activities – therefore cross-products of variables are ruled out.

29 LP Assumptions Certainty The parameters of the model, (coefficients of the objective function and of the functional constraints, and the right-hand sides of the functional constraints) are assumed to be known constants. Rarely the case – sometimes we use approximations  important to perform sensitivity analysis to identify sensitive parameters (the parameters that cannot be changed without changing the value of the objective function). What to do when certainty assumption violated: treat parameters as random variables

30 LP Assumptions Divisibility Decision variables in an LP model are allowed to have any values, including noninteger values, that satisfy the functional and nonnegativity constraints. i.e., activities can be run at fractional levels. What to do when divisibility assumption violated: realm of integer programming!!!

31 Examples of Different Categories of LP problems: Resource-Allocation Problems Cost-benefit-trade-off problems Distribution-Network Problems

32 Algebraic Model for Wyndor Glass Co. LetD = the number of doors to produce W = the number of windows to produce Maximize P = 3 D + 5 W subject to D ≤ 4 2W ≤ 12 3D + 2W ≤ 18 and D ≥ 0, W ≥ 0.

33 Examples of Different Categories of LP problems: Resource-Allocation Problems

34 Resource Allocation Problem Wyndor Glass Resources – m (plants) Activities – n (2 products) Wyndor Glass problem  optimal product mix --- allocation of resources to activities i.e., choose the levels of the activities that achieve best overall measure of performance with available resources

35 Finding the Optimal Solution Our objective function is: maximize 3D+5W The vector representing the gradient of the objective function is: The line through the origin that contains this vector is: isoprofit line Maximize P = 3 D + 5 W subject to D ≤ 4 2W ≤ 12 3D + 2W ≤ 18 and D ≥ 0, W ≥ 0.

36 Cost-benefit-trade-off problems

37 The mix of levels of various activities is chosen to achieve minimum acceptable levels for various benefits at a minimum cost.

38 The Profit & Gambit Co. (Hillier & Hillier): Management has decided to undertake a major advertising campaign that will focus on the following three key products: –A spray prewash stain remover. –A liquid laundry detergent. –A powder laundry detergent. The campaign will use both television and print media The general goal is to increase sales of these products. Management has set the following goals for the campaign: –Sales of the stain remover should increase by at least 3%. –Sales of the liquid detergent should increase by at least 18%. –Sales of the powder detergent should increase by at least 4%. Question: how much should they advertise in each medium to meet the sales goals at a minimum total cost?

39 Activity 1 – advertise on television Activity 2 – advertise in the print media Benefit 1 – increases sales of stain remover Benefit 2 – increases sales of liquid detergent Benefit 3 – increases sales of powder detergent

40 Profit & Gambit Co. Data

41 Algebraic Model for Profit & Gambit LetTV = the number of units of advertising on television PM = the number of units of advertising in the print media Minimize Cost = TV + 2PM (in millions of dollars) subject to PM ≥ 3 3TV + 2PM ≥ 18 –TV + 4PM ≥ 4 and TV ≥ 0, PM ≥ 0.

42 Algebraic Model for Profit & Gambit LetTV = the number of units of advertising on television PM = the number of units of advertising in the print media Minimize Cost = TV + 2PM (in millions of dollars) subject to Stain remover increased sales: PM ≥ 3 Liquid detergent increased sales:3TV + 2PM ≥ 18 Powder detergent increased sales:–TV + 4PM ≥ 4 and TV ≥ 0, PM ≥ 0.

43 Applying the Graphical Method

44 The Optimal Solution

45 Summary of the Graphical Method Draw the constraint boundary line for each constraint. Use the origin (or any point not on the line) to determine which side of the line is permitted by the constraint. Find the feasible region by determining where all constraints are satisfied simultaneously. Determine the slope of one objective function line. All other objective function lines will have the same slope. Move a straight edge with this slope through the feasible region in the direction of improving values of the objective function. Stop at the last instant that the straight edge still passes through a point in the feasible region. This line given by the straight edge is the optimal objective function line. A feasible point on the optimal objective function line is an optimal solution.

46 Union Airways Personnel Scheduling Union Airways is adding more flights to and from its hub airport and so needs to hire additional customer service agents. The five authorized eight-hour shifts are –Shift 1:6:00 AM to 2:00 PM –Shift 2:8:00 AM to 4:00 PM –Shift 3:Noon to 8:00 PM –Shift 4:4:00 PM to midnight –Shift 5:10:00 PM to 6:00 AM Question: How many agents should be assigned to each shift, so that the cost is minimized?

47 Time Periods Covered by Shift Time Period12345 Minimum Number of Agents Needed 6 AM to 8 AM√48 8 AM to 10 AM√√79 10 AM to noon√√65 Noon to 2 PM√√√87 2 PM to 4 PM√√64 4 PM to 6 PM√√73 6 PM to 8 PM√√82 8 PM to 10 PM√43 10 PM to midnight√√52 Midnight to 6 AM√15 Daily cost per agent$170$160$175$180$195

48 LP Formulation LetS i = Number working shift i (for i = 1 to 5), Minimize Cost = $170S 1 + $160S 2 + $175S 3 + $180S 4 + $195S 5 subject to S 1 ≥ 48 S 1 + S 2 ≥ 79 S 1 + S 2 ≥ 65 S 1 + S 2 + S 3 ≥ 87 S 2 + S 3 ≥ 64 S 3 + S 4 ≥ 73 S 3 + S 4 ≥ 82 S 4 ≥ 43 S 4 + S 5 ≥ 52 S 5 ≥ 15 and S i ≥ 0 (for i = 1 to 5)

49 LP Formulation LetS i = Number working shift i (for i = 1 to 5), Minimize Cost = $170S 1 + $160S 2 + $175S 3 + $180S 4 + $195S 5 subject to Total agents 6AM–8AM:S 1 ≥ 48 Total agents 8AM–10AM:S 1 + S 2 ≥ 79 Total agents 10AM–12PM:S 1 + S 2 ≥ 65 Total agents 12PM–2PM:S 1 + S 2 + S 3 ≥ 87 Total agents 2PM–4PM:S 2 + S 3 ≥ 64 Total agents 4PM–6PM:S 3 + S 4 ≥ 73 Total agents 6PM–8PM:S 3 + S 4 ≥ 82 Total agents 8PM–10PM:S 4 ≥ 43 Total agents 10PM–12AM:S 4 + S 5 ≥ 52 Total agents 12AM–6AM:S 5 ≥ 15 and S i ≥ 0 (for i = 1 to 5)

50 Work-scheduling problem

51 A Work-Scheduling Problem A post office requires different numbers of full-time employees on different days of the week. Union rules state that each full-time employee must work five consecutive days and then receive two days off. For example, an employee who works on Monday to Friday must be off on Saturday and Sunday. The post office wants to meet its daily requirements using only full-time employees, and minimizing number of employees.

52 Overview Work-scheduling problem –The model –Practical enhancements or modifications –Two non-linear objectives that can be made linear –A non-linear constraint that can be made linear These slides are adapted from James Orlin’s

53 Scheduling Postal Workers Each postal worker works for 5 consecutive days, followed by 2 days off, repeated weekly. Minimize the number of postal workers (for the time being, we will permit fractional workers on each day.)

54 Minimizez = x 1 + x 2 + x 3 + x 4 + x 5 + x 6 + x 7 subject to x 1  17 x 2  13 x 3  15 x 4  19 x 5  14 x 6  16 x 7  11 x j  0 for j = 1 to 7 Decision variables –Let x 1 be the number of workers who work on Monday –Let x 2 be the number of workers who work on Tuesday … –Let x 3, x 4, …, x 7 be defined similarly. What’s wrong with this formulation?

55 Answer Objective function is not number of full-time post office employees  each employee is counted five times; The variables x 1, x 2, x 3, etc are interrelated but that is not captured in our formulation (for example some people who are working on Monday are also working on Tuesday)

56 LP Formulation Select the decision variables –Let x 1 be the number of workers who start working on Monday, and work till Friday –Let x 2 be the number of workers who start on Tuesday … –Let x 3, x 4, …, x 7 be defined similarly. Note 1: number of full-time employees is x 1 + x 2 + x 3 + x 4 + x 5 + x 6 + x 7 Note 2: Who is working on Monday? Everybody except those who start working on Tuesday and Wednesday (on Monday they have a day off) (similarly reasoning can be applied for the other days)

57 The linear program Minimizez = x 1 + x 2 + x 3 + x 4 + x 5 + x 6 + x 7 subject to x 1 + x 4 + x 5 + x 6 + x 7  17 x 1 + x 2 + x 5 + x 6 + x 7  13 x 1 + x 2 + x 3 + x 6 + x 7  15 x 1 + x 2 + x 3 + x 4 + x 7  19 x 1 + x 2 + x 3 + x 4 + x 5  14 x 2 + x 3 + x 4 + x 5 + x 6  16 x 3 + x 4 + x 5 + x 6 + x 7  11 x j  0 for j = 1 to 7

58 Some Enhancements of the Model Suppose that there is a pay differential. The cost of workers who start work on day j is c j per worker and we want to minimize the cost. Minimizez = c 1 x 1 + c 2 x 2 + c 3 x 3 + … + c 7 x 7

59 Some Enhancements of the Model Suppose that one can hire part time workers (one day at a time), and that the cost of a part time worker on day j is PT j. Let y j = number of part time workers on day j

60 What is the Revised Linear Program? subject to x 1 + x 4 + x 5 + x 6 + x 7  17 x 1 + x 2 + x 5 + x 6 + x 7  13 x 1 + x 2 + x 3 + x 6 + x 7  15 x 1 + x 2 + x 3 + x 4 + x 7  19 x 1 + x 2 + x 3 + x 4 + x 5  14 x 2 + x 3 + x 4 + x 5 + x 6  16 x 3 + x 4 + x 5 + x 6 + x 7  11 x j  0 for j = 1 to 7 z = x 1 + x 2 + x 3 + x 4 + x 5 + x 6 + x 7 Minimize

61 z = x 1 + x 2 + x 3 + x 4 + x 5 + x 6 + x 7 subject to x 1 + x 4 + x 5 + x 6 + x 7 + y 1  17 x 1 + x 2 + x 5 + x 6 + x 7 + y 2  13 x 1 + x 2 + x 3 + x 6 + x 7 + y 3  15 x 1 + x 2 + x 3 + x 4 + x 7 + y 4  19 x 1 + x 2 + x 3 + x 4 + x 5 + y 5  14 x 2 + x 3 + x 4 + x 5 + x 6 + y 6  16 x 3 + x 4 + x 5 + x 6 + x 7 + y 7  11 x j  0, y j  0 for j = 1 to 7 + PT 1 y 1 + PT 2 y 2 + … + PT 7 y 7

62 Another Enhancement Suppose that the number of workers required on day j is d j. Let y j be the number of workers on day j. What is the minimum cost schedule, where the “cost” of having too many workers on day j is -f j (y j – d j ), which is a non-linear function? NOTE: this will lead to a non-linear program, not a linear program. We will let s j = y j – d j be the excess number of workers on day j.

63 What is the Revised Linear Program? subject to x 1 + x 4 + x 5 + x 6 + x 7  17 x 1 + x 2 + x 5 + x 6 + x 7  13 x 1 + x 2 + x 3 + x 6 + x 7  15 x 1 + x 2 + x 3 + x 4 + x 7  19 x 1 + x 2 + x 3 + x 4 + x 5  14 x 2 + x 3 + x 4 + x 5 + x 6  16 x 3 + x 4 + x 5 + x 6 + x 7  11 x j  0 for j = 1 to 7 z = x 1 + x 2 + x 3 + x 4 + x 5 + x 6 + x 7 Minimize

64 z = f 1 (s 1 ) + f 2 (s 2 ) + f 3 (s 3 ) + f 4 (s 4 ) + f 5 (s 5 ) + f 6 (s 6 ) + f 7 (s 7 ) subject to x 1 + x 4 + x 5 + x 6 + x 7 - s 1 = 17 x 1 + x 2 + x 5 + x 6 + x 7 - s 2 = 13 x 1 + x 2 + x 3 + x 6 + x 7 - s 3 = 15 x 1 + x 2 + x 3 + x 4 + x 7 - s 4 = 19 x 1 + x 2 + x 3 + x 4 + x 5 - s 5 = 14 x 2 + x 3 + x 4 + x 5 + x 6 - s 6 = 16 x 3 + x 4 + x 5 + x 6 + x 7 - s 7 = 11 x j  0, s j  0 for j = 1 to 7

65 A non-linear objective that often can be made linear. Suppose that one wants to minimize the maximum of the slacks, that is minimize z = max (s 1, s 2, …, s 7 ). This is a non-linear objective. But we can transform it, so the problem becomes an LP?

66 minimize z = max (s1, s2, …, s7). subject to x 1 + x 4 + x 5 + x 6 + x 7 - s 1 = 17 x 1 + x 2 + x 5 + x 6 + x 7 - s 2 = 13 x 1 + x 2 + x 3 + x 6 + x 7 - s 3 = 15 x 1 + x 2 + x 3 + x 4 + x 7 - s 4 = 19 x 1 + x 2 + x 3 + x 4 + x 5 - s 5 = 14 x 2 + x 3 + x 4 + x 5 + x 6 - s 6 = 16 x 3 + x 4 + x 5 + x 6 + x 7 - s 7 = 11 x j  0, s j  0 for j = 1 to 7

67 Minimize z z  s j for j = 1 to 7. subject to x 1 + x 4 + x 5 + x 6 + x 7 - s 1 = 17 x 1 + x 2 + x 5 + x 6 + x 7 - s 2 = 13 x 1 + x 2 + x 3 + x 6 + x 7 - s 3 = 15 x 1 + x 2 + x 3 + x 4 + x 7 - s 4 = 19 x 1 + x 2 + x 3 + x 4 + x 5 - s 5 = 14 x 2 + x 3 + x 4 + x 5 + x 6 - s 6 = 16 x 3 + x 4 + x 5 + x 6 + x 7 - s 7 = 11 x j  0, s j  0 for j = 1 to 7 The new constraint ensures that z  max (s 1, …, s 7 ) The objective ensures that z = s j for some j.

68 Another non-linear objective that often can be made linear. Suppose that the “goal” is to have d j workers on day j. Let y j be the number of workers on day j. Suppose that the objective is minimize  i | y j – d j | This is a non-linear objective. But we can transform it, so the problem becomes an LP.

69 Minimize  j z j z j  y j - d j for j = 1 to 7. subject to x 1 + x 4 + x 5 + x 6 + x 7 = y 1 x 1 + x 2 + x 5 + x 6 + x 7 = y 2 x 1 + x 2 + x 3 + x 6 + x 7 = y 3 x 1 + x 2 + x 3 + x 4 + x 7 = y 4 x 1 + x 2 + x 3 + x 4 + x 5 - = y 5 x 2 + x 3 + x 4 + x 5 + x 6 = y 6 x 3 + x 4 + x 5 + x 6 + x 7 = y 7 x j  0, y j  0 for j = 1 to 7 The new constraints ensure that z j  | y j – d j | for each j. The objective ensures that z j = | y j – d j | for each j. z j  d j - y j for j = 1 to 7.

70 A ratio constraint: Suppose that we need to ensure that at least 30% of the workers have Sunday off. How do we model this? (x 1 + x 2 )/(x 1 + x 2 + x 3 + x 4 + x 5 + x 6 + x 7 ) .3 (x 1 + x 2 ) .3 x 1 +.3 x 2 +.3 x 3 +.3 x 4 +.3 x 5 +.3 x 6 +.3 x 7 -.7 x 1 -.7 x 2 +.3 x 3 +.3 x 4 +.3 x 5 +.3 x 6 +.3 x 7 <= 0

71 Other enhancements Require that each shift has an integral number of workers –integer program Consider longer term scheduling –model 6 weeks at a time Consider shorter term scheduling – model lunch breaks Model individual workers –permit worker preferences

72 Distribution Network Problems

73 The Big M Distribution-Network Problem The Big M Company produces a variety of heavy duty machinery at two factories. One of its products is a large machine, lathes (model L). Orders have been received from three customers for the machine, lathes (model L).

74 Some Data Shipping Cost for Each Lathe To Customer 1Customer 2Customer 3 FromOutput Factory 1$700$900$800 12 model L Factory 2800900700 15 model L Order Size 10 lathes Model L 8 lathes Model L 9 lathes Model l

75 The Distribution Network Question: How many machines (model L) should be shipped from each factory to each customer so that sipping costs are minimized? 12 Model L produced 15 Model L produced 10 Model L needed 8 Model L needed 9 Model L needed

76 Activities – shipping lanes (not the level of production which has already been defined) –Level of each activity – number of machines of model L shipped through the corresponding shipping lane.  Best mix of shipping amounts Resources  requirements from factories and customers. Example: Requirement 1: Factory 1 must ship 12 machines model L Requirement 2: Factory 2 must ship 15 machines model L Requirement 3: Customer 1 must receive 10 machines model L Requirement 4: Customer 2 must receive 8 machines model L Requirement 5: Customer 3 must receive 9 machines model L

77 Algebraic Formulation LetS ij = Number of lathes to ship from i to j (i = F1, F2; j = C1, C2, C3). Minimize Cost = $700S F1-C1 + $900S F1-C2 + $800S F1-C3 + $800S F2-C1 + $900S F2-C2 + $700S F2-C3 subject to S F1-C1 + S F1-C2 + S F1-C3 >= 12 S F2-C1 + S F2-C2 + S F2-C3 >= 15 S F1-C1 + S F2-C1 <= 10 S F1-C2 + S F2-C2< <= 8 S F1-C3 + S F2-C3 <= 9 and S ij ≥ 0 (i = F1, F2; j = C1, C2, C3).

78 Algebraic Formulation LetS ij = Number of lathes to ship from i to j (i = F1, F2; j = C1, C2, C3). Minimize Cost = $700S F1-C1 + $900S F1-C2 + $800S F1-C3 + $800S F2-C1 + $900S F2-C2 + $700S F2-C3 subject to Factory 1:S F1-C1 + S F1-C2 + S F1-C3 = 12 Factory 2:S F2-C1 + S F2-C2 + S F2-C3 = 15 Customer 1:S F1-C1 + S F2-C1 = 10 Customer 2:S F1-C2 + S F2-C2 = 8 Customer 3:S F1-C3 + S F2-C3 = 9 and S ij ≥ 0 (i = F1, F2; j = C1, C2, C3).

79 Summary of Main Categories of LP problems: Resource-Allocation Problems Cost-benefit-trade-off problems Distribution-Network Problems

80 Types of Functional Constraints TypeForm*Typical InterpretationMain Usage Resource constraintLHS ≤ RHS For some resource, Amount used ≤ Amount available Resource-allocation problems and mixed problems Benefit constraintLHS ≥ RHS For some benefit, Level achieved ≥ Minimum Acceptable Cost-benefit-trade-off problems and mixed problems Fixed-requirement constraint LHS = RHS For some quantity, Amount provided = Required amount Distribution-network problems and mixed problems * LHS = Left-hand side RHS = Right-hand side (a constant).

81 Mixed LP problems

82 Save-It Company Waste Reclamation The Save-It Company operates a reclamation center that collects four types of solid waste materials and then treats them so that they can be amalgamated into a salable product. Three different grades of product can be made: A, B, and C (depending on the mix of materials used). Question: What quantity of each of the three grades of product should be produced from what quantity of each of the four materials?

83 Product Data for the Save-It Company GradeSpecification Amalgamation Cost per Pound Selling Price per Pound A Material 1: Not more than 30% of total Material 2: Not less than 40% of total Material 3: Not more than 50% of total Material 4: Exactly 20% of total $3.00$8.50 B Material 1: Not more than 50% of total Material 2: Not less than 10% of the total Material 4: Exactly 10% of the total 2.507.00 CMaterial 1: Not more than 70% of the total2.005.50

84 Material Data for the Save-It Company Material Pounds/Week Available Treatment Cost per PoundAdditional Restrictions 13,000$3.001. For each material, at least half of the pounds/week available should be collected and treated. 2. $30,000 per week should be used to treat these materials. 22,0006.00 34,0004.00 41,0005.00

85 Algebraic Formulation Let x ij = Pounds of material j allocated to product i per week (i = A, B, C; j = 1, 2, 3, 4). Maximize Profit = 5.5(x A1 + x A2 + x A3 + x A4 ) + 4.5(x B1 + x B2 + x B3 + x B4 ) + 3.5(x C1 + x C2 + x C3 + x C4 ) subject tox A1 ≤ 0.3 (x A1 + x A2 + x A3 + x A4 ) x A2 ≥ 0.4 (x A1 + x A2 + x A3 + x A4 ) x A3 ≤ 0.5 (x A1 + x A2 + x A3 + x A4 ) x A4 = 0.2 (x A1 + x A2 + x A3 + x A4 ) x B1 ≤ 0.5 (x B1 + x B2 + x B3 + x B4 ) x B2 ≥ 0.1 (x B1 + x B2 + x B3 + x B4 ) x B4 = 0.1 (x B1 + x B2 + x B3 + x B4 ) x C1 ≤ 0.7 (x C1 + x C2 + x C3 + x C4 ) x A1 + x B1 + x C1 ≤ 3,000 x A2 + x B2 + x C2 ≤ 2,000 x A3 + x B3 + x C3 ≤ 4,000 x A4 + x B4 + x C4 ≤ 1,000 x A1 + x B1 + x C1 ≥ 1,500 x A2 + x B2 + x C2 ≥ 1,000 x A3 + x B3 + x C3 ≥ 2,000 x A4 + x B4 + x C4 ≥ 500 3(x A1 + x B1 + x C1 ) + 6(x A2 + x B2 + x C2 ) + 4(x A3 + x B3 + x C3 ) + 5(x A4 + x B4 + x C4 ) = 30,000 and x ij ≥ 0 (i = A, B, C; j = 1, 2, 3, 4).

86 Algebraic Formulation Let x ij = Pounds of material j allocated to product i per week (i = A, B, C; j = 1, 2, 3, 4). Maximize Profit = 5.5(x A1 + x A2 + x A3 + x A4 ) + 4.5(x B1 + x B2 + x B3 + x B4 ) + 3.5(x C1 + x C2 + x C3 + x C4 ) subject toMixture Specifications:x A1 ≤ 0.3 (x A1 + x A2 + x A3 + x A4 ) x A2 ≥ 0.4 (x A1 + x A2 + x A3 + x A4 ) x A3 ≤ 0.5 (x A1 + x A2 + x A3 + x A4 ) x A4 = 0.2 (x A1 + x A2 + x A3 + x A4 ) x B1 ≤ 0.5 (x B1 + x B2 + x B3 + x B4 ) x B2 ≥ 0.1 (x B1 + x B2 + x B3 + x B4 ) x B4 = 0.1 (x B1 + x B2 + x B3 + x B4 ) x C1 ≤ 0.7 (x C1 + x C2 + x C3 + x C4 ) Availability of Materials:x A1 + x B1 + x C1 ≤ 3,000 x A2 + x B2 + x C2 ≤ 2,000 x A3 + x B3 + x C3 ≤ 4,000 x A4 + x B4 + x C4 ≤ 1,000 Restrictions on amount treated:x A1 + x B1 + x C1 ≥ 1,500 x A2 + x B2 + x C2 ≥ 1,000 x A3 + x B3 + x C3 ≥ 2,000 x A4 + x B4 + x C4 ≥ 500 Restriction on treatment cost:3(x A1 + x B1 + x C1 ) + 6(x A2 + x B2 + x C2 ) + 4(x A3 + x B3 + x C3 ) + 5(x A4 + x B4 + x C4 ) = 30,000 and x ij ≥ 0 (i = A, B, C; j = 1, 2, 3, 4).

87 Spreadsheet Formulation


Download ppt "Explorations in Artificial Intelligence Prof. Carla P. Gomes Module 6 Intro to Linear Programming."

Similar presentations


Ads by Google