process CUSTOMER

define REQUEST.TIME,
       X,
       Y,
       DISTANCE as double variables

define SEGID,
       I,
       INDEX as integer variables


let REQUEST.TIME = TIME.V

call DRAW.RANDOM.POINT given CUSTOMER.MARKTYPE yielding X, Y, SEGID

request 1 TAXI.RESOURCE

for I = 1 to .NUM.TAXIS with STATUS(TAXI(I)) = .IDLE
    compute DISTANCE as the MIN, INDEX as the MIN(I) of
    DISTANCE.FROM.TAXI(TAXI(I), X, Y)

let STATUS(TAXI(INDEX)) = .BUSY

call TRAVEL given TAXI(INDEX), X, Y, DISTANCE
call DELETE.SEG.R(SEGID)

let WAITING.TIME = (TIME.V - REQUEST.TIME) * HOURS.V * MINUTES.V -
LOADING.UNLOADING.TIME

call DRAW.RANDOM.POINT given DESTINATION.MARKTYPE yielding X, Y, SEGID

let DISTANCE = DISTANCE.FROM.TAXI(TAXI(INDEX), X, Y)

call TRAVEL given TAXI(INDEX), X, Y, DISTANCE
call DELETE.SEG.R(SEGID)

add DISTANCE + FLAT.FEE to REVENUE(INDEX)
display REVENUE

let STATUS(TAXI(INDEX)) = .IDLE

relinquish 1 TAXI.RESOURCE

end
