(!****************************************************** Mosel Example Problems ====================== file h1loan.mos ``````````````` Choice of loans (c) 2008 Fair Isaac Corporation author: S. Heipcke, Mar. 2002 *******************************************************!) model "H-1 Loan choice" uses "mmxprs" declarations BANKS = 1..3 ! Set of banks SHOPS = {"London", "Munich", "Rome"} ! Set of shops DUR: integer ! Duration of loans PRICE: array(SHOPS) of integer ! Price of shops RATE: array(BANKS,SHOPS) of real ! Interest rates offered by banks VMAX: integer ! Maximum loan volume per bank borrow: array(BANKS,SHOPS) of mpvar ! Loan taken from banks per project end-declarations initializations from 'h1loan.dat' PRICE RATE VMAX DUR end-initializations ! Objective: interest payments Interest:= sum(b in BANKS, s in SHOPS) borrow(b,s)*RATE(b,s)/(1-(1+RATE(b,s))^(-DUR)) ! Finance all projects forall(s in SHOPS) sum(b in BANKS) borrow(b,s) = PRICE(s) ! Keep within maximum loan volume per bank forall(b in BANKS) sum(s in SHOPS) borrow(b,s) <= VMAX ! Solve the problem minimize(Interest) ! Solution printing writeln("Total interest: ", getobjval) forall(s in SHOPS) do write("Shop in ", s, ": ") forall(b in BANKS) write( if(getsol(borrow(b,s))>0, " bank " + b + ": " + getsol(borrow(b,s))/1000000 + " million", "")) writeln end-do end-model