# Nash-Cournot(mcp) to Stackelber(mpec), same output.

47 views

### Vegard Skonseng Bjerketvedt

Apr 22, 2016, 9:59:41 AM4/22/16
to gamsworld
Hey.

My Nash-Cournot (mcp) and Stackelberg (mpec) gives the same output. This is definitely wrong.
Both models have the same constraints and parameters.

In the Stackelberg model the profit-function is the object-function.
The KKT-conditons from the Nash-Cournot model is adapted to the Stackelberg model
for the follwers, firm 1 and 3. Is this correct?
Why do my Stackelberg model end up as the Nash-Cournot?

The Nash-Cournot model should and gives the output:
x(i,b): produced by i with technology b
x(1,1) = 21 000 x(1,2) = 12 200
x(2,1) = 17 000 x(2,2) = 0
x(3,1) = 18 000 x(3,2) = 0

The Stackelberg model gives the same, but should give:
x(1,1) = 21 000 x(1,2) = 16 000
x(2,1) = 17 000 x(2,2) = 0
x(3,1) = 18 000 x(3,2) = 0

Nash-Cournot
*Linear inverse demand function with 3 price-making firms
*Transmission contraint

Sets
i firms /i1, i2, i3 /
n node /n1, n2, n3 /
b production tech /b1, b2 /
alias(i,j)

TABLE C(i,b) variable costs
b1      b2
i1       0.55    0.81
i2       0.62    1.25
i3       0.78    1.35

TABLE K(i,b) peocess capacities

b1      b2
i1       21000    16000
i2       17000    22000
i3       18000    14000

TABLE T(i,n) peocess capacities

n1      n2       n3
i1       1000000  1000000  1000000
i2       1000000  1000000  1000000
i3       1000000  1000000  1000000

PARAMETERS alpha(n) inverse demand intercept node n
/n1 2.5, n2 2.5, n3 2.5/ ;
PARAMETERS beta(n) inverse demand slope node n
/n1 0.00005, n2 0.00005, n3 0.00005/ ;

POSITiVE VARIABLES
x(i,b) production by i with tech b
z(i,n) sold fom firm i to node n
q(n) demand quant in node n
gamma(i,b) dual of capacity constraint
omega(i,n) dual til transmisjons constraint
theta(i) dual
;

EQUATIONS

Cap(i,b) Production capacity
Trans(i,n) Transsmision capacity
Salg(i) Sold
KKTx(i,b) KKTcondition (MR=MC)
KKTz(i,n) KKTcondition
Demand(n) demand in node n
;

Cap(i,b).. - x(i,b) + K(i,b) =g= 0 ;
Trans(i,n).. - z(i,n) + T(i,n) =g= 0 ;
Salg(i).. - sum(n,z(i,n)) + sum(b,x(i,b)) =g= 0 ;
KKTx(i,b).. C(i,b) + gamma(i,b) - theta(i) =e= 0 ;
KKTz(i,n).. - alpha(n) + beta(n)*q(n) + beta(n)*z(i,n) + omega(i,n) + theta(i) =e= 0 ;
Demand(n).. q(n) - sum(i,z(i,n)) =e= 0 ;

MODEL

Nash /Cap.gamma, Trans.omega, Salg.theta, KKTx.x, KKTz.z, Demand.q/ ;

Solve

Nash using mcp ;

Stackelberg

Sets
i firms /i1, i2, i3 /
ifol(i) following firms /i1, i3/
b production tech /b1, b2/
n node /n1, n2, n3 /

TABLE C(i,b) variable costs
b1      b2
i1       0.55    0.81
i2       0.62    1.25
i3       0.78    1.35

TABLE K(i,b) peocess capacities

b1      b2
i1       21000    16000
i2       17000    22000
i3       18000    14000

TABLE T(i,n) peocess capacities

n1      n2       n3
i1       1000000  1000000  1000000
i2       1000000  1000000  1000000
i3       1000000  1000000  1000000

PARAMETERS alpha(n) inverse demand intercept node n
/n1 2.5, n2 2.5, n3 2.5/ ;
PARAMETERS beta(n) inverse demand slope node n
/n1 0.00005, n2 0.00005, n3 0.00005/ ;

POSITIVE VARIABLES
x2(b) production by leader from b
z2(n) sold by leder i n
x(ifol, b) production by i from tech b
z(ifol, n) sold av ifol i n
q demanded quantity
gamma(ifol, b) dual of capacity cont for followers
omega(ifol, n) dual of tran cont for followers
theta(ifol) dual til kan ikke selge mer en produsert
;

VARIABLES
NegStackObj negative of Stack objtive
;

EQUATIONS

StackObjDef Stackelberg objective defination
Capacity2(b) upper limmint cap generation for b
Trans2(n) upper limint trans
Salg2 kan ikke selge mer en produsert
Capacity(ifol, b) upper limmit
Trans(ifol, n) upper lim trans
Salg(ifol) kan ikke selge mer en produsert
MarkClear market clearing
KKTx(ifol,b) kktx followers
KKTz(ifol,n) kktz followers

;

StackObjDef.. sum(b, C('i2', b)*x2(b)) - sum(n,(alpha(n) - beta(n)*q(n))*z2(n))
- NegStackObj =e= 0 ;

Capacity2(b).. x2(b) - K('i2', b) =l= 0 ;
Trans2(n).. z2(n) - T('i2', n) =l= 0;
Salg2.. sum(n,z2(n)) - sum(b,x2(b)) =l= 0;

Capacity(ifol, b).. - x(ifol, b) + K(ifol, b) =g= 0 ;
Trans(ifol, n).. - z(ifol, n) + T(ifol, n) =g= 0 ;
Salg(ifol).. - sum(n, z(ifol,n)) + sum(b,x(ifol,b)) =g= 0 ;

MarkClear(n).. q(n) - sum(ifol, z(ifol, n)) - z2(n) =e= 0 ;

KKTx(ifol,b).. C(ifol,b) + gamma(ifol,b) - theta(ifol) =e= 0 ;
KKTz(ifol,n).. - alpha(n) + beta(n)*q(n) + beta(n)*z(ifol,n) + omega(ifol,n)
+ theta(ifol) =e= 0 ;

MODEL Stackelberg
/StackObjDef, Capacity2, Trans2, Salg2, Capacity.gamma, Trans.omega, Salg.theta,
MarkClear, KKTx.x, KKTz.z/ ;
Stackelberg.optfile = 1 ;

SOLVE Stackelberg minimizing NegStackObj using mpec ;

### Michael Ferris

Apr 22, 2016, 1:40:23 PM4/22/16
Attached is a modified version of your model that uses the GAMS EMP framework for solving
these models.   I believe this makes the model much easier to understand.

The only issue is the definition of revenue which is the integral of the inverse demand.
That gives the slightly awkward correction term in objective function.

Cheers, Michael

nashstack.gms
ATT00001.htm