FICO Xpress Optimization Examples Repository
 FICO Optimization Community FICO Xpress Optimization Home

Economics and finance

Description
H‑1 H‑2 H‑3 Problem name and type, features Difficulty Choice of loans * calculation of net present value Publicity campaign * forall-do Portfolio selection ** sets of integers, second formulation with semi-continuous, parameters Financing an early retirement scheme ** inline if, selection with `|' Family budget ** formulation of monthly balance constraints including different payment frequencies; as, mod, inline if, selection with `|' Choice of expansion projects ** experiment with solutions: solve LP problem explicitly, ``round'' some almost integer variable and re-solve 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
 h1loan.mos [download] h2publ.mos [download] h3portf.mos [download] h4retire.mos [download] h4retire.mos [download] h6expand.mos [download] h7qportf.mos [download]

Data Files
 h1loan.dat [download] h2publ.dat [download] h3portf.dat [download] h4retire.dat [download] h4retire.dat [download] h6expand.dat [download] h7qportf.dat [download]

h3portf.mos

```(!******************************************************
Mosel Example Problems
======================

file h3portf.mos
````````````````
Composition of an investment portfolio

(c) 2008 Fair Isaac Corporation
author: S. Heipcke, Mar. 2002
*******************************************************!)

model "H-3 Portfolio"
uses "mmxprs"

parameters
MAXTECH = 0.3                     ! Maximum investment into tech. values
MINEU = 0.5                       ! Minimum investment into European shares
VMIN = 5000                       ! Minimum amount for a single value
VMAX = 40000                      ! Maximum amount for a single value
end-parameters

declarations
SHARES = 1..6                     ! Set of shares

RET: array(SHARES) of real        ! Estimated return in investment
CAPITAL: integer                  ! Capital to invest
EU: set of integer                ! European values among the shares
TECHNOLOGY: set of integer        ! Technology values among shares

buy: array(SHARES) of mpvar       ! Amount of values taken into portfolio
end-declarations

initializations from 'h3portf.dat'
RET CAPITAL EU TECHNOLOGY
end-initializations

! Objective: total return
Return:= sum(s in SHARES) RET(s)/100*buy(s)

! Requirements concerning portfolio composition
sum(s in TECHNOLOGY) buy(s) <= MAXTECH*CAPITAL
sum(s in EU) buy(s) >= MINEU*CAPITAL

! Total capital to invest
sum(s in SHARES) buy(s) = CAPITAL

forall(s in SHARES) do
VMIN <= buy(s);
!  buy(s) is_semcont(VMIN)
buy(s) <= VMAX
end-do

! Solve the problem
maximize(Return)

! Solution printing
writeln("Total return: ", getobjval)
forall(s in SHARES) writeln(s, ": ", getsol(buy(s)))

end-model

```