With the rapid development of Chinese economy and society, logistics is becoming an indispensable part of enterprise economic activities, and its importance is increasing day by day. The petroleum and petrochemical industry is an important guarantee for the country economic and social development, and this profession is the pillar of Chinese economy   . After years of development, the industry has gradually matured and formed a market competition pattern dominated by Petro China, Sinopec, China National Offshore Oil Corporation. In the face of such a diverse and competitive market environment, it is more important for petroleum and petrochemical enterprises to maintain their market share and higher profit margins. In order to improve their own management model and reduce the logistics operation cost, as the terminal part of the supply chain of the petroleum and petrochemical enterprises, refined oil distribution is a good breakthrough. By improving the logistics link, it can greatly reduce the enterprise’s logistics and distribution costs, and fundamentally improve the enterprise’s core-competitiveness.
In terms of its form, the issue of refined oil distribution is a problem of transport dispatching. For this problem, a large number of studies consider more about how to meet the balance of transport capacity and less consider the time constraints in the transport process. In fact, product oil has special requirements for transportation time during distribution. If the schedule is not good, it is easy to appear the phenomenon of out of stock and waiting for unloading. On the basis of previous studies, this paper combines the characteristics of oil product distribution, and puts forward the dynamic time window of oil supplementation based on every moment, and uses the C language to solve the model, so as to make the distribution plan more reasonable, which makes the distribution problem of the refined oil more in line with the actual situation.
2. Problem Description
All kinds of resources in the process of refined oil distribution are form a very complex distribution network   , including oil depots, gas stations, transport vehicles and so on. The purpose of distribution dispatching is to generate the resource scheduling scheme which has the best benefit or the lowest cost under the restrictions of transportation resources, storage capacity, transportation time and other factors. Specifically, the route of each vehicle, the delivery time and quantity of each distribution location are shown in table  , so as to achieve the goal of minimum transportation cost. There are a stable supply and demand relationship between the oil depot and the gas station, so this paper takes a single oil depot as the object of study. The oil depot that has two types (single or double cabins) delivery vehicles delivers the same kind of oil to a series of gas stations during the business hours. In the case of ensuring every gas station is not out of stock at any moment, according to the inventory in the tank, this paper makes the delivery plan of the day, reasonably arranging the distribution vehicle, distribution route and time to make the delivery cost lowest.
3. Model Building
Before building a model, it is necessary to define some of the constants and variables necessary to build the model in advance, some of which are summarized by long-term tests and are generic. But some of the data can be adjusted and set according to the actual situation.
3.1. Model Hypothesis
1) Assuming that all types of distribution vehicles are adequate and are parked at the depot.
2) The delivery vehicles should be fully loaded (including all compartments), that is, when the vehicles leave the depot, each compartment needs to be filled with refined oil   .
3) The refined oil in the same compartment must be unloaded to the same gas station. The refined oil in different compartments of the same car can be unloaded to different gas stations.
4) Assuming that the running time from the depot to the gas station and from one gas station to another gas station is t0 hours, and the loading time and the unloading time are ignored.
5) Assuming that every gas station unloads refined oil at the whole point of time, and the sales per hour is constant during the business hours.
6) Each gas station can use one oil truck at most to supplement refined oil at each moment.
3.2. Parameter Setting
i: the number of gas station, ;
t: the business hours of gas station, ;
fi: Sales per hour of gas station i;
qs: the compartment capacity of the vehicle which has one cabin;
qd: a compartment capacity of the vehicle which has two cabins;
Vi: the capacity of the gas station i;
Cs: the single-trip shipping cost of the delivery which has one cabin;
Cd: the single-trip shipping cost of the delivery which has two cabins;
Wit: the inventory of the gas station i at t;
Qi: safe stock of gas station i;
Tis: the time that gas station i begin to supplement refined oil;
Tie: the time that gas station i finish supplementing refined oil;
Xit: binary variable. Xit = 1, if gas station i use a delivery vehicle which has one cabin to supplementing refined oil at t. Xit = 0, otherwise;
Yit: binary variable. Yit = 1, if gas station i use a cabin of delivery vehicle which has two cabins to supplementing refined oil at t. Yit = 0, otherwise;
Zit: binary variable. Zit = 1, if gas station i use two cabins of delivery vehicle which has two cabins to supplementing refined oil at t. Zit = 0,otherwise.
3.3. Building the Model
Based on the above problem description, model assumptions and parameter settings, the vehicle scheduling model is established:
1) Objective function
According to the above description, this paper mainly considers the transportation costs of distribution vehicles, and takes the lowest delivery cost as the optimization target:
Gas station i can be supplemented refined oil by a delivery vehicle at most at time t  :
The inventory of the gas station i must be less than the capacity at time t:
The paper ensures that the gas station i is not out of stock at time t:
Because the running time from the depot to the gas station and from one gas station to another gas station is t0 hours. In principle, we should ensure that each gas station is not out of stock in the next t0 hours when the delivery task is arranged. Therefore, it is determined that the minimum inventory of refined oil at the gas station when the delivery task is arranged.
In the formula, δ means the minimum inventory of refined oil when the gas station is filling up.
When the inventory of the gas station reaches Qi, it is necessary to issue the task of oil distribution. According to the storage and the sales of the gas station at every moment, it is necessary to predict the time period that the refined oil is expected to be delivered, that is to say, to determine the dynamic time window about supplementing refined oil.
Taking the t moment as the benchmark, the start time of the oil supplement is as follows:
The end time of the oil supplement is as follows:
At the t moment, the vehicle scheduling can be divided into three cases by the oil time window   :
a) When the Tis of the two gas stations are the same or when the Tis of the two gas stations are the different and , this paper considers unloading the refined oil to two gas station by using a vehicle with two compartments.
b) When and , this paper considers unloading the refined oil to gas station i by using a vehicle with two compartments.
c) When and , this paper considers unloading the refined oil to gas station i by using a vehicle with one compartments.
In the formula, DTis the difference between the start time of any two gas stations’ time window.
4. Model Solution
C language is an important programming language of computer software, which is widely used in computer software programming. Computer software programming based on the C language can greatly simplify the difficulty of programming and improve the accuracy of program operation results, and have the characteristics of quick solution speed and so on   . Therefore, this paper uses C language to program the model.
1) Setting the opening time of the gas stating T = 0.
2) Calculating the inventory and time window according to the formula.
3) Judging whether to distribute according to the time window. When the start time of time window is equal to 0, it indicates that the inventory can be still sold for t0 hours. At this time the vehicle begins to deliver.
4) Putting the constraint conditions into the loop control distribution.
5) Distribution plan:
(a) When the number of the start time of time window is equal to 0 is 1, according to the capacity and the inventory of gas stations to decide to use the vehicle with one compartment or two compartments.
(b) When the number of the start time of time window is equal to 0 is 2, the priority will be given to the vehicle with two compartments, which will be deliver refined oil to two gas stations.
(c) When the number of the start time of time window is equal to 0 is more than 2, it’s going to be distributed by (b) and then by (a).
6) After refueling, let T = T + 1. Go to step 2).
7) Until T = M, end the loop.
8) Outputting the final result and getting the delivery cost.
5. Case Analysis
There are five gas stations in the area. The daily business hours are from 8:00 to 22:00, and the gas stations have the same kind of refined oil and are delivered by the same oil depot. The basic information of each gas station is shown in Table 1. The oil depot has two types of delivery vehicles, and each type of distribution vehicle is abundant, meanwhile compartment information and single trip freight are shown in Table 2. The delivery vehicles are parked at the depot and start working at 7 o’clock in the morning. The time between the oil depot and the gas stations, and the gas stations was one hour. The running time from the depot to the gas station and from one gas station to another gas station is one hour. In order to ensure the each gas station is not out of stock, it is reasonable to arrange the delivery plan and the delivery route of each delivery vehicle to make the delivery cost lowest.
Based on the model and solution process, the distribution plan of gas stations is shown in the following Table 3.
According to the distribution plan, we can get the distribution route of vehicles in the following Table 4.
Table 1. The information of gas stations and tanks unit: liter.
Table 2. The information of distribution vehicle.
Table 3. Distribution plan unit: liter.
Table 4. Distribution route of vehicles.
According to the distribution plan, it can be concluded that the lowest delivery cost is 2 * 100 + 12 * 120 = 1640 yuan.
From the calculation result we can see that every gas station can successfully complete the supplementary task by using the proposed model and the method of solving, which is not appear the phenomenon of lacking of oil and wait for unloading. At the same time, making the whole freight as low as possible.
In this paper, based on the characteristics of refined oil distribution under the conditions of multiple vehicles, single oil and multiple gas stations, the paper establishes the distribution planning model of refined oil with the lowest freight rates as the objective function, the inventory of the gas station is less than the capacity and the gas station is not out of stock at any moment and other conditions as constraint conditions. The designs process of C language solves the model. The results prove that a feasible scheme can be obtained by using this model and algorithm. This paper only considers the factors such as vehicle transportation cost, gas tank volume, but in practical situation, the distribution problem of refined oil is also limited by the number of vehicles and the distance between the gas stations. In the future research, we can improve the model, increasing the influence factors and constraints, so as to increase its applicability.
Teaching Master of Beijing GaoChuang project Beijing (G02040011).
 Spliet, R. and Desaulniers, G. (2015) The Discrete Time Window Assignment Vehicle Routing Problem. European Journal of Operational Research, 244, 379-391.