2022 National Undergraduate Mathematical Modeling Contest E Topic-Detailed Explanation of Small Batch Material Production Arrangement + Ideas + Python Code Time Series Prediction Model (1)

foreword

The project has not been very rushed recently, and the work at hand has been completed. It also happened to meet this year's national digital and analog competition. As a retired senior senior of digital and analog, why not participate! The blogger has participated in more than ten mathematical modeling competitions, and the US competition has won the M award and the second prize in the national competition. This blog post is purely for self-entertainment. You can refer to it. The main problem is that E-question just hits my recent research topic, time series forecasting model. To provide you with some ideas, of course, fans can get more ideas and codes inside. It is also the first time to write an article on digital-analog ideas. Maybe some are written too much. Looking forward to your attention.

Bloggers will maintain blog posts for a long time. If you have any mistakes or doubts, you can point them out in the comment area. Thank you for your support.

1. Analysis of competition questions

We directly analyze the questions raised by the title of the competition title and enter the recap of the title of the competition:

1. Question 1

Please analyze the historical data in the attachment, select 6 kinds of materials that should be paid attention to (it can be considered from the frequency, quantity, trend and sales unit price of material demand), and establish a weekly forecast model of material demand (that is, weekly as the Basic time unit, forecasting the weekly demand of materials, see Appendix (1)), and using historical data to evaluate the forecasting model.

Here we need to pay attention to the description of the attachment:

Set the week in which the attachment data first appeared (January 2, 2019) as the first week, and the following weeks start from Monday to Sunday, for example, January 7 to 13, 2019 is the first week 2 weeks, and so on.
When making production plans for this week, any historical data, demand characteristics, and forecast data can be used, but actual demand data for this week and beyond cannot be used.
Service Level = 1 − Out of Stock / Actual Demand.
The inventory and out-of-stock quantities refer to the inventory and out-of-stock quantities of an item at the weekend, respectively.
Let's take a look at the appendix data:
insert image description here

Very standard time series data, great. I just lacked this time series data in my previous time series prediction model, so I can just use it here. Then, based on the above information, let's start the problem analysis.

problem analysis

First of all, let's grasp the focus of the topic - select 6 kinds of materials that should be focused on, and pay attention to the content in brackets:

It can be considered from the frequency, quantity, trend and sales unit price of material requirements.

The title is also very obvious, so we will conduct corresponding analysis based on these indicators:

insert image description here

We found that there are 22453 rows of data in total, from Monday 1/2/19 to 5/21/22, here we need to look at the dates:

insert image description here

The week in which the attachment data first appeared (January 2, 2019) is set as week 1, then it starts on Wednesday and ends on January 6, 19. This is only 5 days for the first week, and other 7 days a week is different. Look at 5/21/22 again:
insert image description here

Then there are only 6 days of No. 16 Road 21 in the last week. It should be noted that there are only five days in the first week, and only 6 days in the last week. After the remaining cycle problem is solved, let's count the frequency of material occurrence:

Material frequency

This is a good solution, and you can directly analyze it with Pandas:

insert image description here
insert image description here

I feel that most of them appear in the frequency of 1-82, but the question asks us to choose six kinds, so we need to consider them comprehensively, we can sort and rank the top 10 materials.

insert image description here

demand

Demand analysis is simpler. We need to perform aggregation operations before sorting, and consider the overall demand. Of course, it can be done in more detail, combining time and frequency, but it is not necessary, because we will integrate and consider it in the future. .

insert image description here

The top 10 are still selected. Of course, we can expand the scope according to subsequent choices, so don’t worry so much:

insert image description here

insert image description here

trend

For trends, we need to collect time series for analysis, that is, the time series length of material requirements, which is also related to frequency. Let's first look at the change in demand for a material:
insert image description here

Then we need to know which statistical variables can reflect the trend:

Just pick one of these MACD
DMI
DMA
EXPMA and use them. I have the MACD method calls that have been written here:

insert image description here

unit price

The most important consideration of unit sales price should be considered in combination with the demand, and should not be considered separately. We need to calculate the cost:

Cost = demand * unit price to get this cost index, and then consider it comprehensively. Here is another point that can be considered in more detail: that is, the trend of sales unit price. This method is the same as the above-mentioned calculation method of the trend fluctuation of demand, and the trend indicator can be used.

The processing process here is also an aggregation operation, which is very simple and will not be displayed, but goes straight to the weekly forecast model:

Time series forecasting model

Finally, the time series forecasting model has arrived, that is, the weekly demand for materials is forecasted with weeks as the basic time unit. So about the time series forecasting model, I have written in my entire series of articles:
insert image description here

This column shows all the time series forecasting models:
insert image description here

We only need to substitute the integrated feature data into the calculation, and then cross-validate the correctness and select the best algorithm.

The #modeling part will be written later. If you want to know more, welcome to add bloggers WeChat, get the code for free and more detailed ideas + models!
Pay attention to prevent getting lost. If there are any mistakes, please leave a message for advice, thank you very much The
above is the entire content of this issue. I'm fanstuck. If you have any questions, feel free to leave a message to discuss. See you in the next issue.

Guess you like

Origin blog.csdn.net/weixin_50843918/article/details/126906409