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





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

Back to examples browserPrevious exampleNext example