$ondollar title IFS Cash Flow (LP) Example 4.6 of Rardin (1998) $offsymxref offsymlist offuelxref offuellist offupper option limrow = 0, limcol = 0; set t "weeks" /1*8/; parameter s(t) "projected sales in week t" /1 600, 2 750, 3 1200, 4 2100, 5 2250, 6 180, 7 330, 8 540/; parameter r(t) "projected accounts receivable in week t" /1 770, 2 1260, 3 1400, 4 1750, 5 2800, 6 4900, 7 5250, 8 420/; parameter p(t) "projected accounts payable in week t" /1 3200, 2 5600, 3 6000, 4 480, 5 880, 6 1440, 7 1600, 8 2000/; parameter e(t) "projected expenses in week t" /1 350, 2 400, 3 550, 4 940, 5 990, 6 350, 7 350, 8 410/; scalars locint "line of credit interest per week" /.002/, loclim "line of credit limit" /4000/, loccsh "fraction of current line of credit kept on hand" /.20/, safety "minimum cash on hand in checking" /20/, apdisc "accounts payable discount if paid early" /.02/, mmint "money market interest rate per week" /.001/; free variable netint "net total interest paid"; positive variables g(t) "amount borrowed in week t on line of credit", h(t) "amount of line of credit paid off in week t", w(t) "amount of week t accts payable delayed to t+3", x(t) "amount invested in money markets during week t", y(t) "cummulative line of credit debt in week t", z(t) "cash on hand during week t"; equations obj "minimize net total interest paid", cashbal(t) "cash balance in week t", debtbal(t) "debt balance in week t", credlim(t) "credit limit in week t", locrule(t) "line of credit on hand rule in week t", aplimit(t) "accounts payable limit in week t", safecash(t) "cash safety limit in week t"; obj.. netint =e= locint * sum(t, y(t)) + apdisc * sum(t, w(t)) - mmint * sum(t, x(t)); cashbal(t).. z(t-1) + g(t) - h(t) + x(t-1) - x(t) + mmint*x(t-1) - locint*y(t-1) + s(t) - e(t) + r(t) - (1-apdisc)*(p(t) - w(t)) - w(t-3) =e= z(t); debtbal(t).. y(t-1) + g(t) - h(t) =e= y(t); credlim(t).. y(t) =l= loclim; locrule(t).. z(t) =g= .20*y(t); aplimit(t).. w(t) =l= p(t); safecash(t).. z(t) =g= safety; model ifscash /all/; solve ifscash using lp minimizing netint;