Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery...

41
Lecture 4 Duality and game theory

Transcript of Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery...

Page 1: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

Lecture 4

Duality and game theory

Page 2: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

Knapsack problem – duality illustration

• A thief robs a jewelery shop with a knapsack• He cannot carry too much weight• He can choose among well divisible objects (gold, silver,

diamond sand)• A thief wants to take the most valuable goods with him

Page 3: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

The model• Parameters:

W – knapsack maximal weightN – number of goods in a shopwi – good i’s weight

vi – good i’s value

• Decision variables: xi – share of total amount of good i taken to the knapsack

• Objective function:Maximize the total value

• Constraints:(a) Cannot take more than available(b) Cannot take more than the knapsack capacity (c) Cannot take the negative (if he is a thief indeed)

Page 4: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

The model

• Formulate as an LP:

Max

Page 5: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

Problem of a thief (a primal problem)

• Substitute N=3, W=4, w=(2,3,4) i v=(5,20,3)gold, diamond sand and silver.

maxp.w.

A thief problem solution: (x1,x2,x3)=(0.5, 1, 0)Objective function value: 22.5

Page 6: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

Analysis

• Only one good will be taken partially (gold). It is a general rule in all knapsack problems with N divisible goods.

• Intuition: – The optimal solution is unique. – In order to uniquely determine 3 unknowns, we need 3

independent linear equations. – So at least 3 constraints should be satisfied as equalities. – One constraint is the knapsack weight, but another two are

about goods quantities 0≤xi≤1. – Hence only one good may be taken in fractional amount in

the optimum.

Page 7: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

Crime syndicate buys out the thief’s business

• The crime syndicate wants to buy out the goods from the thief together with his thief business (equipment etc. here: knapsack).

• They propose prices y1 for gold, y2 for diamond sand, y3 for silver and y4 for 1 kg knapsack capacity.

• But the thief may use 2 kg knapsack capacity and all the gold to generate 5 units of profit , so the price offered for gold 2y4+y1 should be at least 5. Similarly with other goods.

• The syndicate wants to minimize the amount it has to pay the thief y1+y2+y3+4y4

• The prices should not be negative, otherwise the thief will be insulted.

Page 8: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

The syndicate problem (a dual problem)

• The syndicate problem may be formulated as follows:

min

p.w.

Syndicate problem solution: (y1,y2,y3,y4)=(0,12.5,0,2.5)Objective function value: 22.5

Page 9: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

The thief problem

Is equivalent

Because e.g.

Transforming:

Because e.g.

It is equivalent to the sybdicate problem

Page 10: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

Syndicate problem optimal solution: (y1,y2,y3,y4)=(0,12.5,0,2.5) dual pricesOptimal objectuve function value: 22.5

Thief problem optimal solution: (x1,x2,x3)=(0.5, 1, 0)Optimal objective function value: 22.5

Microsoft Excel 12.0 Raport wrażliwościArkusz: [knapsack.xlsx]primalRaport utworzony: 2013-03-27 16:27:40

Komórki decyzyjne Wartość Przyrost Współczynnik Dopuszczalny Dopuszczalny

Komórka Nazwa końcowa krańcowy funkcji celu wzrost spadek$B$2 x1 x 0,5 0 5 8,333333333 3,5$B$3 x2 x 1 0 20 1E+30 12,5$B$4 x3 x 0 -7 3 7 1E+30

Warunki ograniczające Wartość Cena Prawa strona Dopuszczalny Dopuszczalny

Komórka Nazwa końcowa dualna w. o. wzrost spadek$E$8 knapsack weight Ax 4 2,5 4 1 1$E$9 x1 Ax 0,5 0 1 1E+30 0,5$E$10 x2 Ax 1 12,5 1 0,333333333 0,333333333$E$11 x3 Ax 0 0 1 1E+30 1

Page 11: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

Rozwiązanie problemu złodzieja: (x1,x2,x3)=(0.5, 1, 0)Optymalna wartość funkcji celu: 22.5

Rozwiązanie problemu syndyka: (y1,y2,y3,y4)=(0,12.5,0,2.5) ceny dualneOptymalna wartość funkcji celu: 22.5

Microsoft Excel 12.0 Raport wrażliwościArkusz: [knapsack.xlsx]dualnyRaport utworzony: 2013-03-27 16:27:15

Komórki decyzyjne Wartość Przyrost Współczynnik Dopuszczalny Dopuszczalny

Komórka Nazwa końcowa krańcowy funkcji celu wzrost spadek$B$2 y1 y 0 0,5 1 1E+30 0,5$B$3 y2 y 12,5 0 1 0,333333333 0,333333333$B$4 y3 y 0 1 1 1E+30 1$B$5 y4 y 2,5 0 4 0,999999999 1

Warunki ograniczające Wartość Cena Prawa strona Dopuszczalny Dopuszczalny

Komórka Nazwa końcowa dualna w. o. wzrost spadek$F$7 min price per gold A'y 5 0,5 5 8,333333333 3,5$F$8 min price per diamonds A'y 20 1 20 1E+30 12,5$F$9 min price per silver A'y 10 0 3 7 1E+30

Page 12: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

Matching/assignment

x Gene Helen Irene RowsumsDavid 1 0 0 1Edward 0 1 0 1Fenix 0 0 1 1colsums 1 1 1

compatibility Gene Helen IreneDavid 1 0 0.5Edward 0.75 2 1Fenix 0.5 2.5 1.5

Objective fun 4.5

http://mathsite.math.berkeley.edu/smp/smp.html

Page 13: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

Individual decision theory vs game theory

Page 14: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

Zero-sum games

• In zero-sum games, payoffs in each cell sum up to zero

• Movement diagram

Page 15: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

Zero-sum games• Minimax = maximin = value of the game

• The game may have multiple saddle points

Page 16: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

Zero-sum games

• Or it may have no saddle points

• To find the value of such game, consider mixed strategies

Page 17: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

Zero-sum games

• If there is more strategies, you don’t know which one will be part of optimal mixed strategy.

• Let Column mixed strategy be (x,1-x)• Then Raw will try to maximize

Page 18: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

Zero-sum games• Column will try to choose x to minimize the upper envelope

Page 19: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

Zero-sum games

• Tranform into Linear Programming

Page 20: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

Fishing on Jamaica

• In the fifties, Davenport studied a village of 200 people on the south shore of Jamaica, whose inhabitants made their living by fishing.

Page 21: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

• Twenty-six fishing crews in sailing, dugout canoes fish this area [fishing grounds extend outward from shore about 22 miles] by setting fish pots, which are drawn and reset, weather and sea permitting, on three regular fishing days each week … The fishing grounds are divided into inside and outside banks. The inside banks lie from 5-15 miles offshore, while the outside banks all lie beyond … Because of special underwater contours and the location of one prominent headland, very strong currents set across the outside banks at frequent intervals … These currents are not related in any apparent way to weather and sea conditions of the local region. The inside banks are almost fully protected from the currents. [Davenport 1960]

Page 22: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

Jamaica on a map

Page 23: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

Strategies

• There were 26 wooden canoes. The captains of the canoes might adopt 3 fishing strategies:– IN – put all pots on the inside banks – OUT – put all pots on the outside banks– IN-OUT) – put some pots on the inside banks,

some pots on the outside

Page 24: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

Advantages and disadvantages of fishing in the open sea

Disadvantages

• It takes more time to reach, so fewers pots can be set

• When the current is running, it is harmful to outside pots – marks are dragged away – pots may be smashed while

moving– changes in temeperature

may kill fish inside the pots

Advanatages

• The outside banks produce higher quality fish both in variaties and in size. – If many outside fish are available,

they may drive the inside fish off the market.

• The OUT and IN-OUT strategies require better canoes. – Their captains dominate the

sport of canoe racing, which is prestigious and offers large rewards.

Page 25: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

Collecting data

• Davenport collected the data concerning the fishermen average monthly profit depending on the fishing strategies they used to adopt.

Fishermen\Current FLOW NO FLOW

IN 17,3 11,5

OUT -4,4 20,6

IN-OUT 5,2 17,0

Page 26: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

OUT Strategy

Page 27: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

Zero-sum game? The current’s problem

• There is no saddle point• Mixed strategy:

– Assume that the current is vicious and plays strategy FLOW with probability p, and NO FLOW with probability 1-p

– Fishermen’s strategy: IN with prob. q1, OUT with prob. q2, IN-OUT with prob. q3

– For every p, fishermen choose q1,q2 and q3 that maximizes:

– And the vicious current chooses p, so that the fishermen get min

Page 28: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

Graphical solution of the current’s problem

Mixed strategy of the current

Solution: p=0.31

5

7

9

11

13

15

17

19

21

IN

OUT

IN-OUT

Page 29: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

The fishermen’s problem

• Similarly:– For every fishermen’s strategy q1,q2 and q3, the

vicious current chooses p so that the fishermen earn the least:

– The fishermen will try to choose q1,q2 and q3 to maximize their payoff:

Page 30: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

Maximin and minimaxobjective function

Fishers' mixed strategy

q1 q2 q3Maximize 13,31 0,67 0,00 0,33

Expected payoff of the current whenFLOW 13,31 >= 13,31NO FLOW 13,31 >= 13,31probabilities 1,00 = 1,00

objective function

Mixed strategy of the current

p 1-pminimize 13,31 0,31 0,69

Expected payoff from strategy:IN 13,31 <= 13,31OUT 12,79 <= 13,31IN_OUT 13,31 <= 13,31probabilities 1,00 = 1,00

Optimal strategy for the fishermen

Optimal strategy for the current

Value of the game

Page 31: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

Minimax sensitivity report

Microsoft Excel 12.0 Raport wrażliwości

Arkusz: [jamajka.xlsx]minimax

Raport utworzony: 2013-03-27 16:24:55

Komórki decyzyjne

    Wartość Przyrost Współczynnik Dopuszczalny Dopuszczalny

Komórka Nazwa końcowakrańcow

y funkcji celu wzrost spadek

$C$3objective function 13,31 0,00 1 1E+30 1

$D$3 p 0,31 0,00 0 11,8 5,8

$E$3 1-p 0,69 0,00 0 5,8 11,8

Warunki ograniczające

    Wartość Cena Prawa strona Dopuszczalny Dopuszczalny

Komórka Nazwa końcowa dualna w. o. wzrost spadek

$B$6 IN 13,31 -0,67 0 12,1 0,7

$B$7 OUT 12,79 0,00 0 1E+30 0,525

$B$8 IN-OUT 13,31 -0,33 0 0,3 12,1

$B$9 probabilities 1,00 13,31 1 1E+30 1

Page 32: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

Microsoft Excel 12.0 Raport wrażliwościArkusz: [jamajka.xlsx]maximin

Raport utworzony: 2013-03-27 16:23:31

Komórki decyzyjne

    Wartość PrzyrostWspółczynni

kDopuszczaln

yDopuszczaln

yKomórk

a Nazwa końcowakrańcow

y funkcji celu wzrost spadek

$C$3objective function 13,31 0,00 1 1E+30 1

$D$3 q1 0,67 0,00 0 0,7 12,1$E$3 q2 0,00 -0,52 0 0,525 1E+30$F$3 q3 0,33 0,00 0 12,1 0,3

Warunki ograniczające

    Wartość Cena Prawa stronaDopuszczaln

yDopuszczaln

yKomórk

a Nazwa końcowa dualna w. o. wzrost spadek$B$6 FLOW 13,31 -0,31 0 5,8 11,8$B$7 NO FLOW 13,31 -0,69 0 11,8 5,8$B$8 probabilities 1,00 13,31 1 1E+30 1

Maximin sensitivity report

Page 33: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

Forecast and observation

Game theory predicts• No fishermen risks fishing

outside• Strategy 67% IN, 33% IN-

OUT [Payoff: 13.31]• Optimal current’s strategy

31% FLOW, 69% NO FLOW

Observation shows• No fishermen risks fishing

outside • Strategy 69% IN, 31% IN-

OUT [Payoff: 13.38]• Current’s „strategy”: 25%

FLOW, 75% NO FLOW

The similarity is strikingDavenport’s finding went unchallenged for several yearsUntil …

Page 34: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

Current is not vicious

• Kozelka 1969 and Read, Read 1970 pointed out a serious flaw:– The current is not a reasoning entity and cannot adjust to fishermen

changing their strategies.– Hence fishermen should use Expected Value principle:

• Expected payoff of the fishermen:– IN: 0.25 x 17.3 + 0.75 x 11.5 = 12.95– OUT: 0.25 x (-4.4) + 0.75 x 20.6 = 14.35– IN-OUT: 0.25 x 5.2 + 0.75 x 17.0 = 14.05

• Hence, all of the fishermen should fish OUTside.• Maybe, they are not well adapted after all

Fishermen\Current FLOW (25%) NO FLOW (75%)

IN 17,3 11,5

OUT -4,4 20,6

IN-OUT 5,2 17,0

Page 35: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

Current may be vicious after all• The current does not reason, but it is very risky to fish outside.• Even if the current runs 25% of the time ON AVERAGE, it might

run considerably more or less in the short run of a year.• Suppose one year it ran 35% of the time. Expected payoffs:

– IN: 0.35 x 17.3 + 0.65 x 11.5 = 13.53– OUT: 0.35 x (-4.4) + 0.65 x 11.5 = 11.85– IN-OUT: 0.35 x 5.2 + 0.65 x 17.0 = 12.87.

• By treating the current as their opponent, fishermen GUARANTEE themselves payoff of at least 13.31.

• Fishermen pay 1.05 pounds as insurance premium

Actual (25%) Vicious (31%) 35%Optimal 13.3125 13.3125 13.3125Actual 13.291 13.31164 13.3254OUT 14.35 12.85 11.85

Page 36: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

Decision making under uncertainty

Rybacy\Prąd Płynie Nie płynie

IN 0 9,1

OUT 21,7 0

IN-OUT 12,1 3,6

0,67 IN+0,33 IN-OUT 3,9875 7,2875

Fishermen\Current FLOW NO FLOW MAXIMIN MAXIMAX MINIMAX REGRET

IN 17,3 11,5 11,5 17,3 9,1

OUT -4,4 20,6 -4,4 20,6 21,7IN-OUT 5,2 17 5,2 17 12,10,67 IN+0,33 IN-OUT 13,3125 13,3125 13,3125 13,3125 7,2875

Page 37: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

Decision making under uncertainty

Rybacy\Prąd Płynie Nie płynie

IN 0 9,1

OUT 21,7 0

IN-OUT 12,1 3,6

0,67 IN+0,33 IN-OUT 3,9875 7,2875

Fishermen\Current FLOW NO FLOW MAXIMIN MAXIMAX MINIMAX REGRET

IN 17,3 11,5 11,5 17,3 9,1

OUT -4,4 20,6 -4,4 20,6 21,7IN-OUT 5,2 17 5,2 17 12,10,67 IN+0,33 IN-OUT 13,3125 13,3125 13,3125 13,3125 7,2875

Page 38: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

Decision making under uncertainty

Fishermen\Current FLOW NO FLOW

IN 0 9,1

OUT 21,7 0

IN-OUT 12,1 3,6

0,67 IN+0,33 IN-OUT 3,9875 7,2875

Fishermen\Current FLOW NO FLOW MAXIMIN MAXIMAX MINIMAX REGRET

IN 17,3 11,5 11,5 17,3 9,1

OUT -4,4 20,6 -4,4 20,6 21,7IN-OUT 5,2 17 5,2 17 12,10,67 IN+0,33 IN-OUT 13,3125 13,3125 13,3125 13,3125 7,2875

Regret matrix

Page 39: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

Decision making under uncertainty

Fishermen\Current FLOW NO FLOW

IN 0 9,1

OUT 21,7 0

IN-OUT 12,1 3,6

0,67 IN+0,33 IN-OUT 3,9875 7,2875

Fishermen\Current FLOW NO FLOW MAXIMIN MAXIMAX MINIMAX REGRET

IN 17,3 11,5 11,5 17,3 9,1

OUT -4,4 20,6 -4,4 20,6 21,7IN-OUT 5,2 17 5,2 17 12,10,67 IN+0,33 IN-OUT 13,3125 13,3125 13,3125 13,3125 7,2875

Regret matrix

Page 40: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

Decision making under uncertaintyFishermen\Current FLOW NO FLOW MAXIMIN MAXIMAX Hurwicz

optimism/pessimism index

IN 17,3 11,5 11,5 17,3 11,5α+17,3(1-α)

OUT -4,4 20,6 -4,4 20,6 -4,4α+20,6(1-α)IN-OUT 5,2 17 5,2 17 5,2α+17(1-α)0,67 IN+0,33 IN-OUT 13,3125 13,3125 13,3125 13,3125 13,3125

Page 41: Lecture 4 Duality and game theory. Knapsack problem – duality illustration A thief robs a jewelery shop with a knapsack He cannot carry too much weight.

5

7

9

11

13

15

17

19

21

IN

OUT

IN-OUT