FICO
FICO Xpress Optimization Examples Repository
FICO Optimization Community FICO Xpress Optimization Home
Back to examples browserPrevious example

Local authorities and public services

Description
Problem name and type, featuresDifficultyRelated examples
J‑1 Water conveyance / water supply management: Maximum flow problem ** j1water_graph.mos, g1rely.mos
encoding of arcs, selection with `|', record data structure
J‑2 CCTV surveillance: Maximum vertex cover problem ** j2bigbro_graph.mos, g6transmit.mos, d5cutsh.mos
encoding of network, exists
J‑3 Rigging elections: Partitioning problem **** j3elect_graph.mos, partitioning_graph.mos
algorithm for data preprocessing; file inclusion, 3 nested/recursive procedures, working with sets, if-then, forall-do, exists, finalize
J‑4 Gritting roads: Directed Chinese postman problem **** j4grit_graph.mos
algorithm for finding Eulerian path/graph for printing; encoding of arcs, dynamic array, exists, 2 functions implementing Eulerian circuit algorithm, round, getsize, break, while-do, if-then-else, list handling
J‑5 Location of income tax offices: p-median problem ****
modeling an implication, all-pairs shortest path algorithm (Floyd-Warshall); dynamic array, exists, procedure for shortest path algorithm, forall-do, if-then, selection with `|'
J‑6 Efficiency of hospitals: Data Envelopment Analysis (DEA) ***
description of DEA method; loop over problem solving with complete re-definition of problem every time, naming and declaring constraints


Further explanation of this example: 'Applications of optimization with Xpress-MP', Chapter 15: Local authorities and public services

mosel_app_10.zip[download all files]

Source Files

Data Files





j6hospit.mos

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

   file j6hospit.mos
   `````````````````
   Compare the efficiency of hospitals (DEA method)

   A city aims to measure the efficiency of four major 
   hospitals to improve the service to the public. The method 
   suggested to measure the efficiency is DEA (Data Envelopment
   Analysis) where a mathematical model is solved to find the 
   efficiency for each hospital. Three initial indicators 
   (resources) are considered as well as four final indicators
   (services). Use the DEA method to assess how hospital H2 
   performs in comparison with the others.

   The DEA method is implemented. The mathematical model that
   calculates the efficiency is solved for every hospital by 
   using a loop. The constraints need to be named in order 
   to be able to overwrite their definition in every loop 
   iteration (an explicit declaration as 'linctr' is optional,
   but it is recommended for efficiency reasons in this example).

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

model "J-6 Hospital efficiency"
 uses "mmxprs"

 declarations
  HOSP = 1..4                           ! Set of hospitals
  SERV: set of string                   ! Service indicators
  RES: set of string                    ! Resource indicators

  INDSERV: array(SERV,HOSP) of real     ! Service indicator values
  INDRES: array(RES,HOSP) of real       ! Resource indicator values
 end-declarations

 initializations from 'j6hospit.dat'
  INDSERV INDRES
 end-initializations

 declarations
  eff: mpvar                            ! Efficiency value
  coef: array(HOSP) of mpvar            ! Coefficients for DEA method
  fserv: array(SERV) of mpvar           ! Service indicator of fict. hospital
  fres: array(RES) of mpvar             ! Resource indicator of fict. hospit.
  LimServ: array(SERV) of linctr        ! Hospital-specific service constr.
  LimRes: array(RES) of linctr          ! Hospital-specific resource constr.
 end-declarations

! DEA coefficients
 sum(h in HOSP) coef(h) = 1
 
! Relations between service and resource indicators
 forall(s in SERV) fserv(s) = sum(h in HOSP) INDSERV(s,h)*coef(h)
 forall(r in RES) fres(r) = sum(h in HOSP) INDRES(r,h)*coef(h)

! Solve the problem for every hospital
 forall(h in HOSP) do
 ! Limits on services and resources for the hospital currently looked at
  forall(s in SERV) LimServ(s):= fserv(s) >= INDSERV(s,h)  
  forall(r in RES) LimRes(r):= fres(r) <= INDRES(r,h)*eff  
 
 ! Minimize efficiency index
  minimize(eff)
  writeln("Evaluation of hospital ", h, ": ", getobjval)
 end-do

end-model

Back to examples browserPrevious example