+{Page}StateTransition ! 2 Initializations /02/06/2003 20:05:38.572 !---------------------------------------- +{Object.2} StateTransition.[2]Initializations +{Trans} {nop.P}Trans:{&T.West = 1; &T.AirPort = 2; &T.East = 3}... &T.Bases = 3 &R.MaxCycles = 5 !---------------------------------------- CALL OpenTableFile(21,WithPath("tables.HTM")) call GetTable(21,{Table.D}TransProb) call GetTable(21,{Table.10}Bases) close(21) !---------------------------------------- !Get starting number of cars at each base. Different tables could be set... !up for base names and cars at each base, avoiding the reads below, but... !in organizing data in tables, including cars at each base along with ... !base names appears better read({t.10}Bases(&T.West,2),*)dblCurrentlyAt(&T.West) read({t.10}Bases(&T.AirPort,2),*)dblCurrentlyAt(&T.AirPort) read({t.10}Bases(&T.East,2),*)dblCurrentlyAt(&T.East) !---------------------------------------- &I.ResultsFile = 21 open(&I.ResultsFile,file=trim(Path())//"ResultsP2.TXT",action="write") !---------------------------------------- write(&I.ResultsFile,'(A)')"Vehicles Migration in a Rental Operation" write(&I.ResultsFile,'(A)')"----------------------------------------" write(&I.ResultsFile,*) !---------------------------------------- &R.Cycles = -1 &L.EndCycles = logNo !Whether required Cycles are complete &R.Day = -1 &R.MaxOrigDestinPairs = &T.Bases ** 2 CALL ChangeConvergenceRequirement({Object.7},&R.MaxOrigDestinPairs) -{Trans} -{Object.2} StateTransition.[2]Initializations !---------------------------------------- +{Object.5} StateTransition.[5]Cars rented--->|Cars returned +{Branch} {nop.L}Branch={.NOT.&L.EndCycles} -{Branch} +{Trans} {nop.P}Trans:{@T.Base = &T.AirPort} -{Trans} -{Object.5} StateTransition.[5]Cars rented--->|Cars returned !---------------------------------------- +{Object.6} StateTransition.[6]Cars rented--->|Cars returned +{Branch} {nop.L}Branch={.NOT.&L.EndCycles} -{Branch} +{Trans} {nop.P}Trans:{@T.Base = &T.East} -{Trans} -{Object.6} StateTransition.[6]Cars rented--->|Cars returned !---------------------------------------- +{Object.7} StateTransition.[7]Cars rented INTEGER(tny):: tnyIndx +{Trans} !---------------------------------------- write(9,*)"Where the cars are at end of day",Time() write(9,*)(trim({t.10}Bases(tnyIndx,1)), & dblCurrentlyAt(tnyIndx),tnyIndx=1,&T.Bases) !---------------------------------------- &R.Day = &R.Day + 1 write(&I.ResultsFile,*)"Location of cars at end of day",&R.Day do tnyIndx = 1,&T.Bases write(&I.ResultsFile,*){t.10}Bases(tnyIndx,1)//" ", & dblCurrentlyAt(tnyIndx) end do write(&I.ResultsFile,*)REPEAT("-",32) !---------------------------------------- &R.Cycles = &R.Cycles + 1 &L.EndCycles = &R.Cycles == &R.MaxCycles dblPreviouslyAt(:) = dblCurrentlyAt(:) !applies to all elements of vector dblCurrentlyAt(:) = 0. !Sets all elements of vector dblCurrentlyAt to zero -{Trans} -{Object.7} StateTransition.[7]Cars rented !---------------------------------------- +{Object.8} StateTransition.[8]Cars rented--->|Cars returned +{Branch} {nop.L}Branch={.NOT.&L.EndCycles} -{Branch} +{Trans} {nop.P}Trans:{@T.Base = &T.West} -{Trans} -{Object.8} StateTransition.[8]Cars rented--->|Cars returned !---------------------------------------- +{Object.9} StateTransition.[9]Cars returned-->>|Cars rented +{Trans} {nop.P}Trans:{@T.NewBase = &T.West}... call RentalReturns(@T.Base,@T.NewBase) -{Trans} +{Duration} {nop.D}Duration={1} -{Duration} +{Flow} {nop.P}Flow:{0;$D.BigM;1;0;regTotBases} -{Flow} -{Object.9} StateTransition.[9]Cars returned-->>|Cars rented !---------------------------------------- +{Object.10} StateTransition.[10]Cars returned-->>|Cars rented +{Trans} {nop.P}Trans:{@T.NewBase = &T.AirPort}... call RentalReturns(@T.Base,@T.NewBase) -{Trans} +{Duration} {nop.D}Duration={1} -{Duration} +{Flow} {nop.P}Flow:{0;$D.BigM;1;0;regTotBases} -{Flow} -{Object.10} StateTransition.[10]Cars returned-->>|Cars rented !---------------------------------------- +{Object.11} StateTransition.[11]Cars returned-->>|Cars rented +{Trans} {nop.P}Trans:{@T.NewBase = &T.East}... call RentalReturns(@T.Base,@T.NewBase) -{Trans} +{Duration} {nop.D}Duration={1} -{Duration} +{Flow} {nop.P}Flow:{0;$D.BigM;1;0;regTotBases} -{Flow} -{Object.11} StateTransition.[11]Cars returned-->>|Cars rented -{Page}StateTransition //////////////////////////////////////////