+ All Categories
Home > Documents > Explorations in Artificial Intelligence

Explorations in Artificial Intelligence

Date post: 31-Dec-2015
Category:
Upload: elijah-logan
View: 27 times
Download: 0 times
Share this document with a friend
Description:
Explorations in Artificial Intelligence. Prof. Carla P. Gomes [email protected] Module 6 Intro to Linear Programming. Mathematical Programming. Constraint Programming. 1- Problem Formulation: A problem is a finite set of constraints involving a finite set of variables. - PowerPoint PPT Presentation
85
Explorations in Artificial Intelligence Prof. Carla P. Gomes [email protected] Module 6 Intro to Linear Programming
Transcript
Page 1: Explorations in Artificial Intelligence

Explorations in Artificial Intelligence

Prof. Carla P. [email protected]

Module 6Intro to Linear Programming

Page 2: Explorations in Artificial Intelligence

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

Page 3: Explorations in Artificial Intelligence

3

Mathematical Program

• Optimization problem in which the objective and constraints are given as mathematical functions and

functional relationships.

• Optimize: Z = f(x1, x2, …, xn)

• 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)

Page 4: Explorations in Artificial Intelligence

Linear Programming (LP)

One of the most important scientific advances of the 20th 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!)

Page 5: Explorations in Artificial Intelligence

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)

Page 6: Explorations in Artificial Intelligence

Linear Programming (LP)

Linear – all the functions are linear (f and g functions are linear. Ex: f (x1, x2, …, xn)= c1x1 + c2 x2 + … cn xn

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.

Page 7: Explorations in Artificial Intelligence

Prototype Example – Wyndor Glass (Hillier and Liebermnan)

Page 8: Explorations in Artificial Intelligence

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.

Page 9: Explorations in Artificial Intelligence
Page 10: Explorations in Artificial Intelligence

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?

Page 11: Explorations in Artificial Intelligence

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).

Page 12: Explorations in Artificial Intelligence

Algebraic Model for Wyndor Glass Co.

Let D = the number of doors to produceW = the number of windows to produce

Maximize P = 3 D + 5 Wsubject to

D ≤ 42W ≤ 123D + 2W ≤ 18

andD ≥ 0, W ≥ 0.

Page 13: Explorations in Artificial Intelligence

Finding the Optimal Solution

0 2 4 6 8

8

6

4

2

Production rate

for windows

Production rate for doors

Feasible

region

(2, 6)

Optimal solution

10

W

D

P = 3600 = 300D + 500W

P = 3000 = 300D + 500W

P = 1500 = 300D + 500W

Our objective function is: maximize 3D+5W

The vector representing the gradient of the objective function is:

5

3

DW3

5

The line through the origin that contains this vector is:

isoprofit line

Maximize P = 3 D + 5 W

subject to

D ≤ 42W ≤ 123D + 2W ≤ 18

and

D ≥ 0, W ≥ 0.

Page 14: Explorations in Artificial Intelligence

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.

njx

mibxa

xc

j

i

n

jjij

n

jjj

10

1t. s.

max(P)

1

1

z

y

z

y

Convex Not convex

Extreme points

Page 15: Explorations in Artificial Intelligence

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 areglobal optima.

Page 16: Explorations in Artificial Intelligence

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.

Page 17: Explorations in Artificial Intelligence

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

 

Page 18: Explorations in Artificial Intelligence

Terminology and notation (cont.)

Z – value of the overall measure of performance; value of the objective function,

xj – level of activity j (for j = 1, 2, …, n) decision variables

cj – increase in Z for each unit increase in the level of activity j; coefficient of objective function associated

with activity j

bi – amount of resource i that is available (for i=1,2,…, m). Right-hand-side of constraint associated with

resource i.

aij – amount of resource i consumed by each unit of activity j.  Technological coefficient.

(The values of cj, bi, and aij are the input constants for the model the parameters of the model. )

Page 19: Explorations in Artificial Intelligence

 

xi >= 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

Page 20: Explorations in Artificial Intelligence

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

Page 21: Explorations in Artificial Intelligence

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 solutionIf the problem has multiple optimal solutions, at least two must be CPF solutions

Page 22: Explorations in Artificial Intelligence

Wyndor Glass

0 2 4 6 8

8

6

4

2

Production rate

for windows

Production rate for doors

Feasible

region

(2, 6)

Optimal solution

10

W

D

P = 3600 = 300D + 500W

P = 3000 = 300D + 500W

P = 1500 = 300D + 500W

CPF

Edge of Feasible region

0

1

Z=0

Z=30

Let D = the number of doors to produceW = the number of windows to produce

Maximize P = 3 D + 5 W

2 Z=36

Z=273

Page 23: Explorations in Artificial Intelligence

No Feasible Solutions – Why?

0 2 4 6 8

8

6

4

10

2

Feasible

region

Production rate for doorsD

W

2 W =12

D = 4

3 D + 2 W = 18

Production rate for windows Maximize P = 3 D + 5 W

subject to

D ≤ 42W ≤ 123D + 2W ≤ 18

3 D + 5 W 50

and

D ≥ 0, W ≥ 0.Previous Feasible Region

Page 24: Explorations in Artificial Intelligence

Multiple Optimal Solutions. Why?

0 2 4 6 8

8

6

4

10

2

Feasible

region

Production rate for doorsD

W

2 W =12

D = 4

3 D + 2 W = 18

Production rate for windows

Maximize P = 3 D + 2 W

subject to

D ≤ 42W ≤ 123D + 2W ≤ 18

and

D ≥ 0, W ≥ 0.

Every point on this line isAn optimal solution with P=18

Page 25: Explorations in Artificial Intelligence

Unbounded Objective Function. Why?

Prod

uctio

n ra

te f

or w

indo

ws

D

W

8

6

4

2

2 4 6 80Production rate for doors

Prod

uctio

n ra

te f

or w

indo

ws

D = 4

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=

Page 26: Explorations in Artificial Intelligence

Sensitivity Analysis

0 2 4 6 8

8

6

4

2

Production rate

for windows

Production rate for doors

Feasible

region

x*=(2, 6)

Optimal solution c2>2

10

W

D

P = 3600 = 300D + 500W

P = 3000 = 300D + 500W

P = 1500 = 300D + 500W

Our objective function is: maximize 3x1+c2x2

How does the optimal solution change as c2

changes?Multiple Optimal solution c2=2 P=18 x* = (2,6) ; x*=(4,3)And any convex combination

Optimal solution 0 <c2<2 x*=(4,3)

Multiple Optimal solution c2=0 P=12 x*=(4,3) and (4,0) and any Convex combination

Optimal solution c2<0 x*=(4,0)

Page 27: Explorations in Artificial Intelligence

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. 

Page 28: Explorations in Artificial Intelligence

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.

Page 29: Explorations in Artificial Intelligence

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

Page 30: Explorations in Artificial Intelligence

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!!!

Page 31: Explorations in Artificial Intelligence

Examples of Different Categories of LP problems:

Resource-Allocation Problems

Cost-benefit-trade-off problems

Distribution-Network Problems

Page 32: Explorations in Artificial Intelligence

Algebraic Model for Wyndor Glass Co.

Let D = the number of doors to produceW = the number of windows to produce

Maximize P = 3 D + 5 Wsubject to

D ≤ 42W ≤ 123D + 2W ≤ 18

andD ≥ 0, W ≥ 0.

Page 33: Explorations in Artificial Intelligence

Examples of Different Categories of LP problems:

Resource-Allocation Problems

Page 34: Explorations in Artificial Intelligence

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

 

Page 35: Explorations in Artificial Intelligence

Finding the Optimal Solution

0 2 4 6 8

8

6

4

2

Production rate

for windows

Production rate for doors

Feasible

region

(2, 6)

Optimal solution

10

W

D

P = 3600 = 300D + 500W

P = 3000 = 300D + 500W

P = 1500 = 300D + 500W

Our objective function is: maximize 3D+5W

The vector representing the gradient of the objective function is:

5

3

DW3

5

The line through the origin that contains this vector is:

isoprofit line

Maximize P = 3 D + 5 W

subject to

D ≤ 42W ≤ 123D + 2W ≤ 18

and

D ≥ 0, W ≥ 0.

Page 36: Explorations in Artificial Intelligence

Cost-benefit-trade-off problems

Page 37: Explorations in Artificial Intelligence

Cost-benefit-trade-off problems

The mix of levels of various activities is

chosen to achieve minimum acceptable levels

for various benefits at a minimum cost.

Page 38: Explorations in Artificial Intelligence

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 mediaThe 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?

Page 39: Explorations in Artificial Intelligence

Activity 1 – advertise on televisionActivity 2 – advertise in the print media

Benefit 1 – increases sales of stain removerBenefit 2 – increases sales of liquid detergentBenefit 3 – increases sales of powder detergent

Page 40: Explorations in Artificial Intelligence

Profit & Gambit Co. Data

Profit & Gambit Co. Advertising-Mix Problem

Television Print MediaUnit Cost ($millions) 1 2

MinimumIncrease

Stain Remover 0 1 3Liquid Detergent 3 2 18

Powder Detergent -1 4 4

Increase in Sales per Unit of Advertising (%)

Page 41: Explorations in Artificial Intelligence

Algebraic Model for Profit & Gambit

Let TV = the number of units of advertising on televisionPM = the number of units of advertising in the print media

Minimize Cost = TV + 2PM (in millions of dollars)subject to

PM ≥ 33TV + 2PM ≥ 18–TV + 4PM ≥ 4

andTV ≥ 0, PM ≥ 0.

Page 42: Explorations in Artificial Intelligence

Algebraic Model for Profit & Gambit

Let TV = the number of units of advertising on televisionPM = 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 ≥ 3Liquid detergent increased sales: 3TV + 2PM ≥ 18Powder detergent increased sales: –TV + 4PM ≥ 4

andTV ≥ 0, PM ≥ 0.

Page 43: Explorations in Artificial Intelligence

Applying the Graphical Method

8

6

4

2

0 2 4 6 8 1 0-2-4Amount of TV advertising

Feasible

region

10

3 TV + 2 PM = 18

PM = 3

PM

TV

-TV + 4 PM = 4

Amount of print media advertising

Page 44: Explorations in Artificial Intelligence

The Optimal Solution

Amount of TV advertising

Feasible region

0 5 10 15

10

4

(4,3)

optimal solution

Cost = 15 = TV + 2 PM

Cost = 10 = TV + 2 PM

TV

PM

Page 45: Explorations in Artificial Intelligence

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.

Page 46: Explorations in Artificial Intelligence

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?

Page 47: Explorations in Artificial Intelligence

Time Periods Covered by Shift

Time Period 1 2 3 4 5MinimumNumber 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

Page 48: Explorations in Artificial Intelligence

LP Formulation

Let Si = Number working shift i (for i = 1 to 5),

Minimize Cost = $170S1 + $160S2 + $175S3 + $180S4 + $195S5

subject toS1 ≥ 48S1 + S2 ≥ 79S1 + S2 ≥ 65S1 + S2 + S3 ≥ 87S2 + S3 ≥ 64S3 + S4 ≥ 73S3 + S4 ≥ 82S4 ≥ 43S4 + S5 ≥ 52S5 ≥ 15

andSi ≥ 0 (for i = 1 to 5)

Page 49: Explorations in Artificial Intelligence

LP Formulation

Let Si = Number working shift i (for i = 1 to 5),

Minimize Cost = $170S1 + $160S2 + $175S3 + $180S4 + $195S5

subject toTotal agents 6AM–8AM: S1 ≥ 48Total agents 8AM–10AM: S1 + S2 ≥ 79Total agents 10AM–12PM: S1 + S2 ≥ 65Total agents 12PM–2PM: S1 + S2 + S3 ≥ 87Total agents 2PM–4PM: S2 + S3 ≥ 64Total agents 4PM–6PM: S3 + S4 ≥ 73Total agents 6PM–8PM: S3 + S4 ≥ 82Total agents 8PM–10PM: S4 ≥ 43Total agents 10PM–12AM: S4 + S5 ≥ 52Total agents 12AM–6AM: S5 ≥ 15

andSi ≥ 0 (for i = 1 to 5)

Page 50: Explorations in Artificial Intelligence

Work-scheduling problem

Page 51: Explorations in Artificial Intelligence

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.

Page 52: Explorations in Artificial Intelligence

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

Page 53: Explorations in Artificial Intelligence

Scheduling Postal Workers

Each postal worker works for 5 consecutive days, followed by 2 days off, repeated weekly.

Day Mon Tues Wed Thurs Fri Sat Sun

Demand 17 13 15 19 14 16 11

Minimize the number of postal workers (for the time being, we will permit fractional workers on each day.)

Page 54: Explorations in Artificial Intelligence

Day Mon Tues Wed Thurs Fri Sat Sun

Demand 17 13 15 19 14 16 11

Minimize z = x1 + x2 + x3 + x4 + x5 + x6 + x7

subject to x1 17x2 13

x3 15

x4 19

x5 14

x6 16

x7 11

xj 0 for j = 1 to 7

•Decision variables

–Let x1 be the number of workers who work on Monday

–Let x2 be the number of workers who work on Tuesday …

–Let x3, x4, …, x7 be defined similarly.

What’s wrong with this formulation?

Page 55: Explorations in Artificial Intelligence

Answer

Objective function is not number of full-time post office employees each employee is counted five times;

The variables x1, x2, x3, 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)

Page 56: Explorations in Artificial Intelligence

LP Formulation

Select the decision variables– Let x1 be the number of workers who start working on Monday, and work till Friday– Let x2 be the number of workers who start on Tuesday …– Let x3, x4, …, x7 be defined similarly.

Note 1: number of full-time employees is x1 + x2 + x3 + x4 + x5 + x6 + x7

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)

Page 57: Explorations in Artificial Intelligence

The linear program

Minimize z = x1 + x2 + x3 + x4 + x5 + x6 + x7

subject to x1 + x4 + x5 + x6 + x7 17

Day Mon Tues Wed Thurs Fri Sat Sun

Demand 17 13 15 19 14 16 11

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 16

x3 + x4 + x5 + x6 + x7 11

xj 0 for j = 1 to 7

Page 58: Explorations in Artificial Intelligence

Some Enhancements of the Model

Suppose that there is a pay differential. The cost of workers who start work on day j is cj per worker and we want to minimize the cost.

Minimize z = c1 x1 + c2 x2 + c3 x3 + … + c7 x7

Page 59: Explorations in Artificial Intelligence

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 PTj.

Let yj = number of part time workers on day j

Page 60: Explorations in Artificial Intelligence

What is the Revised Linear Program?

subject to 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 16

x3 + x4 + x5 + x6 + x7 11

xj 0 for j = 1 to 7

z = x1 + x2 + x3 + x4 + x5 + x6 + x7Minimize

Page 61: Explorations in Artificial Intelligence

Minimize z = x1 + x2 + x3 + x4 + x5 + x6 + x7

subject to x1 + x4 + x5 + x6 + x7 + y1 17

x1 + x2 + x5 + x6 + x7 + y2 13

x1 + x2 + x3 + x6 + x7 + y3 15

x1 + x2 + x3 + x4 + x7 + y4 19

x1 + x2 + x3 + x4 + x5 + y5 14

x2 + x3 + x4 + x5 + x6 + y6 16

x3 + x4 + x5 + x6 + x7 + y7 11

xj 0 , yj 0 for j = 1 to 7

+ PT1 y1 + PT2 y2 + … + PT7 y7

Page 62: Explorations in Artificial Intelligence

Another Enhancement

Suppose that the number of workers required on day j is dj. Let yj 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 -fj(yj – dj), which is a non-linear function?

NOTE: this will lead to a non-linear program, not a linear program.

We will let sj = yj – dj be the excess number of workers on day j.

Page 63: Explorations in Artificial Intelligence

What is the Revised Linear Program?

subject to 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 16

x3 + x4 + x5 + x6 + x7 11

xj 0 for j = 1 to 7

z = x1 + x2 + x3 + x4 + x5 + x6 + x7Minimize

Page 64: Explorations in Artificial Intelligence

Minimizez = f1(s1) + f2(s2) + f3(s3) + f4(s4) + f5(s5) + f6(s6) + f7(s7)

subject to x1 + x4 + x5 + x6 + x7 - s1 = 17

x1 + x2 + x5 + x6 + x7 - s2 = 13

x1 + x2 + x3 + x6 + x7 - s3 = 15

x1 + x2 + x3 + x4 + x7 - s4 = 19

x1 + x2 + x3 + x4 + x5 - s5 = 14

x2 + x3 + x4 + x5 + x6 - s6 = 16

x3 + x4 + x5 + x6 + x7 - s7 = 11

xj 0 , sj 0 for j = 1 to 7

Page 65: Explorations in Artificial Intelligence

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 (s1, s2, …, s7).

This is a non-linear objective.

But we can transform it, so the problem becomes an LP?

Page 66: Explorations in Artificial Intelligence

minimize z = max (s1, s2, …, s7).

subject to x1 + x4 + x5 + x6 + x7 - s1 = 17

x1 + x2 + x5 + x6 + x7 - s2 = 13

x1 + x2 + x3 + x6 + x7 - s3 = 15

x1 + x2 + x3 + x4 + x7 - s4 = 19

x1 + x2 + x3 + x4 + x5 - s5 = 14

x2 + x3 + x4 + x5 + x6 - s6 = 16

x3 + x4 + x5 + x6 + x7 - s7 = 11

xj 0 , sj 0 for j = 1 to 7

Page 67: Explorations in Artificial Intelligence

Minimize z

z sj for j = 1 to 7.

subject to x1 + x4 + x5 + x6 + x7 - s1 = 17

x1 + x2 + x5 + x6 + x7 - s2 = 13

x1 + x2 + x3 + x6 + x7 - s3 = 15

x1 + x2 + x3 + x4 + x7 - s4 = 19

x1 + x2 + x3 + x4 + x5 - s5 = 14

x2 + x3 + x4 + x5 + x6 - s6 = 16

x3 + x4 + x5 + x6 + x7 - s7 = 11

xj 0 , sj 0 for j = 1 to 7

The new constraint ensures that z max (s1, …, s7)

The objective ensures that z = sj for some j.

Page 68: Explorations in Artificial Intelligence

A ratio constraint:

Suppose that we need to ensure that at least 30% of the workers have Sunday off.

How do we model this?

(x1 + x2 )/(x1 + x2 + x3 + x4 + x5 + x6 + x7) .3

(x1 + x2 ) .3 x1 + .3 x2 + .3 x3 + .3 x4 + .3 x5 + .3 x6 + .3 x7

-.7 x1 - .7 x2 + .3 x3 + .3 x4 + .3 x5 + .3 x6 + .3 x7 <= 0

Page 69: Explorations in Artificial Intelligence

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

Page 70: Explorations in Artificial Intelligence

Distribution Network Problems

Page 71: Explorations in Artificial Intelligence

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).

Page 72: Explorations in Artificial Intelligence

Some Data

Shipping Cost for Each Lathe

To Customer 1 Customer 2 Customer 3

From Output

Factory 1 $700 $900 $800 12 model L

Factory 2 800 900 700 15 model L

Order Size10 lathes

Model L

8 lathes

Model L

9 lathes

Model l

Page 73: Explorations in Artificial Intelligence

The Distribution Network

F1

C2

C3

C1

F2

12 latheproduced

15 lathesproduced

10 lathesneeded

8 lathesneeded

9 lathesneeded

$700/lathe

$900/lathe

$800/lathe

$800/lathe $900/lathe

$700/lathe

Question: How many machines (model L) should be shipped from each factory to each customer so that sipping costs are minimized?

12 Model Lproduced

15 Model Lproduced

10 Model Lneeded

8 Model Lneeded

9 Model Lneeded

Page 74: Explorations in Artificial Intelligence

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 LRequirement 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

Page 75: Explorations in Artificial Intelligence

Algebraic Formulation

Let Sij = Number of lathes to ship from i to j (i = F1, F2; j = C1, C2, C3).

Minimize Cost = $700SF1-C1 + $900SF1-C2 + $800SF1-C3 + $800SF2-C1 + $900SF2-C2 + $700SF2-C3

subject toSF1-C1 + SF1-C2 + SF1-C3 >= 12SF2-C1 + SF2-C2 + SF2-C3 >= 15SF1-C1 + SF2-C1 <= 10SF1-C2 + SF2-C2< <= 8SF1-C3 + SF2-C3 <= 9

andSij ≥ 0 (i = F1, F2; j = C1, C2, C3).

Page 76: Explorations in Artificial Intelligence

Algebraic Formulation

Let Sij = Number of lathes to ship from i to j (i = F1, F2; j = C1, C2, C3).

Minimize Cost = $700SF1-C1 + $900SF1-C2 + $800SF1-C3 + $800SF2-C1 + $900SF2-C2 + $700SF2-C3

subject toFactory 1: SF1-C1 + SF1-C2 + SF1-C3 = 12Factory 2: SF2-C1 + SF2-C2 + SF2-C3 = 15Customer 1: SF1-C1 + SF2-C1 = 10Customer 2: SF1-C2 + SF2-C2 = 8Customer 3: SF1-C3 + SF2-C3 = 9

andSij ≥ 0 (i = F1, F2; j = C1, C2, C3).

Page 77: Explorations in Artificial Intelligence

Summary of Main Categories of LP problems:

Resource-Allocation Problems

Cost-benefit-trade-off problems

Distribution-Network Problems

Page 78: Explorations in Artificial Intelligence

Types of Functional Constraints

Type Form* Typical Interpretation Main Usage

Resource constraint LHS ≤ RHSFor some resource, Amount used ≤ Amount available

Resource-allocation problems and mixed problems

Benefit constraint LHS ≥ RHSFor some benefit, Level achieved ≥ Minimum Acceptable

Cost-benefit-trade-off problems and mixed problems

Fixed-requirement constraint

LHS = RHSFor some quantity, Amount provided = Required amount

Distribution-network problems and mixed problems

* LHS = Left-hand side

RHS = Right-hand side (a constant).

Page 79: Explorations in Artificial Intelligence

Mixed LP problems

Page 80: Explorations in Artificial Intelligence

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?

Page 81: Explorations in Artificial Intelligence

Product Data for the Save-It Company

Grade SpecificationAmalgamation Cost

per PoundSelling Price per

Pound

A

Material 1: Not more than 30% of totalMaterial 2: Not less than 40% of totalMaterial 3: Not more than 50% of totalMaterial 4: Exactly 20% of total

$3.00 $8.50

BMaterial 1: Not more than 50% of totalMaterial 2: Not less than 10% of the totalMaterial 4: Exactly 10% of the total

2.50 7.00

C Material 1: Not more than 70% of the total 2.00 5.50

Page 82: Explorations in Artificial Intelligence

Material Data for the Save-It Company

MaterialPounds/Week

AvailableTreatment Cost

per Pound Additional Restrictions

1 3,000 $3.00 1. 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.

2 2,000 6.00

3 4,000 4.00

4 1,000 5.00

Page 83: Explorations in Artificial Intelligence

Algebraic Formulation

Let xij = Pounds of material j allocated to product i per week (i = A, B, C; j = 1, 2, 3, 4).

Maximize Profit = 5.5(xA1 + xA2 + xA3 + xA4) + 4.5(xB1 + xB2 + xB3 + xB4) + 3.5(xC1 + xC2 + xC3 + xC4)subject to xA1 ≤ 0.3 (xA1 + xA2 + xA3 + xA4)

xA2 ≥ 0.4 (xA1 + xA2 + xA3 + xA4) xA3 ≤ 0.5 (xA1 + xA2 + xA3 + xA4) xA4 = 0.2 (xA1 + xA2 + xA3 + xA4) xB1 ≤ 0.5 (xB1 + xB2 + xB3 + xB4)xB2 ≥ 0.1 (xB1 + xB2 + xB3 + xB4)xB4 = 0.1 (xB1 + xB2 + xB3 + xB4)xC1 ≤ 0.7 (xC1 + xC2 + xC3 + xC4) xA1 + xB1 + xC1 ≤ 3,000xA2 + xB2 + xC2 ≤ 2,000xA3 + xB3 + xC3 ≤ 4,000xA4 + xB4 + xC4 ≤ 1,000xA1 + xB1 + xC1 ≥ 1,500xA2 + xB2 + xC2 ≥ 1,000xA3 + xB3 + xC3 ≥ 2,000xA4 + xB4 + xC4 ≥ 5003(xA1 + xB1 + xC1) + 6(xA2 + xB2 + xC2)+ 4(xA3 + xB3 + xC3) + 5(xA4 + xB4 + xC4) = 30,000

and xij ≥ 0 (i = A, B, C; j = 1, 2, 3, 4).

Page 84: Explorations in Artificial Intelligence

Algebraic Formulation

Let xij = Pounds of material j allocated to product i per week (i = A, B, C; j = 1, 2, 3, 4).

Maximize Profit = 5.5(xA1 + xA2 + xA3 + xA4) + 4.5(xB1 + xB2 + xB3 + xB4) + 3.5(xC1 + xC2 + xC3 + xC4)subject to Mixture Specifications: xA1 ≤ 0.3 (xA1 + xA2 + xA3 + xA4)

xA2 ≥ 0.4 (xA1 + xA2 + xA3 + xA4) xA3 ≤ 0.5 (xA1 + xA2 + xA3 + xA4) xA4 = 0.2 (xA1 + xA2 + xA3 + xA4) xB1 ≤ 0.5 (xB1 + xB2 + xB3 + xB4)xB2 ≥ 0.1 (xB1 + xB2 + xB3 + xB4)xB4 = 0.1 (xB1 + xB2 + xB3 + xB4)xC1 ≤ 0.7 (xC1 + xC2 + xC3 + xC4)

Availability of Materials: xA1 + xB1 + xC1 ≤ 3,000xA2 + xB2 + xC2 ≤ 2,000xA3 + xB3 + xC3 ≤ 4,000xA4 + xB4 + xC4 ≤ 1,000

Restrictions on amount treated: xA1 + xB1 + xC1 ≥ 1,500xA2 + xB2 + xC2 ≥ 1,000xA3 + xB3 + xC3 ≥ 2,000xA4 + xB4 + xC4 ≥ 500

Restriction on treatment cost: 3(xA1 + xB1 + xC1) + 6(xA2 + xB2 + xC2)+ 4(xA3 + xB3 + xC3) + 5(xA4 + xB4 + xC4) = 30,000

and xij ≥ 0 (i = A, B, C; j = 1, 2, 3, 4).

Page 85: Explorations in Artificial Intelligence

Spreadsheet Formulation

Grade A Grade B Grade CUnit Amalg. Cost $3.00 $2.50 $2.00 Total Treatment Cost $30,000Unit Selling Price $8.50 $7.00 $5.50 =

Unit Profit $5.50 $4.50 $3.50 Treatment Funds Available $30,000

Material Allocation Unit Total(pounds of material used for each product grade) Treament Minimum Material Amount

Grade A Grade B Grade C Cost to Treat Treated AvailableMaterial 1 412.3 2,587.7 0 $3 1,500 <= 3,000 <= 3,000Material 2 859.6 517.5 0 $6 1,000 <= 1,377 <= 2,000Material 3 447.4 1,552.6 0 $4 2,000 <= 2,000 <= 4,000Material 4 429.8 517.5 0 $5 500 <= 947 <= 1,000

Total Products 2,149.1 5,175.4 0Mixture

Mixture Specifications PercentsGrade A, Material 1 412.3 <= 644.7 30% of Grade A

Total Profit $35,110 Grade A, Material 2 859.6 >= 859.6 40% of Grade AGrade A, Material 3 447.4 <= 1,074.6 50% of Grade AGrade A, Material 4 429.8 = 429.8 20% of Grade A

Grade B, Material 1 2,587.7 <= 2,587.7 50% of Grade BGrade B, Material 2 517.5 >= 517.5 10% of Grade BGrade B, Material 4 517.5 = 517.5 10% of Grade B

Grade C, Material 1 0.0 <= 0.0 70% of Grade C


Recommended