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





h2publ.mos

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

   file h2publ.mos
   ```````````````
   Planning a publicity campaign for a new product
   
   (c) 2008 Fair Isaac Corporation
       author: S. Heipcke, Mar. 2002
*******************************************************!)

model "H-2 Publicity"
 uses "mmxprs"

 declarations
  MEDIA = 1..6                        ! Set of media types
  
  REACH: array(MEDIA) of integer      ! Number of people reached
  COST: array(MEDIA) of integer       ! Unitary cost
  MAXUSE: array(MEDIA) of integer     ! Maximum use
  SCORE: array(MEDIA) of integer      ! Quality rating (best=highest value)
  BUDGET: integer                     ! Available publicity budget
  TARGET: integer                     ! Number of people to be reached
   
  use: array(MEDIA) of mpvar          ! Use made of different media
 end-declarations

 initializations from 'h2publ.dat'
  REACH COST MAXUSE SCORE BUDGET TARGET
 end-initializations

! Objective: quality of perception of the campaign
 Perceive:= sum(m in MEDIA) SCORE(m)*use(m)

! Budgetary limit
 sum(m in MEDIA) COST(m)*use(m) <= BUDGET
 
! Outreach of campaign
 sum(m in MEDIA) REACH(m)*use(m) >= TARGET  

 forall(m in MEDIA) do
  use(m) is_integer
  use(m) <= MAXUSE(m)
 end-do 
 
! Solve the problem
 maximize(Perceive)
 
! Solution printing
 declarations
  NAMES: array(MEDIA) of string
 end-declarations
 
 initializations from 'h2publ.dat'
  NAMES
 end-initializations

 writeln("Perception: ", getobjval, " units (", 
         getsol(sum(m in MEDIA) REACH(m)*use(m)), " people)")
 forall(m in MEDIA) writeln(NAMES(m), ": ", getsol(use(m)))

end-model

Back to examples browserPrevious exampleNext example