# Ship Scheduling Algorithm Based on Markov-Modulated Fluid Priority Queues
## 3 Problem Modeling and Algorithm Modeling
### Waiting Time Analysis
``` BEGIN  Determine_CTMC_model(Q,R1,R2,R3)  Build_system_parameters ()  K = 3  d = 4  R_plus=array(K) \(\pi\)=solve(\(\pi\)Q==0,sum(\(\pi\))==1)  for k from 1 to K  R_plus[k]=sum(R(I) for l from k to K)  end  END Build_system_parameters  Analyze_workload(R_plus,Q,d)  for k from 1 to K  C=R_plus[k]/d-I  (kappa[k],K_matrix[k],A_matrix[k])=Solve_steady_density(C,Q)  alpha[k] = kappa[k] * A_matrix[k] * inv(-K_matrix[k])  end  END Analyze_workload  Analyze_queue_length()  for k from 1 to K  fX_star=Compute_departure_lst(kappa[k],Q,R_plus[k],d)  mean_X[k]=-Derivative(fX_star,s)  Phi_n=Compute_erlang_approx(n,k)  lambda_k=\(\pi\)*R^(k+)*Ones_vector()  fY_star[k]=Solve_lst_equation(fX_star,s*R_plus[k]-Q,lambda_k*s)  mean_Y[k]=-Derivative(fY_star[k],s)  end  END Analyze_queue_length  Analyze_waiting_time()  for k form l to K  fT_star=Compute_waiting_lst(kappa[k],Q,R_plus[k],d)  mean_T[k]=-Derivative(fT_star)  FT_n[k]=alpha_k*Ones_vector()+kappa_k*Phi_n*Ones_vector()  end  END Analyze_waiting_time  Generate_optimization_strategy()  if mean_T[k]>threshold_urgent then  d=High(d)  else if mean_Y[1]>queue_threshold_Llow then  update_Q_matrix(Q)  end  END Generate_optimization_strategy  END

## 4 Experiments and Simulations

In order to verify the applicability and performance advantages of SSA-BMMFFQ proposed in this paper in ship anchorage scheduling, experiments are conducted to analyze the three dimensions of the waiting time, anchorage utilization, and priority scheduling mechanism and evaluate the computational efficiency and scheduling effect in a complex environment. The experimental environment is a 64-bit Windows system with an Intel Core i9-11900K processor and 64 GB memory. The program is based on MATLAB R2019b. We compare the average waiting times of LP, GA, RL, M/G/1/1, and SSA-BMMFFQ. In the experiment, the system performance under a fixed service rate and dynamic state adjustment service rate is further compared, and a priority weight mechanism is introduced to investigate its effect on mitigating scheduling imbalances and improving service fairness, thus verifying the feasibility and scheduling advantages of SSA-BMMFFQ in ship anchorage systems. ### Experimental Parameter Setting

In this study, numerical experiments are conducted to simulate port operation scenarios, and an ideal ship arrival and anchorage state transition model is constructed to obtain data. The parameters of the model are set according to specific rules and assumptions, which are used to fit the ship arrival data generated by simulations and the preset state transition rules. The performance advantage of the algorithm in dynamic scheduling is verified by theoretical model numerical derivation. The model parameters have been scientifically configured as detailed in Table 3.

\begin{table}
\begin{tabular}{l c c} \hline \hline
**Parameter Category** & **Value** & **Implication** \\ \hline Service rate & d = 4 & Number of ships served by anchorage \\ Arrival rate matrix of the first & \(\mathbf{R}^{(1)}= \begin{bmatrix}1&&\\ &0&\\ &&2&\\ &&&1\end{bmatrix} \) & The arrival rate of Class 1 ships is such that the first 1 indicates that, in the first condition, Class 1 ships arrive at 1 ship per hour; 2 indicates that, in the third condition, Class 1 ships arrive at 2 ships per hour, etc. \\ Arrival rate matrix of the second & \(\mathbf{R}^{(2)}= \begin{bmatrix}2&&\\ &0&\\ &&4&\\ &&&1\end{bmatrix} \) & As above \\ Arrival rate matrix of the third & \(\mathbf{R}^{(3)}= \begin{bmatrix}4.5&&\\ &&1&\\ &&0&\\ &&&2\end{bmatrix} \) & As above \\ Anchorage state transition matrix & \(Q= \begin{bmatrix}-8&5&0&3\\ 3&-4&0&1\\ 4&6&-10&0\\ 2&3&10&-15\end{bmatrix} \) & \(Q\) is a 4-times-4 square matrix, which means the system has 4 states. For example, \(Q_{11}=-8\), and the absolute value of it indicates that the average number of times that the system leaves state 1 per unit time is 8 times