(!****************************************************** *******************************************************!) model "Optimal Slot Allocation" uses "mmxprs" parameters CP = 3350 ! The operational capacity of the vessel (unit: TEU) DW = 36510 ! The deadweight tonnage of the vessel (unit: ton RF = 200 ! The maximum reefer plug number of the vessel FE = 1135 ! The maximum number of 40' containers loaded by the vessel end-parameters declarations LOAD = {"SIN","HKG","KEL","TYO","NGO","UKB","KHH"} ! Loading ports UNLOAD = {"RTM","FXT","BRV","LEH"} ! Discharging port CONT1 = {"DC20","RC20"} ! Container type: 20' dry container, 20' reefer conatiner CONT2 = {"DC40","RC40"} ! Container type: 40' dry container, 40' reefer container CONT3 = {"RC20","RC40"} CONT = CONT1 + CONT2 PORT = LOAD + UNLOAD MC: array(LOAD,UNLOAD,CONT) of integer ! Marginal contribution of each k-type container delivered from loading port i to dischatging port j FR: array(LOAD,UNLOAD,CONT) of integer ! Freight Revenue of each k-type container delivered from loading port i to discharging port j VC: array(LOAD,UNLOAD,CONT) of integer ! Variable costs of each k-type container delivered from loading port i to discharging port j EC: array(LOAD,UNLOAD,CONT) of integer ! Repositioning cost of each k-type empty container delivered between port i and port j IM: array(LOAD,UNLOAD,CONT) of real ! Imbalance factors of k-type container delivered from loading port i to discharging port j F: array(PORT,PORT,CONT) of integer ! The k-type container flow from loading port i to dischatginh port j during a period of time WF: array(LOAD,UNLOAD,CONT) of integer ! The average total weight (tons) of each k-type loaded container delivered from loading port i to discharging port j WE: array(CONT) of real ! The tare weight (tons) of each k-type empty container DL: array(LOAD,UNLOAD,CONT) of integer ! The minimum contracted k-type slot number of the agent at port i to port j DU: array(LOAD,UNLOAD,CONT) of integer ! The maximum k-type slot number of cargo demand at port i to port j CI: array(UNLOAD,CONT) of integer ! The repositioning demand of k-type containers to be supplied port j xf: array(LOAD,UNLOAD,CONT) of mpvar ! Slot allocating number of k-type loaded containers shipped from loading port i to discharging port j xe: array(LOAD,UNLOAD,CONT) of mpvar ! Slot allocating number of k-type empty containers shipped from loading port i to discharging port j status:array({XPRS_OPT,XPRS_UNF,XPRS_INF,XPRS_UNB}) of string end-declarations initializations from 'slotAllocShipp.dat' FR VC EC F WF DL DU CI WE end-initializations forall(i in LOAD, j in UNLOAD, k in CONT) do MC(i,j,k) := FR(i,j,k) - VC(i,j,k) if (F(i,j,k) > F(j,i,k)) then IM(i,j,k) := (F(i,j,k) - F(j,i,k))/F(i,j,k) else IM(i,j,k) := 0 end-if end-do !Objective: maximize Total freight contribution (freight revenue minus variable costs) from the shipment Contrib := sum(i in LOAD, j in UNLOAD, k in CONT) ((MC(i,j,k) - IM(i,j,k)*EC(i,j,k))*xf(i,j,k) - EC(i,j,k)*xe(i,j,k)) !Vessel capacity constarints VessOpCap := sum(i in LOAD, j in UNLOAD, k in CONT1) (xf(i,j,k) + xe(i,j,k)) + 2*sum(i in LOAD, j in UNLOAD, k in CONT2) (xf(i,j,k) + xe(i,j,k)) <= CP VessDeadTon := sum(i in LOAD, j in UNLOAD, k in CONT) (WF(i,j,k)*xf(i,j,k) + WE(k)*xe(i,j,k)) <= DW !Vessel specification constraints ReefCont := sum(i in LOAD, j in UNLOAD, k in CONT3) xf(i,j,k) <= RF Cont40 := sum(i in LOAD, j in UNLOAD, k in CONT2) (xf(i,j,k) + xe(i,j,k)) <= FE !Cargo demand constraints forall(i in LOAD, j in UNLOAD, k in CONT) do xf(i,j,k) >= DL(i,j,k) xf(i,j,k) <= DU(i,j,k) end-do !Repositioning container demand constraints forall(j in UNLOAD, k in CONT) sum(i in LOAD) xe(i,j,k) >= CI(j,k) ! All variables are integer forall(i in LOAD, j in UNLOAD, k in CONT) do xf(i,j,k) is_integer xe(i,j,k) is_integer end-do maximize(Contrib) ! Solve the MIP-problem !status::["Optimum found","Unfinished","Infeasible","Unbounded"] ! Print out the solution writeln("Solution:\n Objective: ", getobjval,",",status(getprobstat)) forall(k in CONT, i in LOAD, j in UNLOAD) do writeln("xf(",i,", ",j,", ",k,"): ", getsol(xf(i,j,k))) end-do forall(k in CONT, i in LOAD, j in UNLOAD) do writeln("xe(",i,", ",j,", ",k,"): ", getsol(xe(i,j,k))) end-do end-model