Uploaded by Akmal Adli

DAO Cheatsheet

advertisement
Bayes’ Theorem: P(B)=P(BnA)+P(BnA’)
P(A|B)=[P(B|A)P(A)]/[P(B|A)P(A)+P(B|A’)P
(A’)]
Sensitivity: P(positive|disease)
Specificity: P(negative|disease’)
PPV: P(disease|positive)
Independent Events: P(AnB)=P(A)P(B)
Expected Value:∑PiXi
Variance: ∑Pi(Xi-µ)2
Binomial Distribution:
BINOM.DIST(x,n,p,cumulative)
n independent trials; each trial same
probability of success and failure
E(X)=np, Var=np(1-p)
Poisson Distribution:POISSON.DIST(x,λ
,cumulative)
probability of occurrence same for any 2
equal intervals; occurrences in non
overlapping intervals are independent. P(
N=i ) = (e-λxλi /i!)
λ = E(X) = mean = Var(X) = average no. of
occurrences per unit time
Linear Function: Y = aX + b
E(Y) = aE(X)+b, Var(Y) = a2Var(X)
Cov(X,Y) =∑P(X=Xi,Y=Yi)[(Xi- µx)(Yi- µy)]
Cov(X,Y) = E(XY) – E(X)E(Y)
Cov(X,X) = Var(X)
Corr(X,Y) = (Cov(X,Y)/(σxσy);
-1<Corr<1
If independent, E(XY)=E(X)E(Y), Cov=0,
Corr=0, P(X=Xi,Y=Yi)=P(X=Xi)*P(Y=Yi)
Var(aX+bY)=a2VarX+b2Var(Y), Var(XY)=Var(X)+Var(Y)
Random Variables
E(aX + b) = aE(X) + b, Var(aX+b) = a2Var(X)
E(aX+bY)=aE(X)+bE(Y), Var(aX+bY)=a2VarX
+ b2VarY + 2abCov(X,Y),
PDF: area under curve=1; area = P(a≤X≤b)
Mean: ∫xf(x)dx, Var: ∫(x-µ)2 dx
CDF: ∫f(s); F(t) = F(<t)
Uniform Distribution
CDF: f(t) = 1/(b-a) or 0
PDF: F(t) = (t-a)/(b-a) or 0 or 1
E(X): (a+b)/2; Var(X): (b-a)^2/12
Exponential Distribution:
EXPON.DIST(x,λ,cumulative)
f(x)=λe-λx, x>0
λ=1/E(X); λ2=1/Var(X) F(x) = 1 – e-λx
Normal Dist: if X~N(µ,σ), Z=(X-µ)/σ
µ-σ<x< µ+σ: 68.26%, µ-2σ<x< µ+2σ:
95.44%, µ-3σ<x< µ+3σ: 99.72%
X & Y are normal r.v., W=aX+bY,
E(W)=aE(X)+bE(Y)=aµx+bµy
Var(W)= a2Var(X)+b2Var(Y)
+2ab*σxσyCorr(X,Y) OR
a2Var(X)+b2Var(Y)+2abCov(X,Y)
Central Limit Theorem: X1,X2,Xn is
identically distributed & independent, Sn
= X1+X2+Xn (n>30) is approximately
normally distributed
E(Xi)=µ, E(Sn)=nµ; Var(Xi) = σ2,
Var(Sn)=nσ2
Binomial Approx.: if np>5, n(1-p)>5,
approx. binomial to normal.
X~B(n p,np(1-p)), X~N(np,np(1-p))
Decision Tree:
EMV: expected value of all payoffs
EVPI: max. value to pay for perfect
information, Max. EMV w/ perfect
information – max. EMV w/o info.
EVSI: max. value to pay for sample info
(when info is imperfect)
X produces soap. If market strong, will
make 18m, if weak, lose 8m.
P(strong)=0.3.
Note EVSI = 1.36+2.4m. Remember to
include cost of survey.
Generate U[a,b]: a+(b-a)RAND()
Optimisation: remember to define
variables clearly.
i: Product j: resource Pi: price of product i
rj: avail. of resource j; aij: units of resource
j needed for one unit of product i
max.
Woo
d
F. Hrs
C. Hrs
Desk
8
Table
6
Chair
1
Avail.
48
4
2
2
1.5
1.5
0.5
20
8
satisfied at equality at optimal solution
Sensitivity Analysis: studies the effect of
parameter changes, affect optimal
solution? Affect optimal objective value?
Changes in objective function coeffs.:
Max. 40C+50T, s.t. 1C+2T<=10, 4C+3T<=30
Coeff of C [25,67], optimal sol. no change,
obj value changes
([25,67] is the sensitivity range of C) To
find range of c1 or c2, equate
c1/c2=slope=slope of binding variable.
Changes in constraint quantity(constr.
RHS):
4C+3T<=40, optimal sol.& obj. value
changes (draw graphs to see new
intersection) within a certain range. when
2 graphs intersect in 1stQ, binding
constraints will not change.(shadow price
remains)
Shadow Price: marginal change of
objective value due to +1 unit of resource
or requirement (within sensi range)
Usually, Yes=1,No=0.
e.g. you have $15k, but have 7 investment
options (aj), with different NPV (vj)
max ∑(j=1, 7) vjxj
s.t. ∑(j=1,7) ajxj <=15k, xj =binary
At most one event: x1+x2+x3<=1, xi = bin.
All or nothing: x1=x2, x1,x2 binary.
Conditional: If x1 occurs, x2 must occur
x1<=x2, x1,x2 binary
If X and Y occurs, Z must occur. X+Y-1<=Z
Resolving non-linear expressions: If y
does not occur, x=0. If y occurs, 0<=x<=My
where y is binary (on/off switch)
Decision variables: y1,…,y5: on/off switch
x1,…,x5: quantities to produce
max ∑(i=1,5) pixi - ∑(i=1,5)riyi
Changes in objective function coeff.: e.g. Max Z=4X1+3X2, s.t. 4X1+2X2<=60, 2X1+4X2<=48. Slope of constraint 1: -4/2, constraint 2: -2/4. Thus, 4/2<=C1/3<=-2/4, 1.5<=C1<=6. -4/2<=4/C2<=-2/4, 2<=C2<=8.
For shadow price, higher shadow price, better investment. Shadow price: Optimal value (after) – optimal value (before)/change in constraint’s
capacity.
Objective function is given by final value (what A,B&C should be). The value is 5850 as shown. Note, the table only accounts for one variable to
change. If there are 2, e.g. A changes from 50 to 53, and C changes from 55 to 53, take ∑proposed change/allowable change <=100%, if not optimal
solution will change. A: (53-50)/7.5 + (55-53)/15 = 0.533 <= 1. So optimal solution will not change. Reduced cost of -7.5 means 1 unit of A would
lead to a loss in profit by 7.5. Note also if shadow price <0, when decreased, it will lead to a profit.
For questions regarding holding inventory, think Ii-1+Pi=Di+Ii. Thus, min. cost ∑(i=1,6)ciPi+hiIi.
Price: Desk $60, Table $30 Chair $20
max. 60x1 + 30x2 + 20x3,
s.t. 8x1+6x2+x3<=48, 4x1+2x2+1.5x3 <=20
2x1+1.5x2+0.5x3<=8, x1,x2,x3>=0
Formula: min/max : c1x1+…+cnxn
s.t. a11x1+…+a1nxn <= b1,
a21x2+…+a2nxn<= b2
Enhancement: max∑(i=1,3)pixi
s.t. ∑(i=1,3) aij xj <= rj, for j=1,2,3. Xi>=0,
for i = 1,2,3
Binding Constraints: constraints that are
e.g. if shadow price of constraint b2 is 6, if
b2 is within sensi range, one extra unit of
b2 will improve optimal profit by $6.
Changes in constraint coeff.: everything
changes
Allowable increase/decre.:the range, if
within, will generate profit as per SP.
Discrete Optimisation
Int. variables: must be int.
Binary variables: must be bin.
Mixed Integer Program: mixed bin/int.
s.t. ∑(i=1,5)hixi<=4000, ∑(i=1,5)aixi<=4500,
xi<=Myi, i=1,..,5
yi binary, xi>=0
Constraint 5: Linda would like to take at least two courses in Marketing
(course 11, 18,19, and 20) and at least two courses in Operations (course
4, 14, 15, 16, 17).
๐‘‹2,11 + ๐‘‹2,18 + ๐‘‹2,19 + ๐‘‹2,20
≥ 2๐‘‹1,4 + ๐‘‹2,4 + ๐‘‹1,14 + ๐‘‹2,14 + ๐‘‹2,15 + ๐‘‹2,16
+ ๐‘‹1,17 ≥ 2
EVSI: -13.9-(-14)+1=1.1, EVPI: -13-(-14)+1=2. If want to find best value of
p to maximise EVPI/SI, separate p into bins, place EVSI value beside the
header, highlight the table, what-if analysis, column input cell is p’s cell.
Maximise 8x1+2x2, s.t. 2x1-6x2≤12, 5x1+4x2≤40 x1+2x2≤12, x1,x2>=0
Xi: quantities to produce
Max ∑(i=1,5)pixi - ∑(i=1,5)riyi
s.t. ∑(i=1,5) hixi<=4000, ∑(i=1,5) aixi <=4500
0<= xi <= Myi, M is a large number, for i = 1,2,3,4,5. yi binary.
๐‘‹๐‘–๐‘— = {1 ๐‘–๐‘“ ๐‘— ๐‘–๐‘  ๐‘ ๐‘’๐‘™๐‘’๐‘๐‘ก๐‘’๐‘‘ ๐‘Ž๐‘ก ๐‘ ๐‘’๐‘š ๐‘– 0 ๐‘œ๐‘กโ„Ž๐‘’๐‘Ÿ๐‘ค๐‘–๐‘ ๐‘’
Constraint 1: Linda is allowed to take at most five courses in each
semester -> X1j <=5 and X2j <=5
Constraint 2: Linda can only take a course if she has completed or is
currently taking all courses that are prerequisites for the course (Logic:
Those courses with pre-requisite will not be taken in Semester 1)
๐‘‹2,9 ≤ ๐‘‹1,1 + ๐‘‹1,8 − 1 e.g. must take X1,1 and X1,8 before taking X2,9
๐‘‹2,14 ≤ ๐‘‹1,4 Must take X1,4 before taking X2,14
Constraint 3: In Semester 1, Linda must take at least three courses from
course 1, course 3, course 4, course 5, and course 7.
๐‘‹1,1 + ๐‘‹1,3 + ๐‘‹1,4 + ๐‘‹1,5 + ๐‘‹1,7 ≥ 3
Then draw graphically to prove . Farmer in Iowa owns 450 of land. Each
piece if sell wheat, $2k, 3 workers, 2 fertilisers. If sell corn, $3k, 2
workers, 4 fertilisers. 1000 workers and 1200 fertilisers.
Math model: ∑(i=1,2) pixi, s.t. ∑(i=1,2)aijxi<=rj, j=1,2, Xi>=0
Let X be the probability of the amount of ounces poured by the machine
into a soda bottle. X ~ N (µ, 0.05) 0.1% of the bottles have to have less
than 16 ounces of soda. X~Z(16-µ, 0.05) P(X<16) = 0.001
((16-µ)/0.05) = -3.09023
16-µ = 0.05*-3.09023
µ = 16 + 0.15451 = 16.15451
Constraint 4: If Linda takes course 18, she will not be allowed to take
course 20, because these two courses cover fairly similar materials.
๐‘‹2,18 + ๐‘‹2,20 ≤ 1
-changing objective function, rotates the isoquant and direction to
optimise. Optimal solution will not change if within the sensi range,
objective value will always change but we are able to calculate if the
optimal solution remains unchanged.
-changing coefficient of constraint changes everything. Shifting the
constraint will cause optimal solution and objective value to change.
Binding constraint will not change if within sensi range. Can use shadow
price to estimate the impact on objective value.
Download