(!****************************************************** Mosel Example Problems ====================== file f4hub3.mos ``````````````` Choosing hubs for transatlantic freight (number of hubs specified as a model parameter) (c) 2008 Fair Isaac Corporation author: S. Heipcke, Dec. 2008 *******************************************************!) model "F-4 Hubs (2)" uses "mmxprs" parameters NHUBS = 2 ! Number of hubs end-parameters forward function calc_cost(i,j,k,l:integer):real declarations US = 1..3; EU = 4..6 CITIES = US + EU ! Cities QUANT: array(CITIES,CITIES) of integer ! Quantity to transport DIST: array(CITIES,CITIES) of integer ! Distance between cities FACTOR: real ! Reduction of costs between hubs flow: dynamic array(CITIES,CITIES,CITIES,CITIES) of mpvar ! flow(i,j,k,l)=1 if freight ! from i to j goes via k and l hub: array(CITIES) of mpvar ! 1 if city is a hub, 0 otherwise end-declarations initializations from 'f4hub.dat' QUANT DIST FACTOR end-initializations forall(i,j in CITIES | i0," " + NAMES(i), "")) writeln !----------------------------------------------------------------- ! Transport cost from i to j via hubs k and l function calc_cost(i,j,k,l:integer):real returned:=DIST(i,k)+FACTOR*DIST(k,l)+DIST(l,j) end-function end-model