FICO
FICO Xpress Optimization Examples Repository
FICO Optimization Community FICO Xpress Optimization Home
Back to examples browserPrevious exampleNext example

Economics and finance

Description
Problem name and type, featuresDifficulty
H‑1 Choice of loans *
calculation of net present value
H‑2 Publicity campaign *
forall-do
H‑3 Portfolio selection **
sets of integers, second formulation with semi-continuous, parameters
H‑4 Financing an early retirement scheme **
inline if, selection with `|'
H‑5 Family budget **
formulation of monthly balance constraints including different payment frequencies; as, mod, inline if, selection with `|'
H‑6 Choice of expansion projects **
experiment with solutions: solve LP problem explicitly, ``round'' some almost integer variable and re-solve
H‑7 Mean variance portfolio selection: Quadratic Programming problem ***
parameters, forall-do, min, max, loop over problem solving


Further explanation of this example: 'Applications of optimization with Xpress-MP', Chapter 13: Economics and finance problems

mosel_app_8.zip[download all files]

Source Files

Data Files





h1loan.mos

(!******************************************************
   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

Back to examples browserPrevious exampleNext example