```\$ontext

Dear GAMS users,

I want to add a constraint to a simple MPSGE
model in which the activity level of some sector
in period t+1 depends on the activity level of
another sector in period.  The idea is that this
sector ("old") is perfectly substitutable to
another sector ("new") in the production of some
good ("total"). One can interpret "old" as the
surviving portion of "total" (a simplified
vintage approach). In the counterfactual, i want
to increase the 'survival share'. The solution
should be simple: a bit more "old", a little less
"new", same "total".

Any suggestions?

\$offtext

\$TITLE Ramsey Model: Incorporating Extant and New Vintage Capital

SET     T /0*50/
SET	TL(T) /0,10,20,30,40,50/;
SET     TFIRST(T), TLAST(T);
TFIRST(T) = YES\$(ORD(T) EQ 1);
TLAST(T)  = YES\$(ORD(T) EQ CARD(T));

SCALAR
G	Baseline growth rate			/0.02/,
IR	Baseline steady-state interest rate     /0.05/,
K0	Capital-output ratio			/3.00/,
DELTA	Depreciation rate for new capital	/0.07/,
DELTAX	Depreciation rate for extant capital	/0.07/,
I0      Base year investment,
L0      Base year labor input,
C0      Base year consumption,
KVS     Base year capital value share;

I0 = (DELTA + G) * K0;
L0 = 1 - K0 * (DELTA + IR);
C0 = 1 - (DELTA + G) * K0;
KVS = K0 * (DELTA + IR);

PARAMETER	QREF(T)		Reference quantity path,
PREF(T)		Reference price path;

QREF(T) = (1+G)**(ORD(T)-1);
PREF(T) = (1/(1+IR))**(ORD(T)-1);

PARAMETER ALPHA;
ALPHA(T) = ((1+G)/(1+IR))**(ORD(T)-1);
ALPHA(TLAST) = ALPHA(TLAST) / (1-(1+G)/(1+IR));

\$ONTEXT
\$MODEL:RAMSEY

\$SECTORS:
X(T)		! Output from extant (old) vintage capital
Y(T)		! Output new vintage capital
I(T)		! Investment in new capital
K(T)		! New vintage Capital stock

\$COMMODITIES:
P(T)		! Output price
RKX(T)		! Return to extant (old) capital
PK(T)		! Capital price
PL(T)		! Wage rate
PKT		! Terminal capital

\$CONSUMERS:
RA		! Representative agent

\$AUXILIARY:
TK		! Post-terminal capital stock

\$PROD:X(T) s:1
O:P(T)          Q:1
I:PL(T)         Q:L0
I:RKX(T)        Q:K0    P:(DELTA+IR)

\$PROD:Y(T) s:1
O:P(T)          Q:1
I:PL(T)         Q:L0
I:RK(T)         Q:K0    P:(DELTA+IR)

\$PROD:K(T)
O:PK(T+1)       Q:(1-DELTA)
O:PKT\$TLAST(T)  Q:(1-DELTA)
O:RK(T)         Q:1
I:PK(T)         Q:1

\$PROD:I(T)
O:PK(T+1)       Q:1
O:PKT\$TLAST(T)  Q:1
I:P(T)          Q:1

\$DEMAND:RA  s:1
D:P(T)		Q:(QREF(T)*C0)	P:PREF(T)
E:PL(T)         Q:(L0*QREF(T))
E:PK(TFIRST)    Q:(0.1*K0)
E:RKX(T)	Q:(0.9*K0*(1-deltax)**(ord(t)-1))
E:PKT		Q:-1		R:TK

\$REPORT:
V:C(T)  D:P(T)  DEMAND:RA

\$CONSTRAINT:TK
SUM(T\$TLAST(T+1),  I(T+1)/I(T) - Y(T+1)/Y(T)) =E= 0;

\$OFFTEXT
\$SYSINCLUDE mpsgeset RAMSEY

Y.L(T)  = QREF(T);
X.L(T)  = QREF(T);
I.L(T)  = I0 * QREF(T);
K.L(T)  = K0 * QREF(T);
P.L(T)  = PREF(T);
RK.L(T) = PREF(T) * (DELTA+IR);
PK.L(T) = PREF(T) * (1+IR);
PL.L(T) = PREF(T);
PKT.L   = SUM(TLAST, PREF(TLAST));
TK.L    = K0 * (1+G)**CARD(T);

RAMSEY.ITERLIM = 1000;
\$INCLUDE RAMSEY.GEN
SOLVE RAMSEY USING MCP;

PARAMETER	BAU	Baseline values;
BAU(T,"X") = X.L(T);
BAU(T,"Y") = Y.L(T);
BAU(T,"I") = I.L(T);
BAU(T,"K") = K.L(T);
BAU(T,"C") = C.L(T);

*	Model an unanticipated permanent change
*	in the depreciation rate for extant capital
*	from 7% per annum to 6% per annum:

DELTAX = 0.06;
\$INCLUDE RAMSEY.GEN
SOLVE RAMSEY USING MCP;

PARAMETER	IMPACT		Percentage changes;

IMPACT(T,"Y") = 100 * (Y.L(T)/BAU(T,"Y")-1);
IMPACT(T,"I") = 100 * (I.L(T)/BAU(T,"I")-1);
IMPACT(T,"K") = 100 * (K.L(T)/BAU(T,"K")-1);
IMPACT(T,"C") = 100 * (C.L(T)/BAU(T,"C")-1);
\$SETGLOBAL DOMAIN T
\$SETGLOBAL LABELS TL
\$LIBINCLUDE PLOT IMPACT

```