35
ctl.mit.edu Analytics Basics: Models, Algebra, & Functions

Analytics Basics: Models, Algebra, & Functions › 2019 › 10 › sc... · 5 Categories of Mathematical Models Model Functional Independent OR/MS Category Form f(.) Variables Techniques

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Analytics Basics: Models, Algebra, & Functions › 2019 › 10 › sc... · 5 Categories of Mathematical Models Model Functional Independent OR/MS Category Form f(.) Variables Techniques

ctl.mit.edu

Analytics Basics: Models, Algebra, & Functions

Page 2: Analytics Basics: Models, Algebra, & Functions › 2019 › 10 › sc... · 5 Categories of Mathematical Models Model Functional Independent OR/MS Category Form f(.) Variables Techniques

Decision making is at the core of supply chain management.

How many facilities should I open and where?

What transportation option should I use?

How should I trade-off service and cost?

Where should I source my raw material from?

How should I share risk with my customers/suppliers?

How much inventory should I have?

What is my demand for next year?

How can I make my supply chain more resilient?

Analytical models are used to make supply chain decisions

2

Page 3: Analytics Basics: Models, Algebra, & Functions › 2019 › 10 › sc... · 5 Categories of Mathematical Models Model Functional Independent OR/MS Category Form f(.) Variables Techniques

Model Classification

3Source: Bradley, Hax, Magnanti 1977

Real World

Operational Exercise

Gaming SimulationAnalytical

Model

Increasing degree of abstraction and speed

Increasing degree of realism and cost

Human is part of the modeling process

Human is external to the modeling process

Page 4: Analytics Basics: Models, Algebra, & Functions › 2019 › 10 › sc... · 5 Categories of Mathematical Models Model Functional Independent OR/MS Category Form f(.) Variables Techniques

Classification of Models

Strategy Evaluation Strategy Generation

Certainty

Deterministic Simulation

Econometric Models

Systems of Simultaneous Equations

Input-Output Models

Linear Programming

Network Models

Integer and MILP

Non-Linear Programming

Control Theory

Uncertainty

Monte-Carlo Simulation

Econometric Models

Stochastic Processes

Queuing Theory

Reliability Theory

Decision Theory

Dynamic Programming

Inventory Theory

Stochastic Programming

Stochastic Control Theory

4Source: Bradley, Hax, Magnanti 1977

Page 5: Analytics Basics: Models, Algebra, & Functions › 2019 › 10 › sc... · 5 Categories of Mathematical Models Model Functional Independent OR/MS Category Form f(.) Variables Techniques

5

Categories of Mathematical Models

Model Functional Independent OR/MSCategory Form f(.) Variables Techniques

Source: Ragsdale, 2004

Descriptive known, unknown or Simulation, PERT,well-defined uncertain Queueing Theory,

Inventory Models

Predictive unknown, known or under Regression Analysis,ill-defined decision maker’s Time Series Analysis,

control Discriminant Analysis

Prescriptive known, known or under Classic Opt., LP, MILP,well-defined decision maker’s CPM, EOQ, NLP,

controlWhat should

we do?

What couldhappen?

What has happened?

Page 6: Analytics Basics: Models, Algebra, & Functions › 2019 › 10 › sc... · 5 Categories of Mathematical Models Model Functional Independent OR/MS Category Form f(.) Variables Techniques

Roadmap for the Course

• Deterministic – Prescriptive Modeling

Basic functions & algebra

Classical optimization (calculus)

Math programming (LPs, IPs, MILPs, & Non-Linear)

• Stochastic/Uncertainty – Predictive & Descriptive

Basic probability and distributions

Statistical analysis (hypothesis testing)

Econometric modeling (regression)

Simulation

6

Page 7: Analytics Basics: Models, Algebra, & Functions › 2019 › 10 › sc... · 5 Categories of Mathematical Models Model Functional Independent OR/MS Category Form f(.) Variables Techniques

SCx Approach to Modeling- Educating Drivers not Mechanics!

7All images are CC0 Public Domain from https://pixabay.com and https://openclipart.org

Page 8: Analytics Basics: Models, Algebra, & Functions › 2019 › 10 › sc... · 5 Categories of Mathematical Models Model Functional Independent OR/MS Category Form f(.) Variables Techniques

8

Mathematical Functions

Page 9: Analytics Basics: Models, Algebra, & Functions › 2019 › 10 › sc... · 5 Categories of Mathematical Models Model Functional Independent OR/MS Category Form f(.) Variables Techniques

Mathematical Functions

9Image by By Wvbailey Public Domain, https://commons.wikimedia.org/w/index.php?curid=10562739

“ . . . a relation between a set of inputs and a set of permissible outputs with the property that each input is related to exactly one output.”

source: Wikipedia

y = f (x)we say:

“f of x” or that “y is a function of x”

If given a value for x, then I can compute the value for y.Example: f(x) = x2

x= 2 then y = f(2) = 22 = 4x= 3.4 then y = f(3.4) = 3.42 = 11.56x= -2 then y = f(-2) = (-2)2 = 4

Page 10: Analytics Basics: Models, Algebra, & Functions › 2019 › 10 › sc... · 5 Categories of Mathematical Models Model Functional Independent OR/MS Category Form f(.) Variables Techniques

Linear Functions

10

y = ax+b

Typically, constants are denoted by letters from the start of the alphabet (a, b, c, . . .) while variables are letters from the end of the alphabet (x, y, z).

slope or variable value

constant, fixed value, or

y-intercept

dependent variable

independent variable

“y changes linearly with x”

This is the function, f(x).

x

y

b

a1

Page 11: Analytics Basics: Models, Algebra, & Functions › 2019 › 10 › sc... · 5 Categories of Mathematical Models Model Functional Independent OR/MS Category Form f(.) Variables Techniques

Examples: Linear Functions

• Truckload Transportation Costs:

cost = f(distance) = $200 + 1.35 $/km * (distance)

• Warehousing Costs

cost = f(# cases) = €2,500 + 2.5 €/case * (# cases)

• Profit Equation

profit = f(volume) = (r-c) * v + dwhere:

r = revenue per item(¥/item)c= cost per item (¥/item)v = volume sold (items)d = fixed cost (¥)

11

Page 12: Analytics Basics: Models, Algebra, & Functions › 2019 › 10 › sc... · 5 Categories of Mathematical Models Model Functional Independent OR/MS Category Form f(.) Variables Techniques

12

Quadratic Functions

Page 13: Analytics Basics: Models, Algebra, & Functions › 2019 › 10 › sc... · 5 Categories of Mathematical Models Model Functional Independent OR/MS Category Form f(.) Variables Techniques

Quadratic Functions

• When a>0, the function is convex (or concave up)

• When a<0, the function is concave down

13

y = ax2 +bx+c

dependent variable

This is the function, f(x).

constantsindependent variable

Parabola - Polynomial function of degree 2 where a, b, and c are numbers and a≠0

a>0

x

y

x

ya<0

Page 14: Analytics Basics: Models, Algebra, & Functions › 2019 › 10 › sc... · 5 Categories of Mathematical Models Model Functional Independent OR/MS Category Form f(.) Variables Techniques

Finding Roots of Quadratic

• The root(s) of a quadratic

Values of x for when y=0

There can be 2, 1, or 0 roots

• Two methods for finding roots

Factoring:

Find r1 and r2 such that ax2+bx+c = a(x-r1)(x-r2)

Quadratic equation

14

a>0

x

y

a

acbbrr

2

4,

2

21

-±-=

(i)(ii)

(iii)

(i) y = 2x2

(ii) y = 2x2 - 6x +4(iii) y = 3x2 - 4x + 2

Page 15: Analytics Basics: Models, Algebra, & Functions › 2019 › 10 › sc... · 5 Categories of Mathematical Models Model Functional Independent OR/MS Category Form f(.) Variables Techniques

Example: Finding Roots

(i) y = 2x2 so that a=2, b=c=0

15

a>0

x

y

a

acbbrr

2

4,

2

21

-±-=

(i)(ii)

(iii)

(i) y = 2x2

(ii) y = 2x2 - 6x +4(iii) y = 3x2 - 4x + 2

04

0

)2(2

)0)(2(400,

2

21

rr

(ii) y = 2x2 – 6x + 4 so that a=2, b=-6, c=4

r1, r2 =6 ± (-6)2 - 4(2)(4)

2(2)=

6 ± 36 -32

4=

6 ± 2

4

(iii) y = 3x2 – 4x + 2 so that a=3, b=-4, c=2

r1, r2 =4± (-4)2 - 4(3)(2)

2(3)=

4 ± 16 - 24

6=

4± -8

6

r1 =8

4= 2 r2 =

4

4=1

r1,r2 are complex numbers

Page 16: Analytics Basics: Models, Algebra, & Functions › 2019 › 10 › sc... · 5 Categories of Mathematical Models Model Functional Independent OR/MS Category Form f(.) Variables Techniques

16

Quadratic Functions in Practice

Page 17: Analytics Basics: Models, Algebra, & Functions › 2019 › 10 › sc... · 5 Categories of Mathematical Models Model Functional Independent OR/MS Category Form f(.) Variables Techniques

Quadratic Functions in Practice

17

• Example: Manufacturing iWidgets – what price to set?

Cost of producing iWidgets is a linear function of the number produced, x: cost =f(# made) = 500,000 + 75x

Demand for iWidgets is also a linear function of the price, p: unit sales = f(price) = 20,000 – 80p

So then: Revenue = (20,000-80p)p = 20,000p – 80p2

Costs = 500,000+75(20,000-80p) = 2,000,000 – 6000p

Profit = Revenue – Costs == 20,000p – 80p2 – (2,000,000 – 6,000p)= -80p2 + 26,000p – 2,000,000

What are the root(s) of this equation? r1 = 125r2= 200

a

acbbrr

2

4,

2

21

-±-=

x

y

b

a 1

x

y

Page 18: Analytics Basics: Models, Algebra, & Functions › 2019 › 10 › sc... · 5 Categories of Mathematical Models Model Functional Independent OR/MS Category Form f(.) Variables Techniques

iWidget Example

18

Profit = -80p2 +26,000p – 2,000,000

Roots of quadratic

Maximum profit

Price at which we maximize profit

Page 19: Analytics Basics: Models, Algebra, & Functions › 2019 › 10 › sc... · 5 Categories of Mathematical Models Model Functional Independent OR/MS Category Form f(.) Variables Techniques

Quadratic Functions in Practice

19

• Example: Parcel Trucking – impact of weight

Parcel carriers combine many orders into a single shipment. The cost of an individual order is a function of its weight, w. However, it is not linear – it is tapering.

cost =f(weight) = 33 + 0.067w – 0.00005w2

€ 30

€ 35

€ 40

€ 45

€ 50

€ 55

0 50 100 150 200 250 300

Co

st P

er O

rder

(€

)

Weight of Order (kgs)

Cost Per Order (€) as a Function of Weight (kg)

Page 20: Analytics Basics: Models, Algebra, & Functions › 2019 › 10 › sc... · 5 Categories of Mathematical Models Model Functional Independent OR/MS Category Form f(.) Variables Techniques

20

Other Common Functional Forms

Page 21: Analytics Basics: Models, Algebra, & Functions › 2019 › 10 › sc... · 5 Categories of Mathematical Models Model Functional Independent OR/MS Category Form f(.) Variables Techniques

0.00

0.50

1.00

1.50

2.00

2.50

3.00

- 0.20 0.40 0.60 0.80 1.00 1.20 1.40 1.60 1.80 2.00

y(b=1) y(b=1.5) y(b=.5) y(b=-1)

Power Function y=f(x) = axb

The shape of the curve is dictated by the value of b

21

if b=1, then the function is linear

if b>1, then function increases exponentially

if 0<b<1, then function tapers away from linear

if b<0, then function decreases asymptotically to f(x)=0 and note that f(0) is undefined,

e.g., y=ax-1=a/x

Page 22: Analytics Basics: Models, Algebra, & Functions › 2019 › 10 › sc... · 5 Categories of Mathematical Models Model Functional Independent OR/MS Category Form f(.) Variables Techniques

Exponential Functions y=abx

22

0.00

10.00

20.00

30.00

40.00

50.00

60.00

70.00

80.00

- 0.50 1.00 1.50 2.00 2.50 3.00 3.50 4.00

y=2x

y=3x

y=ex

• Exponential functions have very fast growth• Widely used in physics, biology, economics,

finance, computer science, etc. • Example: compound interest

Future = Principal (1 + Rate)Number_of_Periods

= 100 (1 + 0.20)5 = 248.8

Euler’s Number, e, is a constant, like πe = 2.71828 . . .

e =lim

n®¥1+

1

n

æ

èç

ö

ø÷

n

Page 23: Analytics Basics: Models, Algebra, & Functions › 2019 › 10 › sc... · 5 Categories of Mathematical Models Model Functional Independent OR/MS Category Form f(.) Variables Techniques

23

Logarithms

Page 24: Analytics Basics: Models, Algebra, & Functions › 2019 › 10 › sc... · 5 Categories of Mathematical Models Model Functional Independent OR/MS Category Form f(.) Variables Techniques

Logarithms

24Adapted from http://www.purplemath.com/modules/logs.htm

y=bx

y is the value of b raised to the xth power.

logb(y)=x

x is the power that I need to raise the base, b, to equal y.

100 = 10x log10(100) = x x=25 = 10x log(5) = x x≅0.71 = ex loge(1) = ln(1)=x x=0e = ex ln(e) = x x=1

Properties of Logarithms• log(xy) = log(x) + log(y)• log(x/y) = log(x) – log(y)• log(xa) = a log (x)

y=ax x=y÷ay=a+x x=y-a

Other Inverse Relationships

Examples:• ln(3*5) = ln(3)+ln(5) = 2.71• ln(12/7) = ln(12) – ln(7) = 0.54 • ln(36) = 6 ln(3) = 6.59• log(3*52) = log(3) + 2 log(5) = 1.88

Page 25: Analytics Basics: Models, Algebra, & Functions › 2019 › 10 › sc... · 5 Categories of Mathematical Models Model Functional Independent OR/MS Category Form f(.) Variables Techniques

• You have invested a sum of money that has an interest rate of 7% annually. How many years, T, will it take to double in value?

We know that F=P(1+r)n and we want to find the n where F=2P

F=2P=P(1+r)n which reduces to 2=(1+r)n=(1.07)n

We can transform this by taking the ln or log of both sides: ln(2) = n ln(1.07)

Rearranging gives us: n = ln(2) / ln(1.07) = 0.693 / 0.182 = 10.24 = T

We could also use log10 where T = log(2)/log(1.07) = 10.24

The investment will double in value in 10.24 years.

• Can we come up with a general equation or approximation?

We know that T =ln(2) / ln(1 + r)

Plotting this for T=f(r) . . .looks like T=ar-1=a/r

Turns out T≈ 70/r

25Adapted from http://www.purplemath.com/modules/logs.htm

Practical Example: Doubling Time

- 5

10 15 20 25 30 35 40 45 50 55 60 65 70

- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

Nu

mb

er o

f Ye

ars

to D

ou

ble

in

Val

ue

(T)

Annual Interest Rate (r)

Page 26: Analytics Basics: Models, Algebra, & Functions › 2019 › 10 › sc... · 5 Categories of Mathematical Models Model Functional Independent OR/MS Category Form f(.) Variables Techniques

26

Multivariate Functions

Page 27: Analytics Basics: Models, Algebra, & Functions › 2019 › 10 › sc... · 5 Categories of Mathematical Models Model Functional Independent OR/MS Category Form f(.) Variables Techniques

Multivariate Functions

27Image by By Wvbailey Public Domain, https://commons.wikimedia.org/w/index.php?curid=10562739

These are just functions with more than one independent variable.

y = f (x1, x2,...xn )

we still just say: “y is a function of x1, x2, . . . xn)”

Example: f(x1, x2) = x1 + 2x2 + 5x1x2

x1= 2, x2 = 4 then y = f(2,4) = 2 + 2(4) + 5(2)(4) = 50x1= -1, x2 = 0 then y = f(-1,0) = -1 + 2(0) + 5(-1)(0) = -1x1= 0, x2 = -½ then y = f(0, -½) = 0 + 2(-½) + 5(0)(-½) = -1

INPUT (x1, x2, . . . xn)

OUTPUT y = f(x1, x2, . . . xn)

still just a single output

Page 28: Analytics Basics: Models, Algebra, & Functions › 2019 › 10 › sc... · 5 Categories of Mathematical Models Model Functional Independent OR/MS Category Form f(.) Variables Techniques

Examples: Multivariate Functions

• Parcel Trucking – impact of weight & distance

Parcel carriers combine many orders into a single shipment. The cost of an individual order is a function of its weight, w, and the distance.

cost =f(weight, distance) = c1 + c2w + c3w2 + c4d + c5d2 + c6dw

• Total Logistics Cost Equation

cost = f(Demand, Order Cost, Order Size, ) = cD + AD/Q where:D = annual demand (items)c = cost per item (¥/item)A = cost per order (¥/order)Q = order size (items/order)

28

Page 29: Analytics Basics: Models, Algebra, & Functions › 2019 › 10 › sc... · 5 Categories of Mathematical Models Model Functional Independent OR/MS Category Form f(.) Variables Techniques

29

Properties of Functions

Page 30: Analytics Basics: Models, Algebra, & Functions › 2019 › 10 › sc... · 5 Categories of Mathematical Models Model Functional Independent OR/MS Category Form f(.) Variables Techniques

Properties of a Function: Convexity

30

x

y

A function is convex if it “holds water”

x

y

x

y

Page 31: Analytics Basics: Models, Algebra, & Functions › 2019 › 10 › sc... · 5 Categories of Mathematical Models Model Functional Independent OR/MS Category Form f(.) Variables Techniques

Properties of a Function: Continuity

31

A function is continuous if you can draw it without lifting pen from paper!

x

y

x

y

x

y

Page 32: Analytics Basics: Models, Algebra, & Functions › 2019 › 10 › sc... · 5 Categories of Mathematical Models Model Functional Independent OR/MS Category Form f(.) Variables Techniques

32

Key Points from Lesson

Page 33: Analytics Basics: Models, Algebra, & Functions › 2019 › 10 › sc... · 5 Categories of Mathematical Models Model Functional Independent OR/MS Category Form f(.) Variables Techniques

Key Points from Lesson (1/2)

• Different models used for different purposes

Descriptive – what has happened?

Predictive – what could happen?

Prescriptive – what should we do?

• Functions y=f(x)

Linear functions where y= ax + b

Quadratic functions where y= ax2 + bx + c

Power functions where y= axb

Exponential functions where y= abx

33

Page 34: Analytics Basics: Models, Algebra, & Functions › 2019 › 10 › sc... · 5 Categories of Mathematical Models Model Functional Independent OR/MS Category Form f(.) Variables Techniques

Key Points from Lesson (2/2)

• Logarithms

y=bx is equivalent to logb(y) = x

Natural log ln(y) = loge(y)

• Multivariate functions y=f(x1, x2, . . . xn)

Multiple inputs still lead to single output value

• Properties of functions

Convexity – does the function “hold water”?

Continuity – can I draw the function without lifting my pencil

34

Page 35: Analytics Basics: Models, Algebra, & Functions › 2019 › 10 › sc... · 5 Categories of Mathematical Models Model Functional Independent OR/MS Category Form f(.) Variables Techniques

ctl.mit.edu

Questions, Comments, Suggestions?Use the Discussion Forum!

[email protected]

“Wilson – realizing he is asymptotic to the door”Yankee Golden Retriever Rescued Dog

(www.ygrr.org)