Iterative optimization weight detection method based on data analysis and application
Through the iterative optimization method based on data analysis, the problem of weight estimation of a single second-hand book in logistics is solved, accurate weight estimation and cost control are achieved, economic losses are reduced, and a healthy second-hand goods market ecosystem is promoted.
Patent Information
- Application Number
- CN202510641623.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-19
- Publication Date
- 2025-08-08
AI Technical Summary
The prior art is difficult to effectively estimate the weight of single second-hand books from logistics data, especially in the face of a wide variety of books and tampering with the weight of the package, resulting in damage to the recycled book companies during logistics settlement.
Using an iterative optimization method based on data analysis, the weight of each target item is adjusted by constructing the target item relationship matrix and the target item initial weight interval, and random search and iterative optimization are used to minimize the difference between the estimated total weight of the target item in the package and the actual total weight of the package, and finally determine the weight of each book.
It has achieved accurate estimation of the weight of each book in the face of a complex logistics environment, reduced economic losses caused by weight tampering, improved the transparency and cost control capabilities of the logistics process, and promoted the establishment of a healthy second-hand goods market ecosystem.
Smart Images

Figure SMS_1 
Figure SMS_2 
Figure SMS_3
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of reverse logistics, and in particular to a weight detection method and application based on iterative optimization of data analysis. Background Art
[0002] Recycling book businesses profit from handling used books, and reverse logistics can increase customer willingness to sell. However, some logistics company handlers falsify weights, causing losses for these businesses. Obtaining the weight of each used book would help recycling book businesses detect tampered parcel weights during final settlement with logistics companies. However, obtaining the weight of individual used books is challenging due to several factors.
[0003] 1. Missing weight information. Because book weight isn't a primary concern for users on e-commerce websites, the weight of some books isn't recorded. Furthermore, some second-hand books are very old, but their content is classic and still has high recycling value, so weight information is also missing. Therefore, using web crawlers isn't enough to collect weight information for all second-hand books.
[0004] 2. Associated sales. Some used books are not sold individually; instead, they are often shipped together in the same logistics package as other books. For example, exercise books for some courses are often packaged with their corresponding textbooks and sold to recycling book companies. Therefore, it is unrealistic to estimate the weight of used books using the weight of all packages containing individual books in reverse logistics data.
[0005] The most intuitive way to solve this technical problem is as follows:
[0006] The weight of a used book logistics package can be roughly considered the sum of the weights of all the books in its packaging. Therefore, if we consider the weight of each book as an unknown variable, and the package weight is known, we can seemingly solve each unknown variable by constructing a system of multivariate equations. This can create the illusion that, with sufficient logistics data like the one shown in Table 1, we can easily determine the weight of each used book. To more clearly illustrate this intuitive approach, we'll use the example in Table 1.
[0007] Table 1:
[0008]
[0009] Let the weights of the used books "Modern Operating Systems (Original Book 4th Edition)", "Linux Kernel Analysis", and "Deep Understanding of Computer Systems (Original Book 3rd Edition)" be variables x1, x2, and x3, respectively. Let the weight of the courier package be y, which is known and can be obtained from the courier manifest data. As shown in Table 1, since all three books were placed in the same courier package, we can obtain the expression x1 + x2 + x3 = y1, where y1 is the weight of courier package number 78671419218595. If we can find two other packages in the courier manifest data, which can form the expressions x1 + x2 = y2 and x2 + x3 = y3, respectively, we can solve them using the following equation group 1.
[0010]
[0011] However, in fact, the above solution is completely impractical in practical applications.
[0012] The difficulty in implementing the above-mentioned intuitive solution in practical applications is mainly due to the following technical challenges.
[0013] 1. The sheer number of titles. Preliminary statistics indicate that there are over 50,000 used book titles circulating on various secondhand book e-commerce platforms. If we were to solve this problem using the intuitive approach described above, we would need to construct a massive system of equations. Furthermore, secondhand book purchases are highly correlated; users who purchase computer books rarely purchase art. Therefore, given such a large number of titles, constructing a solvable system of equations using express parcel data is inherently challenging.
[0014] 2. Package weights have been tampered with, making it impossible to directly determine the weight of individual books. The data on logistics packages received by book recycling companies may have some weights tampered with. Furthermore, due to the large variety of books and the vast database, it is impossible to directly obtain the weight of all books, making it impossible to directly determine the true weight of the package. Estimating the weight of individual used books from package data with tampered weights is another technical challenge we need to address.
[0015] In view of this, the inventors of this case conducted in-depth research and obtained a weight detection method and application based on iterative optimization of data analysis. Summary of the Invention
[0016] The purpose of the present invention is to provide a weight detection method and application based on iterative optimization of data analysis to solve the problems pointed out in the background technology.
[0017] The above technical objectives of the present invention are achieved through the following technical solutions:
[0018] A weight detection method based on iterative optimization of data analysis, comprising the steps of:
[0019] Total weight of received packagea p , target item relationship matrix R p,i and the target item initial weight interval [l w ,m w ];
[0020] By adjusting the weight g of each target item i , so that the estimated total weight of the target items in the package and the actual total weight of the package a p The difference between them is minimized, and the weight of the corresponding target item is g i The value of is the detection result value. The difference between the estimated total weight of the target items in the package and the actual total weight ap of the package is expressed by the following objective function:
[0021]
[0022] Where n represents the number of packages, m represents the number of target items, and indicates whether package p contains book i.
[0023] In a preferred embodiment, the estimated total weight of the target items in the package and the actual total weight of the package are equal. p The process of minimizing the difference between the two involves:
[0024] In the target item initial weight range [l w ,m w ] Generate several random candidate weights;
[0025] For each candidate weight, calculate the total error:
[0026] Find the candidate weight that minimizes the error and record its index;
[0027] Adjust the weight interval according to the index of the candidate weight;
[0028] Follow the above steps for multiple iterations, gradually adjust the weight estimation interval of each target item, and finally obtain an optimal solution to the objective function.
[0029] In a preferred embodiment, the estimated total weight of the target items in the package and the actual total weight of the package are equal. p The process of minimizing the difference between the two includes:
[0030] In the target item initial weight range [l w ,m w ] to generate 10 random candidate weights:
[0031] g i[j]=l w [i]+r j ·(m w [i]—l w [i]),j=1,...,10;
[0032] Among them, r j is a random number uniformly distributed in the interval [0,1];
[0033] For each candidate weight, calculate the total error:
[0034]
[0035] where dis[j] represents the candidate weight g i [j] corresponding error;
[0036] Find the candidate weight that minimizes the error and record the index of the candidate value as ind:
[0037]
[0038] Update the current interval according to the optimal candidate weight:
[0039]
[0040] When the boundary case ind=0 occurs:
[0041]
[0042] When the boundary case ind = 9 occurs:
[0043]
[0044] Use the updated interval calculation as the initial weight estimate for the next iteration:
[0045]
[0046] Finally, through multiple iterations, the weight estimation interval of each book is gradually adjusted so that the objective function can converge to an optimal solution.
[0047] In a preferred embodiment, the target item relationship matrix R p,i Record the correspondence matrix between all packages and target items. The rows of the matrix are each package, and the columns of the matrix are each target item. If the target item is in the package, the array records the number of books in the package. If not, it is recorded as 0.
[0048] In a preferred embodiment, the method further includes the steps of data preprocessing to eliminate abnormal values in package weight.
[0049] In a preferred embodiment, the data preprocessing process specifically includes:
[0050] Set the data set: The package weight data set is: G = {g1, g2, ..., g n}, where g i Represents the logistics weight of the i-th package;
[0051] Calculate quartiles: Calculate the first quartile (Q1, i.e. 25% quartile) and the third quartile (Q3, i.e. 75% quartile):
[0052] Q1=Quantile(X,0.25),Q3=Quantile(X,0.75)
[0053] Among them, Quantile(X,p) represents the value of the data set X at the pth quantile, that is, p% of the data in X is less than or equal to this value;
[0054] Calculate the interquartile range (IQR) and set upper and lower bounds:
[0055] IQR=Q3-Q1
[0056] Lower bound = Q1 - 1.5 × IQR
[0057] Upper bound = Q3 + 1.5 × IQR
[0058] Filter outliers: keep only g i ∈[lower bound, upper bound];
[0059] That is: Q1-1.5×IQR≤g i ≤Q3+1.5×IQR;
[0060] The remaining data points were considered as outliers and removed.
[0061] A use of a weight detection method based on iterative optimization of data analysis, which applies the weight detection method based on iterative optimization of data analysis. In the weight detection method based on iterative optimization of data analysis, the target item is a book.
[0062] Compared to existing technologies, this method analyzes the weight data of multiple packages and the information about the target items in the packages, using an iterative method to gradually narrow the estimated weight range for each target item, ultimately guessing the true weight of each target item. The algorithm involves initializing the estimated value, constructing a relationship matrix, setting the weight estimation range, and performing multiple iterations to optimize the weight estimate.
[0063] This patent proposes a weight detection method based on data analysis and iterative optimization, providing an innovative solution to the weight tampering problem faced by recycling book companies in reverse logistics. By implementing this patented technical solution, recycling companies will be able to more accurately monitor and manage logistics costs, ensure the rationality of logistics expenses, improve the transparency and fairness of the logistics process, and reduce the economic losses caused by weight tampering. In the long term, the application of this technology will help build a healthier and more sustainable secondhand goods market ecosystem and contribute to the goal of carbon neutrality. DETAILED DESCRIPTION
[0064] The present invention is described in further detail below.
[0065] This specific embodiment is merely an explanation of the present invention and is not intended to limit the present invention. After reading this specification, those skilled in the art may make non-creative modifications to this embodiment as needed. However, as long as such modifications are within the scope of the claims of the present invention, they are protected by patent law.
[0066] A weight detection method based on iterative optimization of data analysis is used to detect the weight of books in logistics transportation packages.
[0067] First, we need to define the relevant parameters:
[0068] Definition 1. aP represents the total weight of package P. The input package dataset contains logistics information for multiple packages. Each package is represented by a unique logistics tracking number and contains several books. The same logistics tracking number represents the same package, and the total weight aP of each package is known.
[0069] We can obtain the weight data of multiple packages and the book information contained in each package. The same express delivery number indicates that the books are in the same package. Some data examples are shown in Table 2. Based on the data in Table 2, we can obtain the data of four packages: a1 = 1000, a2 = 300, a3 = 800, and a4 = 600.
[0070] Table 2:
[0071]
[0072]
[0073] Based on the known weight of the package and the information in the package, the initial estimated weight g is obtained i :
[0074] For each package p, first use the total weight of the package a p Divide by the total number of books in package p to get the average weight v of the books in the package i:
[0075]
[0076] Where |p| represents the number of books contained in the package P, v i is the average weight of the books in the package.
[0077] The contribution of each book i in package p can be calculated by the average book weight v of the package. i Multiply by the number of books in the package C pi To calculate:
[0078]
[0079] Among them, v i is the average weight of the ith package, C pi is the number of books in package p. The contribution of each book in all packages is accumulated to get the total initial estimated weight G of each book. i .
[0080] Finally, the total initial estimated weight of each book G i Divide by the number of times the book appears in all packages C i , get the initial estimated weight g i
[0081]
[0082] Among them, G i is the total initial estimated weight of each book, C i is the number of occurrences of the i-th book in all packages, ensuring that the divisor is not zero.
[0083] Example 2. In the example in Table 2, we have the weight data of four packages and the information about the books in the packages. Let the logistics weights of the packages be a1, a2, a3, and a4 respectively. We can calculate the average weight of the books in the packages vi based on the information in Table 2:
[0084]
[0085] According to the equations, we can find v1=300, v2=300, v3=500, v4=600. Next, we can find the total initial estimated weight G based on the sum of the weights contributed by each book i in each package. i Taking the book "In-depth Understanding of Computer Systems (Original Book 3rd Edition)" in Table 2 as an example, the initial estimated weight of the book is g3, and the total initial estimated weight is G3. First, according to the average weight of the books in the package v i Find G3:
[0086] G3=v1×2+v3×1
[0087] We get G3 = 1100. Then divide the total initial estimated weight G3 by the number of times the book appears in all packages to get the initial estimated weight g3:
[0088]
[0089] The initial estimated weight g3=366.67, that is, the initial estimated weight of the book "In-depth Understanding of Computer Systems (Original Book 3rd Edition)" is 366.67g.
[0090] Definition 3. R p,i Defined as a binary matrix that represents the relationship between packages and books. Input is the book number information contained in each package. R p,i It represents the number of books i contained in package p, and 0 if the package p does not contain the book i.
[0091]
[0092] Example 3. Continuing with the example in Table 2, we can generate a two-dimensional array R based on the package information. p,i , a matrix that records the correspondence between all packages and books. The rows of the matrix are for each package, and the columns are for each book. If the book is in the package, the array records the number of books in the package. If not, it is recorded as 0. The above example can be represented as the following matrix:
[0093]
[0094] The following is a process of using the iterative optimization weight detection method based on data analysis in this embodiment for second-hand book weight detection:
[0095] 1. Data preprocessing: In this invention, in order to eliminate outliers and improve data quality, we use the interquartile range method to screen the logistics weight data. The specific steps are as follows:
[0096] Set the data set: The package weight data set is: G = {g1, g2, ..., g n}, where g i Represents the logistics weight of the i-th package;
[0097] Calculate quartiles: Calculate the first quartile (Q1, i.e. 25% quartile) and the third quartile (Q3, i.e. 75% quartile):
[0098] Q1=Quantile(X,0.25),Q3=Quantile(X,0.75)
[0099] Among them, Quantile(X,p) represents the value of the data set X at the pth quantile, that is, p% of the data in X is less than or equal to this value;
[0100] Calculate the interquartile range (IQR) and set upper and lower bounds:
[0101] IQR=Q3-Q1
[0102] Lower bound = Q1 - 1.5 × IQR
[0103] Upper bound = Q3 + 1.5 × IQR
[0104] Filter outliers: keep only g i ∈[lower bound, upper bound];
[0105] That is: Q1-1.5×IQR≤g i ≤Q3+1.5×IQR;
[0106] The remaining data points were considered as outliers and removed.
[0107] 2. Initial interval: Initially, we cannot know the exact weight of each book, so we assume that the weight of each book is g i Located in an interval, set the minimum weight l w and maximum weight m w , the subsequent iteration process is also carried out within the interval. We define the minimum weight l w and maximum weight m w These are the minimum and maximum weights of a single book package:
[0108] g i ∈[l w ,m w ]
[0109] For each book i, use [lw[i],mw[i]] to represent its weight estimation interval.
[0110] Example 4. Continuing with the example in Table 2, the minimum weight of a single book package is a2 = 300, and the maximum weight is a4 = 600. In this example, l w =300,m w =600
[0111] 3. Objective function: Our goal is to minimize the total weight of the package a p The difference between the estimated total weight of the books in the package. Adjust the weight of each book by g i , so that the total weight of all packages is as close as possible to the actual package weight. We hope to minimize the following objective function:
[0112]
[0113] Where n is the number of packages and m is the number of books. p,i is a binary matrix indicating whether package p contains book i, and g i represents the weight of book i
[0114] Proof: We need to prove that the objective function can converge to an optimal solution, that is, to prove that the objective function is a convex function. The objective function represents our hope to adjust the weight g of each book i , so that the total weight calculated from the package is equal to the actual total weight of the package a p The difference between the two is minimized. This optimization process is actually a least squares problem, which aims to find the most suitable estimate of the book weight so that the difference between the actual weight of the package and the estimated weight is minimized. The proof of the objective function is given below:
[0115] For each package p, the total weight of the package a p is the sum of the weight of the books contained in the package. p,i ·g i Implementation, where R p,i Indicates whether package p contains books i, g i represents the weight of book i. Therefore, we can get:
[0116]
[0117] In order to measure the actual weight a p We use the squared error to calculate the difference between the estimated weight and the estimated weight. The advantage of the squared error is that it gives a higher penalty for larger differences, smoothing the optimization process and avoiding the unstable solution that may result from using only absolute error. For each package p, the error can be expressed as:
[0118]
[0119] where e p is the estimated error of package p. Our goal is to minimize the sum of squared errors of all packages:
[0120]
[0121] In order to minimize the objective function, we can i Solve the partial derivatives. For each book g i , whose gradient is:
[0122]
[0123] Using the chain rule, the gradient can be calculated as:
[0124]
[0125] This gradient shows that during the optimization process, the weight of each book is adjusted according to the error of each package, thereby gradually reducing the total error.
[0126] Since the objective function is a quadratic function, and for each g i is continuously differentiable, so the optimization problem of minimizing this function is a convex optimization problem. In a convex optimization problem, the objective function is:
[0127]
[0128] There must be a global optimal solution. So we can get an optimal book weight estimation model by minimizing the sum of squared errors between the actual weight of the package and the estimated weight.
[0129] 4. Random weight generation: In order to optimize the weight of each book, we generate random weights in the interval [l w ,m w ] to generate 10 random candidate weights:
[0130] g i [j]=l w [i]+r j ·(m w [i]—l w [i]),j=1,...,10;
[0131] Among them, r j is a random number uniformly distributed in the interval [0,1];
[0132] 5. Error calculation: For each candidate weight, calculate the total error:
[0133]
[0134] where dis[j] represents the candidate weight g i [j] corresponding error;
[0135] 6. Select the optimal weight and update the interval: Find the candidate weight that minimizes the error and record the index of the candidate value as ind:
[0136]
[0137] Update the current interval according to the optimal candidate weight:
[0138]
[0139] When the boundary case ind=0 occurs:
[0140]
[0141] When the boundary case ind = 9 occurs:
[0142]
[0143] Use the updated interval calculation as the initial weight estimate for the next iteration:
[0144]
[0145] Finally, through multiple iterations, the weight estimation interval of each book is gradually adjusted so that the objective function can converge to an optimal solution.
[0146] The pseudo code of the above model is described below in Algorithm 1.
[0147] Algorithm 1 Weight guessing algorithm
[0148]
[0149]
[0150] This embodiment aims to solve the problem of economic losses caused by weight tampering in the logistics process of circulating book companies.
[0151] The algorithm in this embodiment analyzes the weight data of multiple packages and the information about the books contained within them, using an iterative method to gradually narrow the estimated weight range for each book, ultimately guessing the true weight of each book. The algorithm involves initializing the estimated value, constructing a relationship matrix, setting the weight estimation range, and performing multiple iterations to optimize the weight estimate.
[0152] The weight estimation algorithm proposed in this embodiment provides an innovative solution to the weight tampering problem faced by recycling book companies in reverse logistics. By implementing this patented technical solution, recycling book companies will be able to more accurately monitor and manage logistics costs, ensure the rationality of logistics expenses, improve the transparency and fairness of the logistics process, and reduce the economic losses caused by weight tampering. In the long run, the application of this technology will help build a healthier and more sustainable secondhand book market ecosystem and contribute to the goal of carbon neutrality.
[0153] It should be noted that, in this document, relational terms such as first and second, etc., are used solely to distinguish one entity or operation from another, and do not necessarily require or imply any actual relationship or order between these entities or operations. Furthermore, the terms "include," "comprise," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or terminal device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or terminal device. Without further limitation, elements defined by the phrase "include..." or "comprising..." do not exclude the presence of additional elements in the process, method, article, or terminal device comprising the elements. Furthermore, in this document, "greater than," "less than," "exceeding," etc., are understood to exclude the number itself; "above," "below," "within," etc., are understood to include the number itself.
[0154] The above description of the embodiments is intended to facilitate understanding and application of the present invention by those skilled in the art. It is apparent that those skilled in the art can readily make various modifications to the embodiments and apply the general principles described herein to other embodiments without requiring creative effort. Therefore, the present invention is not limited to the above-described embodiments. Improvements and modifications made by those skilled in the art based on the disclosure of the present invention without departing from the scope of the present invention should be within the scope of protection of the present invention.
Claims
1. A weight detection method based on iterative optimization of data analysis, characterized in that: Including steps: Total weight of received package p , target item relationship matrix R p,i and the target item initial weight interval [l w ,m w ]; By adjusting the weight g of each target item i , so that the estimated total weight of the target items in the package and the actual total weight of the package a p The difference between them is minimized, and the weight of the corresponding target item is g i The value of is the detection result value. The difference between the estimated total weight of the target items in the package and the actual total weight ap of the package is expressed by the following objective function: Where n represents the number of packages, m represents the number of target items, and indicates whether package p contains book i.
2. The weight detection method based on iterative optimization of data analysis according to claim 1, characterized in that: Make the estimated total weight of the target items in the package and the actual total weight of the package a p The process of minimizing the difference between the two involves: In the target item initial weight range [l w ,m w ] Generate several random candidate weights; For each candidate weight, calculate the total error: Find the candidate weight that minimizes the error and record its index; Adjust the weight interval according to the index of the candidate weight; Follow the above steps for multiple iterations, gradually adjust the weight estimation interval of each target item, and finally obtain an optimal solution to the objective function.
3. The weight detection method based on iterative optimization of data analysis according to claim 1, characterized in that: Make the estimated total weight of the target items in the package and the actual total weight of the package a p The process of minimizing the difference between the two includes: In the target item initial weight range [l w ,m w ] to generate 10 random candidate weights: gi[j]=l w [i]+rj·(m w [i]—l w [i]),j=1,...,10; Among them, r j is a random number uniformly distributed in the interval [0,1]; For each candidate weight, calculate the total error: where dis[j] represents the candidate weight g i [j] corresponding error; Find the candidate weight that minimizes the error and record the index of the candidate value as ind: Update the current interval according to the optimal candidate weight: When the boundary case ind=0 occurs: When the boundary case ind = 9 occurs: Use the updated interval calculation as the initial weight estimate for the next iteration: Finally, through multiple iterations, the weight estimation interval of each book is gradually adjusted so that the objective function can converge to an optimal solution.
4. The weight detection method based on iterative optimization of data analysis according to claim 1, characterized in that: The target item relationship matrix R p,i Record the correspondence matrix between all packages and target items. The rows of the matrix are each package, and the columns of the matrix are each target item. If the target item is in the package, the array records the number of books in the package. If not, it is recorded as 0.
5. A weight detection method based on iterative optimization of data analysis according to any one of claims 1 to 4, characterized in that: It also includes the steps of data preprocessing and removing outliers in package weight.
6. A weight detection method based on iterative optimization of data analysis according to claim 5, characterized in that: The data preprocessing process specifically includes: Set the data set: The package weight data set is: G = {g1, g2, ..., g n }, where gi represents the logistics weight of the i-th package; Calculate quartiles: Calculate the first quartile (Q1, i.e. 25% quartile) and the third quartile (Q3, i.e. 75% quartile): Q1=Quantile(X,0.25),Q3=Quantile(X,0.75) Among them, Quantile(X,p) represents the value of the data set X at the pth quantile, that is, p% of the data in X is less than or equal to this value; Calculate the interquartile range (IQR) and set upper and lower bounds: IQR=Q3-Q1 Lower bound = Q1 - 1.5 × IQR Upper bound = Q3 + 1.5 × IQR Filter outliers: keep only g i ∈[lower bound, upper bound]; That is: Q1-1.5×IQR≤g i ≤Q3+1.5×IQR; The remaining data points were considered as outliers and removed.
7. A weight detection method based on iterative optimization of data analysis, characterized in that: The weight detection method based on iterative optimization of data analysis according to any one of claims 1 to 6 is applied, wherein the target item is a book.