There are three categories of formulas in this model:

1.computing the initial lump sum payment (LUMP),
2.sources=uses constraints, which enforce the condition that all sources of cash in a period must equal uses for cash in a period, and
3.integer restrictions on the BUY variable limiting us to buying only whole numbers of bonds.

The following expression computes the lump outflow of cash in the initial period:

LUMP = NEED( 1) + SINVEST( 1) +

   @SUM( BOND: PRICE * BUY);

Cash is needed for three purposes in the initial period:

1.payment of lottery prizes (NEED( 1)),
2.allocations to short-term money funds (SINVEST( 1)), and
3.bond purchases (@SUM( BOND: PRICE * BUY)).

In the remaining 14 periods, sources of cash must equal uses of cash. We enforce this condition with:

! For subsequent periods;

  @FOR( PERIOD( I)| I #GT# 1:

   @SUM( BOND( J)| MATAT( J) #GE# I:

    CAMNT( J) * BUY( J)) +

   @SUM( BOND( J)| MATAT( J) #EQ# I:

    BUY( J)) +

   ( 1 + STRTE) * SINVEST( I - 1) =

   NEED( I) + SINVEST( I);

  );

The sources of cash in a period are threefold:

1.coupon receipts:

  @SUM( BOND( J)| MATAT( J) #GE# I:

       CAMNT( J) * BUY( J))

2.maturing bonds:

  @SUM( BOND( J)| MATAT( J) #EQ# I:

       BUY( J))

3.maturing short-term investments from the previous period:

  ( 1 + STRTE) * SINVEST( I - 1)

These sources must equal the following two uses:

1.lottery prize payments: NEED( I)
2.new short-term investments SINVEST( I)

Finally, to force bond purchases to be whole numbers we add:

! Can only buy integer bonds;

  @FOR( BOND( J): @GIN( BUY( J)));