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, featuresDifficultyRelated examples
H‑1 Choice of loans *
calculation of net present value
H‑2 Publicity campaign *
forall-do
H‑3 Portfolio selection ** h7qportf.mos
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 ** capbgt_graph.mos
experiment with solutions: solve LP problem explicitly, ``round'' some almost integer variable and re-solve
H‑7 Mean variance portfolio selection: Quadratic Programming problem *** folioqp_graph.mos
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
  
   A company launches a new product and reaches out to a 
   publicity agency to develop a publicity campaign. A 
   maximum budget is defined for this campaign. For each 
   media type (e.g., radio, tv, newspaper, etc.), there are
   the people potentially reached, the cost, the maximum use, 
   and the index of perception quality. The campaign must 
   reach at least a given number of people. Which media should
   be chosen and in which proportions (i.e., number of uses) 
   to maximize the total sum of indexes of perception quality?
  
   This problem is represented with a simple IP model. 
   The model is implemented in a generic way (using 
   data arrays read from file) to make modifying the input 
   data easier for future extensions and data instances.

   (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