! Asset-Liability Management, Deterministic case;
! Each period we can buy and sell a variety of investments,
   and we can borrow or lend for one period at a rate
   specific to the period.
  How should we invest each period?
! Keywords: Financial planning, Asset-Liability management,
  Bonds, Yield curve;
SETS:
 PERIOD: LEND, BORR, RLEND, RBORR, NEED, BORRMX;
 ASSET: HOLDMX, HOLDIN;
 PXA( PERIOD, ASSET): HOLD, BUY, SEL, PBUY, PSEL, PAYOUT;
ENDSETS
DATA: PERIOD = 1..7; ! There are 7 periods; ! External cash needs by period due to previous commitments; NEED = -2000 -500 -400 -380 -360 -340 -300; ! Max we can borrow. Cannot borrow(and not repay) at end; BORRMX = 2000 2000 2000 2000 2000 2000 0; ASSET= F M D; ! Three investments available; HOLDMX= 1 1 1; ! Maximum we can hold of each asset; HOLDIN= 0 0 0; ! Initially we own nothing of anything; PAYOUT= ! Payout or throw-off ; 0 0 0 ! by asset by period; -1000 -500 -2000 -1800 1500 -1800 400 1500 1000 1800 1500 1000 1800 200 1000 5500 -1000 6000; ! Price in period t at which we can buy asset i; PBUY= 3000 2000 2000! Can buy only; 99999 99999 99999 ! in 1st period; 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999; ! Price in period t at which we can sell asset i; PSEL = -999999; ! Cannot sell these investments once made; ! One period lending rate, based on yield curve, circa 2005; RLEND = .0326000 .0390110, .0373007 .0383024 .0393012 .0421093 .0437130; ! One period borrowing rate, assumed half point higher than lending; RBORR = .0376000 .0440110, .0423007 .0433024 .0443012 .0471093 .0487130; ! Punchline: We buy a fair amount of F and M, but nothing of D; ENDDATA ! Variables: BUY(t,i) = units bought at beginning of period t of asset i, SEL(t,i) = units sold at beginning of t of asset i, HOLD(t,i) = units held at end of t of asset i, BORR(t) = amount borrowed at beginning of t, LEND(t) = amount lent at the beginning of t; ! Get index of final period; TF = @SIZE( PERIOD); ! Maximize expected wealth in final period; MAX = NWORTH; NWORTH = @SUM( ASSET(i): PAYOUT(TF,i)*HOLD(TF,i) - PBUY(TF,i) *BUY(TF,i) + PSEL(TF,i) *SEL(TF,i)) + (1 + RLEND(TF-1))*LEND(TF-1) - (1 + RBORR(TF-1))*BORR(TF-1) - NEED(TF); ! First Period; ! Individual asset balances; @FOR( ASSET(i): HOLDIN(i) + BUY(1,i) = SEL(1,i) + HOLD(1,i); HOLD(1,i) <= HOLDMX(i); ); ! Cash balance constraint; ! Cash inflows from investments + borrowings in 1 + asset sales in 1 = asset purchases in 1 + loans made in 1 + external liabilities in 1; @SUM( ASSET(i): PAYOUT(1,i)*HOLDIN(i) + PSEL(1,i)*SEL(1,i)) + BORR(1) = @SUM( ASSET(i):PBUY(1,i)*BUY(1,i)) + LEND(1) + NEED(1); BORR(1) <= BORRMX(1); ! Borrowing limit; ! Same applies for subsequent periods; @FOR( PERIOD( t) | t #GT# 1: ! For each asset type i: Ending inventory in t-1 + purchases = sales + ending inventory in t; @FOR( ASSET( i): HOLD(t-1,i) + BUY(t,i) = SEL(t,i) + HOLD(t,i); HOLD(t,i) <= HOLDMX(i); ); ! Cash inflows from investments + repayments from loans in t-1 + borrowings in t + asset sales in t = asset purchases in t + loans made in t + repayment of borrowings in previous period + external liabilities in t; @SUM( ASSET(i): PAYOUT(t,i)*HOLD(t,i) + PSEL(t,i)*SEL(t,i)) +(1+RLEND(t-1))*LEND(t-1) + BORR(t) = @SUM( ASSET(i): PBUY(t,i)*BUY(t,i)) + (1 + RBORR(t-1))*BORR(t-1) + LEND(t) + NEED(t); BORR(t) <= BORRMX(t); ! Borrowing limit; );