2023 May 1 Mathematical Modeling Question B Complete Model Code [Original First Release]

All the content of May Day mathematical modeling has been completed, you can check it at the end of the article! ! For reference use!

Summary

With the popularity and development of online shopping, the demand of the express delivery industry continues to grow. For express delivery companies, it is becoming more and more important to accurately predict transportation demand and rationally plan transportation routes and warehouse layouts. Based on the inter-city express transportation data provided by an express company, this paper establishes a mathematical model to comprehensively rank the importance of the station cities from multiple perspectives, and predict future transportation demand and minimum transportation costs.

First, by processing the express transportation data from April 19, 2018 to April 17, 2019 in Appendix 1, this paper comprehensively considers factors such as shipment volume, receipt volume, growth/decrease trend of express volume, and correlation , established a mathematical model to evaluate the importance of site cities. Get the top 5 station cities with the most important degree, this result can provide a reference for express companies to plan warehouses and transportation routes.

This paper uses the data in Appendix 1 to establish a time series analysis model to predict the number of express delivery between the cities of the "delivery-receipt" sites on April 18 and April 19, 2019, as well as all the "delivery-receipt" sites on that day. ” The total express delivery volume between the site cities. The prediction results are presented in Table 2. Based on the data on the number of express delivery from April 28, 2020 to April 27, 2023 provided in Appendix 2, this paper considers the impact of emergencies on express delivery routes between some cities. By establishing a prediction model, we predicted the city pairs of sites that can normally "deliver-receive" on April 28 and April 29, 2023, and judged whether the specified site city pairs in Table 3 can deliver normally. For the site city pairs that can be shipped normally, we also give the corresponding express delivery quantity.

This paper also considers the impact of the railway transportation network on the transportation cost of express companies. Under the condition of knowing the railway transportation network and its fixed cost and rated loading capacity, we established a mathematical model and solved the transportation plan with the lowest cost. Using the data in Annex 2 and Annex 3, the daily minimum transportation cost of the company from April 23 to 27, 2023 is calculated, by studying the composition of express delivery demand, and dividing it into two parts: fixed demand and non-fixed demand . Using the data in Appendix 2, we built a mathematical model to estimate the constant demand constant by quarter and verified its accuracy. At the same time, a method for estimating the probability distribution of non-stationary demand is given. The fixed demand constant, non-fixed demand mean, and standard deviation of the specified quarter, the specified "delivery-receipt" site city pair, and the sum of fixed demand constants and non-fixed demand of all "shipment-receipt" city pairs in the current quarter Sum of means, sum of standard deviations for non-stationary demands.

Through the in-depth analysis of existing data and the comprehensive use of mathematical models, we have solved the practical problems faced by express companies from multiple perspectives, including ordering the importance of station cities, forecasting future transportation demand, solving the minimum transportation cost, and fixed and non-fixed demand. Analysis of needs. The research results have certain theoretical guiding significance and practical application value, which can provide strong support for express companies, help them optimize their operation strategies, reduce transportation costs, and improve service quality.

Key words: importance of station cities; time series model; transportation cost; fixed demand

1. Restatement of the problem

1.1 Problem Background

With the rapid development of Internet technology and the popularity of e-commerce, online shopping has become an indispensable part of people's lives. This phenomenon has triggered a rapid increase in the demand for express delivery services and has had a profound impact on my country's economic development. In this context, accurately predicting the quantity of express transportation demand and formulating a reasonable transportation strategy is of great significance for the warehouse layout, storage cost saving and transportation route planning of express companies. However, due to various factors such as unexpected events, seasonal factors, and market competition, express delivery demand presents greater volatility, making forecasting and planning more difficult. Therefore, this study aims to solve the practical problems faced by express companies in the transportation process by establishing a mathematical model and analyzing the existing data. This research aims to provide strong support for express companies to help them optimize their operation strategies, reduce transportation costs, and improve service quality.

1.2 Question restatement

1. Through the analysis of multi-angle factors such as shipments, receipts, and express delivery volume growth/decrease trends in the existing data, a mathematical model is established to comprehensively rank the importance of each site city. Through this sorting result, we will be able to understand which station cities are more important to the operation of express companies.

2. Using the existing data, establish a mathematical model to predict the quantity of express transportation between cities of each "delivery-receipt" site in the future. This will help express companies make more reasonable transportation plans, thereby reducing costs and improving operational efficiency.

3. In the event of an emergency, use a mathematical model to predict the city pairs of sites that can be delivered normally and the corresponding express delivery quantities. This will help express companies make more secure transportation decisions in the face of uncertainties.

4. Combining the railway transportation network and transportation cost calculation formula, establish a mathematical model to find out the transportation plan with the lowest cost. This will help courier companies minimize costs during transportation, thereby improving overall profit levels.

5. Analyze express delivery demand from the perspective of fixed demand and non-fixed demand, and estimate the constant of fixed demand and the probability distribution of non-fixed demand on a quarterly basis. This will help express companies better understand the law of demand changes and provide a basis for formulating appropriate transportation strategies.

2. Problem analysis

2.1 Analysis of problem one thinking

In question 1, we need to analyze the existing data and establish a mathematical model to comprehensively rank the importance of each site city from multiple perspectives such as receipt volume, shipment volume, and the growth/decrease trend of express delivery volume. To achieve this goal, the data needs to be sorted and cleaned first for effective analysis. Then, we can use statistical methods, such as correlation analysis, linear regression, etc., to quantify the connection strength between cities. Afterwards, we can establish a comprehensive evaluation index system, and use methods such as weighting to rank the importance of each site city. Through this method, we can better understand which site cities are more important to the operation of express companies, and provide valuable reference information for express companies.

2.2 Analysis of Problem 2

We need to use the existing data to establish a mathematical model to predict the amount of express transportation between the cities of each "delivery-receipt" site in the future. To achieve this goal, we can use the time series analysis method, autoregressive moving average model (ARIMA) to help us analyze the trend and cyclical changes in the historical data, so as to provide a basis for forecasting the future transportation volume. By adjusting and optimizing the model, we can make the prediction result as close as possible to the actual situation, and provide support for express companies to formulate more reasonable transportation plans.

2.3 Analysis of the three thoughts on the problem

Question 3 requires us to use a mathematical model to predict the city pairs of sites that can be delivered normally and the corresponding express delivery quantity under the influence of emergencies. To achieve this, we need to first identify and weed out the affected cities. Then, we can use the mathematical model established in question 2 to predict the remaining normal transportation stations. Considering that unexpected events may have an impact on transportation demand, we also need to adjust the model to ensure that the forecast results are more in line with the actual situation. In this way, we can help express companies make more secure transportation decisions in the face of uncertainties.

2.4 Analysis of the four ideas of the problem

Question 4 requires us to combine the railway transportation network and the transportation cost calculation formula to establish a mathematical model to find the lowest-cost transportation solution. To achieve this goal, we can transform this problem into an optimal path problem. By using algorithms from graph theory, we can find the lowest cost path under given conditions (such as limited number of paths, etc.). On this basis, we also need to consider the relationship between the actual loading volume and the rated loading volume, and incorporate this factor into the model. Through the optimization and adjustment of the model, we can provide express companies with the lowest transportation cost solutions under different circumstances, thereby reducing operating costs and improving transportation efficiency.

2.5 Analysis of Five Thoughts on Questions

Question 5 requires us to distinguish between fixed and non-fixed needs and to forecast these two parts separately. First of all, we can find the lower limit of fixed demand through the analysis of historical data, that is, the minimum demand within a certain time range. Next, we can use cluster analysis, linear regression to estimate the fixed demand constant. On the basis of fixed demand, we need to forecast non-fixed demand. Here, we can use the probability distribution estimation method to describe the change of non-fixed demand. By estimating the mean and standard deviation of non-fixed demand, we can provide express companies with more accurate demand forecasts, thereby helping them better respond to market changes.

3. Model assumptions

In response to the questions raised in this paper, we made the following model assumptions:

1. Assume that the historical data is sufficient to reflect the actual situation of each site city.

2. Assume that the changing trend of demand follows a certain law to a certain extent.

3. Assume that the transport demand between city pairs of sites that can deliver goods and receive goods normally will not be affected by emergencies.

4. Assume that rail transport costs are related only to fixed costs and the actual volume loaded.

5. Assume that the actual loading volume can exceed the rated loading volume, but it will lead to an increase in cost.

6. Assume that the non-fixed demand of the same "delivery-receiving" site city pair obeys a certain probability distribution.

4. Description of symbols

The commonly used symbols in this paper are shown in the table below, and other symbols are explained in the text

7a3146ed00124a0aa63d73ef03f5306f.png

 

5. Modeling and solution

5.1 Modeling and solution of problem 1

5.1.1 Data preprocessing

The specific code is as follows:

import pandas as pd

# 读取数据
data = pd.read_excel("附件1(Attachment 1)2023-51MCM-Problem B.xlsx")

# 检查缺失值
missing_values = data.isnull().sum()
print("缺失值数量:\n", missing_values)

# 如果有缺失值,可以选择删除缺失值所在的行
data = data.dropna()

# 检查数据类型
print("数据类型:\n", data.dtypes)

# 将日期列转换为日期类型(如果需要)
data['日期(年/月/日) (Date Y/M/D)'] = pd.to_datetime(data['日期(年/月/日) (Date Y/M/D)'])

# 检查异常值(例如,使用箱线图)
import matplotlib.pyplot as plt
plt.boxplot(data['快递运输数量(件) (Express delivery quantity (PCS))'])
plt.show()

# 处理异常值(例如,删除异常值所在的行或用合适的值替换)
# 这里我们假设异常值的定义为大于Q3+1.5*IQR或小于Q1-1.5*IQR的值
Q1 = data['快递运输数量(件) (Express delivery quantity (PCS))'].quantile(0.25)
Q3 = data['快递运输数量(件) (Express delivery quantity (PCS))'].quantile(0.75)
IQR = Q3 - Q1

# 删除异常值所在的行
data = data[~((data['快递运输数量(件) (Express delivery quantity (PCS))'] < (Q1 - 1.5 * IQR)) | (data['快递运输数量(件) (Express delivery quantity (PCS))'] > (Q3 + 1.5 * IQR)))]

# 计算每个城市的发货量和收货量
city_send = data.groupby('发货城市 (Delivering city)').sum(numeric_only=True).reset_index()
city_receive = data.groupby('收货城市 (Receiving city)').sum(numeric_only=True).reset_index()

# 将发货量和收货量合并为一个表格
city_stat = city_send.merge(city_receive, left_on='发货城市 (Delivering city)', right_on='收货城市 (Receiving city)', how='outer').fillna(0)

# 计算总运输量
city_stat['总运输量'] = city_stat['快递运输数量(件) (Express delivery quantity (PCS))_x'] + city_stat['快递运输数量(件) (Express delivery quantity (PCS))_y']

# 对城市进行排序
city_stat = city_stat.sort_values(by='总运输量', ascending=False)

# 输出排名前5的城市名称
top_cities = city_stat['发货城市 (Delivering city)'].head(5).tolist()
print("重要程度排名前5的站点城市名称:", top_cities)

 

we can get the result

Table 1 Results of Question 1

to sort 1 2 3 4 5
city ​​name L G V Q R

5.2 Modeling and solution of problem 2

In order to predict the number of express transportation between each "shipping-receiving" station city on April 18, 2019 and April 19, 2019, as well as the total express transportation between all "shipping-receiving" station cities on that day Quantity, we can use time series analysis method.

We first extract the "shipment-receipt" site city pairs and their corresponding express shipment quantities from Attachment 1, and convert them into a time-series format.

Modeling using an ARIMA model. The ARIMA model consists of three parts: autoregressive model (AR), moving average model (MA) and differential integration model (I). The parameters of the ARIMA model include p, d, and q, where p represents the order of the AR part, d represents the order of the difference, and q represents the order of the MA part. Choosing the appropriate p, d, and q values ​​is the key to establishing the ARIMA model.

We need to select the appropriate p, d, and q parameters through the autocorrelation graph (ACF) and partial autocorrelation graph (PACF). Finally, we can get Table 2 according to the training and code.

Table 2 will not be issued here, in order to protect students who have already obtained the results

Part of the code is as follows:

1. The total express shipment quantity code between all "Ship-Receive" cities:

import pandas as pd
import numpy as np

# 读取数据
data = pd.read_excel('附件1(Attachment 1)2023-51MCM-Problem B.xlsx')

# 提取“发货-收货”站点城市对及其对应的快递运输数量,并将其转换为时间序列格式
ts = pd.Series(data['快递运输数量(件) (Express delivery quantity (PCS))'].values,
               index=pd.to_datetime(data['日期(年/月/日) (Date Y/M/D)'].values))

# 以天为单位重采样,并对缺失值进行插值处理
ts_day = ts.resample('D').sum().interpolate()

# 输出预处理后的数据
print(ts_day.head())

from statsmodels.tsa.arima.model import ARIMA
import warnings

# 关闭警告提示
warnings.filterwarnings("ignore")

# 选择p、d、q值
p, d, q = 2, 1, 2

# 拟合ARIMA模型
model = ARIMA(ts_day, order=(p, d, q)).fit()

# 预测2019年4月18日和2019年4月19日各“发货-收货”站点城市之间快递运输数量
pred = model.predict(start='2019-04-18', end='2019-04-19', dynamic=True)

# 输出预测结果
print(pred)

 

 

Guess you like

Origin blog.csdn.net/zzzzzzzxxaaa/article/details/130435498