Quadratic Programming - University of Victoriaweb.uvic.ca/~kooten/Training/Training04.pdf · where...

Post on 26-Jun-2018

228 views 0 download

Transcript of Quadratic Programming - University of Victoriaweb.uvic.ca/~kooten/Training/Training04.pdf · where...

Quadratic Programming

G. Cornelis van Kooten

REPA Group University of Victoria

October 18, 2012 2

Problem specification in matrix notation:

Max F(x) = c x + x′ Ω x

s.t. A x b

x ≥ 0

where x′Ωx is the quadratic form.

For a maximum, the objective function must be concave; for a minimum it must be convex

Concave → Ω is negative definite or negative semi-definite

Convex → Ω is positive definite or positive semi-definite

0220223

024262

02441

)22(22264L

definite negative032 1

1 2,02,

2 1

1 2

2,2 1,,6 4

0,

22s.t.

22264max

2

1

21

22

22

yxyxL

yxy

L

yxx

L

yxyxyxyxyx

bAy

xxc

yx

yx

yxyxyx

Example

solution. feasible basic theofout driven be first to the

are that variablesartificial are and where

223'

62422'

4241'

:follows as 31 resultsConvert

:methodsimplex theusing

solved becan that one toproblem isconvert th We

0,,,,6

0,05

0)22(4

21

22

11

21

21

AA

Syx

Ayx

Ayx

yx

yx

yx

S is a slack variable, as usual; (4) and (5) are

complementary slackness conditions.

any time.at solution in becan pair each of oneonly

or ,or nonbasic, is or either :last three handle To

0 and

0

0

0

and

2 2

6 242

4 24s.t.

36610max

:implies This

)(maxmin

:asproblem theRestate

21

21

2

1

22

11

21

2121

yxS

μ,μλ,y,x,

y

x

S

Syx

Ayx

Ayx

yxZ

AAAA

October 18, 2012 6

QP Conclusions

If we maximize Z = – A1 – A2 , we have solved the original QP.

Why?

The new problem takes into account the optimization as the 1st-

order conditions are met already, plus we have shown the

problem to be a maximum as Ω was negative definite.

The advantage of QP is that a QP problem can be re-specified

as an LP. Hence, QP problems are treated as separate

options/solvers in Matlab and GAMS. In Excel, the problem

needs to be set up as an LP as shown above (i.e., solving for the

1st-order conditions).

Price Endogenous Models

Let Pd = α – β Qd (demand function)

Ps = a + b Qs (supply function)

In equilibrium:

Pd = Ps or [α – β Qd] = [a + b Qs]

and Qd = Qs

It is important to recognize that quantity supplied must be equal to or greater than demand Qs ≥ Qd, but if Qs>Qd, then P* = 0, where P* is equilibrium price.

October 18, 2012 7

Thus: (–Qs + Qd )P* = 0

which is a Kuhn-Tucker condition.

October 18, 2012 8

Price

0

quantity

demand

supply

Case where supply exceeds demand and price is zero.

Price Endogenous Model (cont)

To solve for the equilibrium quantity and price, the objective is to maximize the area under the demand curve minus the area under the supply function. Thus, we get the following QP problem:

Max α Qd – ½ β Qd2 – a Qs– ½ b Qs

2

s.t. Qd – Qs 0

Qd, Qs ≥ 0

P* is the dual variable associated with the 1st constraint.

October 18, 2012 9

Spatial Price Equilibrium (SPE) or

Trade Model

• Production and/or consumption occur in spatially separated markets, each with its own supply and demand. Trade occurs if prices between regions differ by the amount of the transportation cost plus tariffs/taxes

• Developed by Takayama & Judge (Spatial and Temporal Price and Allocation Models 1971) and Judge & Takayama (Studies in Economic Planning over Space and Time 1973) (both North-Holland)

October 18, 2012 10

Graphic representation of SPE models follows.

October 18, 2012 11

(a) Canada (b) International Market (c) United States

Lumber quantity

Price

Pc

0 q* qcS

a

b

Sc

ES+ transportation costs

PU

Sus

Dus

0 0 q*

Dc

Canadian surplus = a + b

U.S. surplus = α + β

Canada-U.S. Trade in Softwood Lumber

October 18, 2012 12

ES = excess supply

ED = excess demand

(a) Canada (b) International Market (c) United States

Lumber quantity

Price

Pc

0 q* qcS

a

b

Sc

EDCanada

PU

Sus

Dus

0 0 q*

Dc

ESCanada

Canada-U.S. Trade in Softwood Lumber (cont)

October 18, 2012 13

ES = excess supply

ED = excess demand

(a) Canada (b) International Market (c) United States

Lumber quantity

Price

Pc

0 q* qcS

a

b

Sc

PU

Sus

Dus

0 0 q*

Dc

ESCanada

EDUS

P trade

Q trade

Canada-U.S. Trade in Softwood Lumber (cont)

October 18, 2012 14

U.S. and Canadian prices differ by the transportation cost =

PUtrade – PC

trade

(a) Canada (b) International Market (c) United States

Lumber quantity

Price

Pc

0 q* qcS

a

b

Sc

PU

Sus

Dus

0 0 q*

Dc

ES

EDUS

PU trade

Q trade

PC trade

ES+ transportation costs

Canada-U.S. Trade in Softwood Lumber (cont)

(a) Canada (b) International Market (c) United States

Lumber quantity

Price

PcT

Pc

0 qcD q* qc

S

a

b c

d e

g

Sc

ES+ transportation costs

A

B C

D

E

G

QT

ES

ED

PU

PTU

Sus

Dus

0 0 qUs q* qU

d

Dc

Cdn surplus = a+b+c+g+e+d

U.S. surplus = α+β+ ϕ+δ+γ

Cdn gain = g = B+E

U.S. gain = ϕ+δ = A

Complete Canada-U.S. Lumber Trade Model

SPE Model: Mathematical Formulation

s.t. iqij ≤ qj, j (region cannot export more than supply)

jqij qi, i (regional demands satisfied)

qi, qj, qij 0 (non-negativity)

qij = sales by region j to region i,

tij = unit transport cost from region j to region i,

X selling regions; M buying regions (X≠M, i may equal j)

jiqtqbqa

qqZqqq

M

i

X

j

ijij

X

j

jjjj

M

i

iiii

ijji

,,)5.0(

)5.0(,,

Max

1 11

2

1

2

Solution Exists IF:

1. Each region’s demand is downward sloping

2. Each region’s supply is upward sloping

3. Linear demand and supply → quadratic

program

4. Z is strictly concave in qi and qj, concave in

qij, and bounded from above.

October 18, 2012 17

Solution exists and is unique in terms of qi

and qj, but not necessarily for qij

(see Takayama & Judge p.142)

Example:

Trade between Europe, Japan & U.S. (Ch 13, McCarl & Spreen)

Supplies: Ps,U = 25 + Qs,U (Only U.S. & Europe Ps,E = 35 + Qs,E supply commodity)

Demands: Pd,U = 150 – Qd,U

Pd,E = 155 – Qd,E

Pd,J = 160 – Qd,J

Transport costs: U.S.–Europe = 3 (both directions)

U.S.–Japan = 4

Europe–Japan = 5

October 18, 2012 18

GAMS file available here

October 18, 2012 23

quantity shadow price

US .demand 46.400 103.600

US .supply 78.600 103.600

EUROPE.demand 50.400 104.600

EUROPE.supply 69.600 104.600

JAPAN .demand 51.400 108.600

Sales to → US EUROPE JAPAN

from

US 46.40 0 32.20

EUROPE 0 50.40 19.20

Objective value = 9193.60

Reduced cost: US to Europe = -4

Europe to US = -2

All others = 0

Undistorted No-Trade Quota Tax/Subsidy

Objective 9193.6 7506.3 8761.6 9178.6

U.S. Demand 45.4 62.5 61.5 46.4

U.S. Supply 9.6 62.5 63.5 78.6

U.S. Price 104.6 87.5 88.5 103.6

Europe Demand 51.4 60 40.7 50.4

Europe Supply 68.6 60 79.3 69.6

Europe Price 103.6 95 114.3 104.6

Japan Demand 51.4 0 40.7 51.4

Japan Price 108.6 160 119.3 108.6

Scenario Analysis