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

Source Files

Data Files

h6expand.mos

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

file h6expand.mos
`````````````````
Planning the expansion of a company

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

model "H-6 Expansion"
uses "mmxprs"

forward procedure print_sol

declarations
PROJECTS = 1..5                     ! Set of possible projects
TIME = 1..5                         ! Planning period

COST: array(PROJECTS,TIME) of real  ! Annual costs of projects
CAP: array(TIME) of real            ! Annually available capital
RET: array(PROJECTS) of real        ! Estimated profits
DESCR: array(PROJECTS) of string    ! Description of projects

choose: array(PROJECTS) of mpvar    ! 1 if project is chosen, 0 otherwise
end-declarations

initializations from 'h6expand.dat'
COST CAP RET DESCR
end-initializations

! Objective: Total profit
Profit:= sum(p in PROJECTS) RET(p)*choose(p)

! Limit on capital availability
forall(t in TIME) sum(p  in PROJECTS) COST(p,t)*choose(p) <= CAP(t)

forall(p in PROJECTS) choose(p) is_binary

! Solve the problem
maximize(XPRS_LIN, Profit)
write("LP solution: ")
print_sol

maximize(Profit)
write("MIP solution: ")
print_sol

! Force acceptance of project 1
choose(1)=1

maximize(Profit)
write("Forcing project 1 (", DESCR(1), "): ")
print_sol

!-----------------------------------------------------------------

! Solution printing
procedure print_sol
writeln("Total profit: ", getobjval)
forall(p in PROJECTS)
if(getsol(choose(p))>0) then
writeln(" ", DESCR(p), " (", getsol(choose(p)),")")
end-if
end-procedure

end-model

```