A method and device for calculating the quantity of materials used in a project
By combining linear programming model and genetic algorithm methods, the quantity of materials used in the project is automatically calculated, which solves the problem of time-consuming manual assumption of the quantity of materials and improves the calculation efficiency.
Patent Information
- Application Number
- CN202411640885.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-18
- Publication Date
- 2025-04-04
AI Technical Summary
In enterprise production, since the actual quantity of materials in the material bill is not recorded or the record is incomplete, financial personnel need to manually assume the quantity of materials to meet the actual production cost of the project, which consumes a lot of working time and reduces work efficiency.
A method for calculating the quantity of materials used in the project is proposed. By obtaining multiple sets of first estimated material quantity information and multiple bills of materials, using a linear planning model and genetic algorithm for preset material quantity, the quantity of materials is automatically calculated and the target calculation result is determined.
It greatly saves manual calculation time, improves calculation efficiency, and can automatically perform calculations, thereby quickly obtaining the quantity of materials that meet the conditions.
Smart Images

Figure CN119761675A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and in particular to a method and device for calculating the quantity of materials used in a project. Background Art
[0002] In enterprise production, in order to clarify the direct cost of each project and help the enterprise complete the project within the budget, the various materials purchased in the project are usually recorded and counted in detail through the bill of materials. However, in the actual project operation process, the actual material quantity in the bill of materials may not be recorded or the record is incomplete. At this time, it is necessary to check the actual material quantity based on the known bill of materials details and the actual cost of the project.
[0003] At present, financial personnel continuously assume the material quantity of each material in each material list based on the material price of each material, the actual total amount of each material list, and the actual production cost of the project. The material cost obtained by multiplying the assumed material quantity by the material price is compared with the actual total amount of each material list and the actual production cost of the project. The verification result should be able to meet both the corresponding actual total amount of the material list and the actual production cost of the project.
[0004] However, this method requires manual assumptions of material quantities until the actual total amount of each bill of materials and the actual production cost are met. There are many types of materials needed in the production process of a project, and when the project production volume is large, the number of materials involved and the amount of production cost are large. Manual assumptions of material quantities are made one by one, and then the prices are constantly judged to see if they match the actual production cost, and finally the assumed material quantity that meets the conditions is obtained. This manual calculation process often takes a lot of work time, greatly reducing work efficiency. Summary of the invention
[0005] In view of the above problems, the present invention proposes a method and device for calculating the quantity of materials used in a project, the main purpose of which is to improve the efficiency of calculating the quantity of materials used in a project.
[0006] In order to achieve the above object, the present invention mainly provides the following technical solutions:
[0007] In a first aspect, the present invention provides a method for calculating the quantity of materials used in a project, the method comprising:
[0008] Acquire multiple sets of first estimated material quantity information and multiple material lists, each set of the first estimated material quantity information includes the estimated total number of each material, and the material quantity used for the missing item in the material list;
[0009] According to the estimated total number in each group of the first estimated material quantity information, the preset material quantity linear programming model is used to calculate the quantity of each material in the multiple material lists to obtain corresponding multiple groups of first material quantity calculation results;
[0010] Determining whether there is a target calculation result of the material quantity in the plurality of groups of first material quantity calculation results by using a preset objective function;
[0011] If not, using a genetic algorithm to generate multiple sets of second estimated material quantity information, so as to determine the target calculation result according to the corresponding calculation results;
[0012] The target calculation result is determined as the quantity of materials used in the project.
[0013] In a second aspect, the present invention provides a device for calculating the quantity of materials used in a project, characterized in that the device comprises:
[0014] an acquisition unit, configured to acquire multiple sets of first estimated material quantity information and multiple material lists, each set of the first estimated material quantity information including the estimated total number of each material and the quantity of materials used for the missing items in the material list;
[0015] a calculation unit, configured to calculate the quantity of each material in the multiple bills of materials obtained by the obtaining unit according to the estimated total number in each group of the first estimated material quantity information obtained by the obtaining unit, using a preset material quantity linear programming model, to obtain corresponding multiple groups of first material quantity calculation results;
[0016] A first determining unit, configured to determine whether there is a target calculation result of the material quantity among the multiple groups of first material quantity calculation results calculated by the calculation unit by using a preset objective function;
[0017] a generating unit, configured to generate a plurality of sets of second estimated material quantity information by using a genetic algorithm if the first determining unit determines that there is no target material quantity calculation result in the plurality of sets of first material quantity calculation results, so as to determine the target material quantity calculation result according to the corresponding calculation results;
[0018] The second determining unit is used to determine the target calculation result determined by the first determining unit as the quantity of materials used in the project.
[0019] On the other hand, the present invention also provides a computing device, comprising: at least one processor, and a memory, wherein the memory stores instructions executable by the processor, and the instructions are executed by the processor, so that the processor can execute a method for calculating the quantity of materials used in a project as described in the first aspect.
[0020] On the other hand, the present invention also provides a readable storage medium, which is used to store a computer program, wherein when the computer program is running, it controls the device where the storage medium is located to execute a method for calculating the quantity of materials used in a project as described in the first aspect.
[0021] By means of the above technical scheme, the present invention provides a method and device for calculating the quantity of materials used in a project. It is necessary to first obtain multiple bills of materials involved in the current project. The materials in each bill of materials may be different. The sum of the quantity of each material in all bills of materials can be estimated in advance. The estimated total of each material is used to calculate the quantity of each material in multiple bills of materials. Multiple groups of first estimated material quantity information include the estimated total of each material. According to the estimated total in each group of first estimated material quantity information obtained, as long as the preset material quantity linear programming model is used, the quantity of each material in multiple bills of materials can be calculated. There is no need to manually calculate the quantity of each material, and the calculation efficiency is high. And through the estimated total of multiple groups, the calculation results of the first material quantity of multiple groups can be obtained, and then one of them can be selected as the target calculation result using the preset objective function, so that a more preferred material quantity calculation result can be obtained. When multiple sets of first material quantity calculation results calculated based on the estimated totals in multiple sets of first estimated material quantity information cannot obtain a target calculation result, it is necessary to perform material quantity calculation again based on other estimated material quantity information, and it is time-consuming to estimate the quantity of each material each time. Therefore, multiple sets of second estimated material quantity information can be automatically generated by genetic algorithms, and the desired target calculation result can be obtained based on the estimated totals of each material in the second estimated material quantity information. The target calculation result is the material quantity used for the project that the present invention wants to calculate. By combining the material quantity linear programming model with the genetic algorithm, the calculation can be automatically performed from the beginning of the calculation until the target calculation result that meets the conditions is obtained. Compared with manual calculation, it greatly saves calculation time and improves calculation efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] By reading the detailed description below with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:
[0023] Figure 1 The following schematically shows a flow chart of a method for calculating the quantity of materials used in a project according to an embodiment of the present invention;
[0024] Figure 2 A method flow for generating second estimated material quantity information proposed in an embodiment of the present invention is schematically shown;
[0025] Figure 3 A flowchart of a method for determining whether a target calculation result exists proposed by an embodiment of the present invention is schematically shown;
[0026] Figure 4 A flowchart of a method for calculating the quantity calculation results of multiple groups of first materials proposed in an embodiment of the present invention is schematically shown;
[0027] Figure 5 The structure diagram of a device for calculating the quantity of materials used in a project proposed in an embodiment of the present invention is schematically shown;
[0028] Figure 6 The schematic diagram shows the structure of another device for calculating the quantity of materials used in a project proposed in an embodiment of the present invention. DETAILED DESCRIPTION
[0029] The exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present invention and to fully convey the scope of the present invention to those skilled in the art.
[0030] It should be noted that, unless otherwise specified, the technical terms or scientific terms used in the present invention should have the common meanings understood by those skilled in the art to which the present invention belongs.
[0031] When the material quantity details recorded in the bill of materials in production are incomplete or some bills of materials only record the total amount of the materials in the bill of materials but do not record the material quantity, the financial staff cannot check the project cost based on the existing bill of materials information. At this time, the financial staff usually manually calculates the quantity of each material in each bill of materials in actual production based on the known relevant information, so that the estimated cost of the calculated material quantity is consistent with the actual cost recorded. Generally, the assumption method is adopted, assuming the quantity of each material in each bill of materials, multiplying the assumed material quantity by the material unit price, and estimating the cost of all materials in the bill of materials, that is, the estimated total amount of the bill of materials, where the estimated total amount of each bill of materials must be close to the actual bill of materials total amount, and the estimated total amount of all bills of materials must be close to the actual production cost of the project. This process of manual assumption and calculation is too cumbersome. When the project production amount reaches the level of one million yuan or more, manual calculation often takes several months to calculate the qualified material quantity, and the work efficiency is too low. Based on this, the inventor of this case wants to invent a material quantity calculation method that can save calculation time, preferably to replace manual calculation to improve efficiency. Therefore, the inventor determined several constraints based on repeated experiments, and established a linear programming model based on the constraints. The linear programming model can reflect an allocation rule. When the total number of materials to be allocated is defined, the material quantity of each material in each bill of materials can be solved according to the allocation rule in the linear programming model, which greatly saves manual calculation time; it also considers updating the total number of materials to be allocated through genetic algorithms to save time for manually defining the total number of materials to be allocated, and further improve calculation efficiency.
[0032] To this end, the inventor of this case proposed a method for calculating the quantity of materials used in a project. This method can use a preset material quantity linear programming model to automatically calculate the material quantity of each material in multiple groups of each bill of materials, select one group as the target calculation result based on a preset objective function, and use a genetic algorithm to automatically generate estimated material quantity information for calculating the material quantity, which greatly saves the time of manual calculation and improves calculation efficiency. A method for calculating the quantity of materials used in a project in an embodiment of the present invention, the specific steps are as follows: Figure 1 As shown, including:
[0033] 101. Obtain multiple sets of first estimated material quantity information and multiple bills of materials.
[0034] The multiple bills of materials in this step are documents that record the information of purchased materials during the production process of the project. Each bill of materials may contain information on one or more materials. Each bill of materials may include the material identification, material unit price, material quantity and actual total amount of the bill of materials of each material. The bill of materials in this solution is a bill of materials that is missing the quantity of materials used in some or all projects. Among them, the material identification of each material can be the name of the material, or it can be a number that can uniquely represent a material. Each bill of materials can also include the generation time of the bill of materials or the unique number of the bill of materials, as well as the project identification used. The financial staff will enter the data into the database in order in advance according to the generation time or the unique number of each bill of materials. When it is necessary to calculate the quantity of materials used in the project based on multiple bills of materials, the corresponding bill of materials can be obtained according to the project identification on the bill of materials, but some bills of materials may not be marked with the project identification. At this time, multiple bills of materials corresponding to the generation time can be obtained according to the production time of the project, and multiple bills of materials can also be obtained according to the unique number of the bill of materials. How to obtain it is determined according to the actual record of each bill of materials, and it is not limited here.
[0035] For the same material, the sum of the material quantities of the material in multiple bills of materials is the total number of purchases of the material in the project production process. In order to calculate the quantity of each material in each bill of materials, setting a total number for each material is more conducive to obtaining an appropriate calculation result. The material quantity in each bill of materials is allocated based on the total number of each material, which is more efficient than assuming out of thin air to infer the actual material quantity. Therefore, in this scheme, for each material used in the project, a total number is estimated in advance to form a group of estimated total numbers, which are recorded in the first estimated material quantity information. In order to prevent the error of checking the number of each material calculated based on only one group of estimated total numbers with the actual project total cost, at least two groups of estimated total numbers of each material should be estimated in advance, corresponding to the formation of at least two groups of first estimated material quantity information. The first estimated material quantity information is determined by the staff, and the basis for determination can be the ratio relationship between the materials used in the production process of each product, or the price of each material, or the loss rate of each material in the production process of previous projects. When estimating specifically, each basis can be combined at will, and at least two groups of first estimated material quantity information can be determined. The determined multiple groups of first estimated material quantity information are uploaded to the material quantity calculation device used in the project in advance in the present invention, so as to obtain the multiple groups of first estimated material quantity information when starting the calculation.
[0036] The multiple bills of material in the present invention may be one bill of material generated every month, or one bill of material generated at irregular times. When one bill of material is generated every month, when obtaining multiple bills of material, they are hierarchically stored according to the year and month of the bill of material generation time, and are arranged in the order of generation time; when the bill of material is generated at irregular times, when obtaining multiple bills of material, they are hierarchically stored according to the year, month, and day of the bill of material generation time, and are also arranged in the order of generation time.
[0037] 102. According to the estimated total in each group of estimated material quantity information, the preset material quantity linear programming model is used to calculate the quantity of each material in multiple material lists to obtain the corresponding multiple groups of material quantity calculation results.
[0038] In this step, the quantity of each material is mainly calculated based on each group of first estimated material quantity information, where the first estimated material quantity information is directly obtained and manually estimated.
[0039] After obtaining multiple sets of first estimated material quantity information, call the preset material quantity linear programming model, and perform calculations based on a set of first estimated material quantity information and multiple bills of materials each time to obtain a corresponding set of material quantity calculation results. It should be noted that the multiple bills of materials in this solution are unchanged, and each calculation is based on the same multiple bills of materials and a different set of first estimated material quantity information. The current set of material quantity calculation results is output and cached, and then calculations are started based on the next set of estimated material quantity information and multiple bills of materials to obtain a corresponding set of material quantity calculation results. The calculation of each material quantity is completed based on multiple sets of first estimated material quantity information in sequence, and finally multiple sets of first material quantity calculation results corresponding in sequence will be obtained. Among them, the calculation order of multiple sets of first estimated material quantity information can be random, or it can be based on the number marked when each set of first estimated material quantity information is generated.
[0040] When calculating the quantity of each item in multiple bills of material based on each group of first estimated material quantity information, the quantity of each item in each bill of material can be calculated by using multiple bills of material together or by using bills of material one by one. When multiple bills of material are calculated together, the sum of the quantity of each item in the multiple bills of material calculated should not exceed the total estimated quantity recorded in the first estimated material quantity information of the current group. When calculating bills of material one by one, the order of calculating multiple bills of material should be fixed, that is, when calculating based on each group of first estimated material quantity information, the order of calculating multiple bills of material should be consistent, for example, each group should be calculated in the order of bill of material 1, bill of material 2, and bill of material 3. Since the estimated total in the first estimated material quantity information is the sum of the quantities of each material in all material bills, the quantity of each material in each material bill cannot exceed the estimated total, that is, the estimated total can be used as the maximum value limit basis for calculating the quantity of each material. Specifically, the maximum value of the quantity of each material in the first material bill can be the estimated total, and the maximum value of the quantity of each material in the subsequent material bill is the maximum value of the quantity of each material in the previous material bill minus the quantity of each material in the previous material bill.
[0041] 103. Use a preset objective function to determine whether there is a target calculation result for the material quantity among multiple groups of material quantity calculation results.
[0042] In this step, it is mainly to determine whether there is a target calculation result of the material quantity among the multiple sets of first material quantity calculation results obtained by calculation using a preset objective function. If it can be determined that there is a target calculation result among the multiple sets of first material quantity calculation results, the target calculation result is subsequently determined as the material quantity used for the project.
[0043] The preset objective function can be used to verify whether the target calculation result meets the preset conditions that must be met, and is used to screen a group of material quantity calculation results that meet the preset conditions among multiple groups of first material quantity calculation results. Among them, it can be that all first material quantity calculation results are fully verified, and one or more groups of first material quantity calculation results that meet the preset conditions may be obtained. When multiple groups of first material quantity calculation results that meet the preset conditions are obtained, the preset objective function is continued to be used to select the most compliant group as the target calculation result; it can also be that each group of first material quantity calculation results is verified in turn, as long as the current group of material quantity calculation results being verified meets the preset conditions of the target calculation result, the verification is terminated, and the current group of material quantity calculation results is determined as the target calculation result.
[0044] 104. If not, use a genetic algorithm to generate multiple sets of second estimated material quantity information.
[0045] When there is no target calculation result in multiple sets of first material quantity calculation results, it means that the estimated total number of each material in multiple bills of materials cannot be reasonably obtained based on the estimated total number in the multiple sets of first estimated material quantity information estimated in advance. At this time, it is necessary to obtain new estimated material quantity information to continue calculation to determine the target calculation result. In order to save estimation time, this solution chooses to use genetic algorithms to automatically generate multiple sets of second estimated material quantity information.
[0046] It should be noted that the second estimated material quantity information here can obtain the second material quantity calculation result based on the calculation of the quantity of each material in multiple material lists, and the second material quantity calculation result contains the target calculation result. However, the second estimated material quantity information does not refer to the second multiple groups of estimated material quantity information calculated by the genetic algorithm, nor does it refer to the multiple groups of estimated material quantity information calculated by the genetic algorithm for the second time. It only represents the multiple groups of estimated material quantity information that can obtain the target calculation result based on the calculation. Before obtaining the second estimated material quantity information, it is possible to obtain other multiple groups of estimated material quantity information according to the genetic algorithm, but the other multiple groups of estimated material quantity information cannot calculate the target calculation result. Perform one or more iterative calculations according to the genetic algorithm until the generated second estimated material quantity information can make the multiple groups of second material quantity calculation results calculated based on it contain the target calculation result. Among them, the number of groups of estimated material quantity information generated each time is set before the calculation starts.
[0047] The above calculation process is explained below by an example: if the target calculation result does not exist in the first material quantity calculation result, then the genetic algorithm is used to calculate and generate new multiple groups of estimated material quantity information for the first time; after the new multiple groups of estimated material quantity information are generated, steps 102 and 103 are executed again, that is, the quantity of each material in the multiple material lists is calculated again to obtain the corresponding new multiple groups of material quantity calculation results; the preset objective function is used to determine whether the target calculation result of the material quantity exists in the new multiple groups of material quantity calculation results. If so, the new multiple groups of estimated material quantity information is the aforementioned second estimated material quantity information; if not, the genetic algorithm is continued to be used for the second calculation to generate multiple groups of estimated material quantity information, and steps 102-103 are executed until it can be determined that the target calculation result exists based on the multiple groups of estimated material quantity information generated at a certain time, and the multiple groups of estimated material quantity information this time is the second estimated material quantity information in this solution. In short, steps 102-104 can be a cyclic process, but it is a finite cycle, and the stop condition is to determine the target calculation result.
[0048] 105. Determine the target calculation result as the quantity of materials used in the project.
[0049] If, when step 103 is executed for the first time, it is determined that there is a target calculation result in the first material quantity calculation result, then step 104 does not need to be executed, and this step is directly executed, that is, the target calculation result is determined as the material quantity used for the project. If step 104 generates multiple sets of second estimated material quantity information through the genetic algorithm, and the target calculation result is determined when step 103 is executed again in a loop, the target calculation result determined in step 103 this time is determined as the material quantity used for the project.
[0050] The finalized quantity of materials used in the project can reflect the quantity of each item in each bill of materials. For example, the quantity of the nth item in the mth bill of materials is x.
[0051] Based on the above Figure 1 It can be seen from the implementation method that the preset material quantity linear programming model in this solution can realize the automatic calculation of the quantity of each material in multiple material lists, which is more convenient for calculating multiple groups of material quantity calculation results, and a set of target calculation results can be screened out by using the preset objective function. The multiple-choice method can make the obtained target calculation results more in line with the requirements. It also automatically generates multiple groups of second estimated material quantity information by combining with genetic algorithms, saving the time of manually planning the second estimated material quantity information. By combining the material quantity linear programming model with the genetic algorithm, the calculation can be automatically performed from the beginning of the calculation until the target calculation result that meets the conditions is obtained. Compared with manual calculation, it greatly saves calculation time and improves calculation efficiency.
[0052] Furthermore, according to the above Figure 1 In the embodiment of the present invention shown in FIG. 1 , regarding the specific process of using a genetic algorithm to generate multiple sets of second estimated material quantity information, the embodiment of the present invention will be described in more detail, and the specific steps are as follows: Figure 2 As shown, including:
[0053] 201. Obtain the matching relationship between the various materials used in the project and the price gradient of each material.
[0054] In this step, the price gradient of each material mainly reflects the price of each material, and is reflected in the price range. The lower the price range, the lower the price gradient. For example, the material price range of 1-10 yuan is the first price gradient, and the material price range of 10-100 yuan is the second price gradient. How to divide the price gradient and how many price gradients are divided are not limited here. The price gradient is artificially divided by the staff based on actual experience, and is entered in advance into the material quantity calculation device used in the project in this plan, which is used to be directly obtained in this step. The ratio relationship between the materials is determined according to the actual products produced. For example, a certain product uses 1 material A and 2 materials B, that is, the ratio relationship between materials A and B is 1:2.
[0055] 202. Determine individual screening conditions based on matching relationships and price gradients.
[0056] If the current multiple groups of estimated material quantity information cannot obtain the target calculation results, new multiple groups of estimated material quantity information are calculated according to the genetic algorithm. However, before the calculation, it is necessary to retain the more preferred multiple groups of estimated material quantity information, and use the individual screening conditions to filter out the relatively poor one or more groups of estimated material quantity information, so that the more preferred multiple groups of estimated material quantity information retained after the screening can be used as the parent individual for the next iterative calculation to obtain multiple new child individuals, that is, to obtain new multiple groups of estimated material quantity information.
[0057] The above-obtained matching relationship and price gradient are used to determine the individual screening conditions. The specific determination method can be to increase the proportion value of the material with a lower price gradient based on the obtained matching ratio, or to lower the proportion value of the material with a higher price gradient. The specific increase or decrease can be determined according to the arrangement of the price gradient. For example, all price gradients are arranged in order from low to high in price, starting from the first price gradient, and each price gradient corresponds to an increased or lowered proportion value, such as the first price gradient corresponds to increasing the proportion value by 0.5, the second price gradient corresponds to increasing the proportion value by 0.4, the fifth price gradient corresponds to increasing the proportion value by 0, the sixth price gradient corresponds to lowering the proportion value by 0.1, and the seventh price gradient corresponds to lowering the proportion value by 0.2. The above matching ratio adjustment method is only an example, and the specific adjustment value and price gradient are divided into several to be determined according to the actual products produced and all the materials required for the products. A proportion adjustment table can be prepared in advance by the staff, which stores the price gradient to which each material belongs and the proportion value that can be adjusted for each price gradient. The content stored in the ratio adjustment table can be used not only for the current project, but also for other projects. If new materials appear in other projects, the new materials and the corresponding price gradients can be added to the ratio adjustment table.
[0058] After the adjusted ratio is readjusted based on the original ratio, a threshold range can be set for the adjusted ratio. For example, if the adjusted ratio is 1.2:2.2, a threshold range of 1.2 (±0.02):2.2 (±0.02) can be set. The estimated material quantity information that meets this threshold range can be retained after screening for the next iteration. The specific setting value of the threshold range is determined according to the actual situation of each material, and no specific value is limited here.
[0059] 203. Filter multiple groups of estimated material quantity information based on preset filtering conditions to obtain multiple parent individuals.
[0060] This step can be performed before each iteration begins.
[0061] Take the first iteration as an example: based on the preset screening conditions, multiple groups of first estimated material quantity information are screened to obtain multiple initial parent individuals, and the multiple initial parent individuals are integer-encoded to form an initial population.
[0062] Before the Nth iteration begins, multiple groups of estimated material quantity information obtained in the N-1th iteration are screened using preset screening conditions to obtain multiple parent individuals after screening.
[0063] If the number of parent individuals remaining after screening is less than half of the multiple groups of estimated material quantity information before screening, a portion of the estimated material quantity information that is more in line with the preset screening conditions will be retained so that the number of parent individuals after screening is completed to half of the multiple groups of estimated material quantity information before screening.
[0064] When screening multiple groups of estimated material quantity information, the screening conditions can also be to first determine one or more groups of material quantity calculation results that do not meet the preset objective function, and then discard the corresponding one or more groups of estimated material quantity information, and retain the remaining multiple groups of estimated material quantity information as multiple parent individuals for the next iteration.
[0065] 204. Based on a preset number of iterations and a preset stop condition, a plurality of sets of second estimated material quantity information are generated by performing crossover and mutation operations on the population for iteration.
[0066] In the present invention, the population can be crossovered by a single-point crossover, a uniform crossover, or other crossover methods. In the present embodiment, a uniform crossover is used. Before starting the iteration, a maximum number of iterations and a stop condition for each iteration are set. The preset number of iterations can stop the iteration when multiple sets of second estimated material quantity information are not obtained after the number of iterations. After the iteration is stopped, the staff can manually adjust the individual gene values used to participate in the iteration. The preset stop condition can stop the iteration when the result of each iteration meets the stop condition.
[0067] In this step, it specifically includes performing crossover and mutation operations based on the initial population to perform the first iteration, stopping the first iteration when the preset stop condition is met, obtaining the first iteration result, decoding it, and obtaining multiple sets of estimated material quantity information. If the material quantity calculation results obtained by calculating the multiple sets of estimated material quantity information obtained by the first iteration contain the target calculation results, the iteration is terminated, and the multiple sets of estimated material quantity information obtained this time are multiple sets of second estimated material quantity information; if the material quantity calculation results obtained by calculating the multiple sets of estimated material quantity information obtained by the first iteration do not contain the target calculation results, the second iteration is performed until the result of a certain iteration can calculate the target calculation result, at which time the iteration is terminated, and the multiple sets of estimated material quantity information corresponding to the last iteration result are multiple sets of second estimated material quantity information.
[0068] Based on the above Figure 2 It can be seen from the implementation method that the process of using genetic algorithm to calculate and generate multiple groups of second estimated material quantity information can also continuously eliminate poor estimated material quantity information, and iterate using the better estimated material quantity information obtained by screening, so as to obtain more preferred multiple groups of second estimated material quantity information, further improving the efficiency of obtaining the target calculation results.
[0069] Furthermore, according to the above Figure 1 In the embodiment of the present invention shown in FIG. 1 , regarding the process of determining whether there is a target calculation result of the material quantity in multiple sets of first material quantity calculation results using a preset target function, the embodiment of the present invention will be described in more detail, and the specific steps are as follows: Figure 3 As shown, including:
[0070] 301. Based on the generation order of the multiple groups of first material quantity calculation results, check in sequence whether the multiple groups of first material quantity calculation results meet a preset objective function.
[0071] Since the first material quantity calculation results are calculated based on each group of first estimated material quantity information one by one, the first material quantity calculation results are also generated one by one. In order to verify multiple groups of first material quantity calculation results in a more orderly and efficient manner, based on the generation order of multiple groups of first material quantity calculation results, multiple groups of first material quantity calculation results are verified in sequence to see whether they meet the preset objective function. Among them, it can be that after all groups of first material quantity calculation results are calculated, they are verified in sequence according to the generation order; it can also be that the first material quantity calculation results and the verification of whether they meet the preset objective function are generated at the same time, and each time a group of first material quantity calculation results is generated, it is verified whether it meets the preset objective function. If it is satisfied, the first material quantity calculation results of other groups being calculated can be terminated in advance.
[0072] Before using the preset objective function for verification, you must first determine the preset objective function to be used. In this solution, the preset objective function is:
[0073] Z m =∑X mn Y mn ,m,n∈N;
[0074]
[0075] Among them, X mn is the unit price of the nth item in the mth bill of materials, Y mn is the material quantity calculation result of the nth material in the mth material bill, C is the actual total cost of the materials used in the project, and Z m It is the calculated total amount of the mth bill of material based on the material quantity calculation result. F is the value to be verified. The value to be verified is the difference between the calculated total cost of the materials used in the project obtained based on the current first material quantity calculation result and the actual total cost of the materials used in the project.
[0076] In addition to the preset objective function, information to be verified to be verified using the preset objective function is also obtained, and the information to be verified includes a set of first material quantity calculation results and multiple material lists to be verified.
[0077] Substituting the value in the material information to be verified into the corresponding position in the preset objective function, a value to be verified can be obtained. By verifying whether the value to be verified meets the preset threshold, it can be determined whether the total cost of materials used in the project calculated based on the current calculation result of the first material quantity is close to the actual total cost of materials used in the project. The size of the preset threshold can be set according to the tolerance range allowed in the actual project. The specific value is not limited here, but both ends of the threshold cannot be less than 0.
[0078] If the value to be verified corresponding to the current first material quantity calculation result is within the preset threshold, the current first material quantity calculation result satisfies the preset objective function; if the value to be verified corresponding to the current first material quantity result is not within the preset threshold, the current first material quantity calculation result does not satisfy the preset objective function. The preset objective function and the preset threshold can be used to verify all groups of material quantity calculation results, not only for verifying multiple groups of first material quantity calculation results.
[0079] In addition to using only the preset objective function for verification, some first material quantity calculation results that are more in line with the actual situation can also be screened out before using the preset objective function for verification. Specifically, among the multiple bills of materials involved in the project, some bills of materials will record the actual quantity of each material, that is, the actual quantity of each material that is not missing in the multiple bills of materials, and they will be obtained. The acquisition method can be based on whether there is a record in the material quantity column in the bill of materials. If there is a record, the corresponding quantity and the material identification to which it belongs are obtained. The calculated quantity of materials with the same material identification in each group of first material quantity calculation results is compared with the actual quantity of the material. If the comparison results are consistent, it means that the first material calculation results of this group are more in line with the actual quantity of each material, and they are retained, and it is verified whether the retained first material quantity calculation results meet the preset objective function.
[0080] 302. If the current calculation result of the first material quantity satisfies the preset target function, the verification is terminated, and the current calculation result of the first material quantity is determined as the target calculation result.
[0081] In this embodiment, no matter whether the first material quantity calculation result currently being verified is the first group or the last group, as long as the value to be verified corresponding to the current first material quantity calculation result meets the preset threshold, the preset objective function is satisfied, the verification operation can be stopped, and the current first material quantity calculation result is determined as the target calculation result.
[0082] 303. If the plurality of sets of first material quantity calculation results do not satisfy the preset objective function, then there is no target calculation result in the plurality of sets of first material quantity calculation results.
[0083] If the multiple groups of values to be verified corresponding to the multiple groups of first material quantity calculation results do not meet the preset threshold, then the multiple groups of first material quantity calculation results do not meet the preset objective function, and it can be determined that there is no target calculation result in the multiple groups of first material quantity calculation results. At this time, an operation of generating multiple groups of second estimated material quantity information using a genetic algorithm can be performed to determine whether there is a target calculation result in the corresponding second material quantity calculation results.
[0084] Based on the above Figure 3 It can be seen from the implementation method that by verifying whether each group of first material quantity calculation results meets the preset objective function, it can be determined whether the calculated total cost of the materials used in the project corresponding to the first material calculation results is close to the actual total cost, that is, it can be determined to obtain a set of target calculation results that meet the conditions more, which further improves the calculation efficiency of the target calculation results and determines the detailed quantity of materials used in the project more quickly.
[0085] Furthermore, according to the above Figure 1 In the embodiment of the present invention shown in FIG. 1 , regarding the process of calculating the quantity of each material in multiple bills of materials using a preset material quantity linear programming model according to the estimated total in each group of first estimated material quantity information, and obtaining the corresponding multiple groups of first material quantity calculation results, the embodiment of the present invention will be described in more detail, and the specific steps are as follows: Figure 4 As shown, including:
[0086] 401. Determine the maximum quantity of each material in the current material list according to the estimated total in the current first estimated material quantity information.
[0087] For the same material, the sum of the material quantities of this material in all material lists should not exceed the total number of this material in the estimated total number. Therefore, the estimated total number in the first estimated material quantity information can be used to define the maximum material quantity of each material.
[0088] Since this solution calculates the quantity of each material in multiple bills of material in sequence, after the calculation of the current bill of material is completed, the maximum quantity of each material in the next bill of material should be subtracted from the quantity of each material in the previous bill of material. Specifically, when determining the maximum quantity of each material in each bill of material, it can be determined based on whether the current bill of material is the first bill of material. If the current bill of material is the first bill of material, the estimated total in the first estimated material quantity information is determined to be the maximum quantity of each material in the current bill of material; if the current bill of material is not the first bill of material, the maximum quantity of each material in the previous bill of material is subtracted from the maximum quantity of each material in the previous bill of material to obtain the maximum quantity of each material in the current bill of material. It should be noted that the maximum quantity of each material in each bill of material should be the maximum quantity of all materials used in the project. Even if a material is not recorded in the current bill of material, the maximum quantity of the material of the unrecorded material must be determined so that the subsequent bill of material can calculate the maximum quantity of each material based on this.
[0089] Since the first bill of materials may only include a few of the materials used in the project, the first appearance of the material may exist in the second or subsequent bill of materials. In this case, the maximum quantity of the material should be the estimated total quantity of the material. Therefore, if the current bill of materials is not the first bill of materials, when determining the maximum quantity of each material in the current bill of materials, the material ID and material quantity 0 of other materials used in the project not recorded in the previous bill of materials can be added to the quantity of each material in the previous bill of materials after the calculation of the material quantity of the previous bill of materials is completed, based on all the materials used in the project that have been counted in advance, so that the current bill of materials can calculate the maximum quantity of each material in the current bill of materials based on the quantity of each material in the complete previous bill of materials. Alternatively, if a material not recorded in the previous bill of materials is identified in the current bill of materials, and the maximum quantity of the material in the current bill of materials cannot be calculated based on the quantity of each material in the previous bill of materials, then based on the material ID of the material, the maximum quantity of the material in the maximum quantity of each material in the previous bill of materials is directly determined as the maximum quantity of the material in the current bill of materials.
[0090] 402. Input the maximum quantity of each material in the current material list and the material identification, unit price, and total amount of the material list of the current material list into the preset material quantity linear programming model, and calculate the quantity of each material in the current material list based on the constraints in the preset material quantity linear programming model.
[0091] In this step, the constraints in the preset material quantity linear programming model must be determined first. The constraints in this embodiment include the following:
[0092] |∑Xn Y n -K|<0.1, n∈N,
[0093] X n ≥0, n∈N,
[0094] min(W n -Y n )≥0,n∈N,
[0095] max(W n -Y n )≤max(W n ), n∈N;
[0096] Among them, X n is the unit price of the nth item in the current bill of materials, Y n is the calculation result of the nth material in the current material list, K is the total amount of the material list in the current material list, and W n The maximum quantity of the nth item in the current bill of materials.
[0097] The above constraints ensure that the difference between the calculated total amount of each bill of material obtained by multiplying the material quantity of each material in each bill of material by the material unit price and the actual total amount of the bill of material is less than 0.1; the difference between the maximum quantity of each material and the quantity of each material is at least 0 and cannot exceed the maximum material quantity.
[0098] The material identification in the present invention can be a material name or a material number that can uniquely refer to the material. The unit price of the material in each bill of materials may be recorded in the bill of materials or may not be recorded. If the unit price of the material is not clearly recorded in the bill of materials, it is necessary to query the corresponding unit price of the material based on the date when the bill of materials was generated. If the current bill of materials records a clear date, the unit price of the material on that day can be queried based on network information; if the current bill of materials only records the month, and the unit price of the material in that month fluctuates, the average unit price of the material in that month can be taken. The queried unit prices of the materials and the unit prices of the materials recorded in the bill of materials are arranged in chronological order and stored in a hierarchical manner.
[0099] Before starting to use the preset material quantity linear programming model to calculate the quantity of each material in multiple bills of materials, it also includes establishing the preset material quantity linear programming model. At present, a linear programming model can be established by a variety of modeling tools, such as Python, CPLEX, MATLAB, etc. In the present embodiment, the CPLEX modeling tool is selected to establish the material quantity linear programming model. First, the CPLEX modeling tool is used to create a material quantity linear programming model file, and then the solution algorithm to be used is selected, such as a heuristic algorithm, a branch and bound method, etc., and then multiple variables defined in advance and related constraints are input, and finally the material quantity linear programming model file is saved, that is, the establishment of the preset material quantity linear programming model is completed. The input of the preset linear programming model includes the estimated total number in the estimated material quantity information, the material identification in the bill of materials, the material unit price, and the total amount of the bill of materials, and the output is the quantity of each material in each bill of materials.
[0100] When using the preset linear programming model to calculate the quantity of each material, due to the different estimated totals input and the fact that the quantity of each material calculated by this solution should be an integer, there may be some bills of materials where the calculation results of the quantity of each material are empty. At this time, the bill of materials may not belong to the project being calculated this time, but the corresponding empty calculation results must be output. The financial staff will then decide whether the bill of materials belongs to this project.
[0101] 403. Calculate the quantity of each material in the next bill of material using the quantity of each material in the current bill of material, until multiple bills of material are calculated based on the current first estimated material quantity information, and obtain a set of current material quantity calculation results.
[0102] According to the current first estimated material quantity information, the quantity of each material in multiple material lists is calculated in sequence. When all material lists are calculated, a set of current material quantity calculation results corresponding to the current first estimated material quantity information is obtained.
[0103] 404. Calculation is completed based on the multiple sets of first estimated material quantity information, and multiple sets of first material quantity calculation results are obtained.
[0104] Each group of first material quantity calculation results calculated based on each group of first estimated material quantity information can be cached in the database first, and after the last group of first material quantity calculation results are generated, multiple groups of first material quantity calculation results are formed for subsequent verification using a preset objective function to determine whether there is a target calculation result. Alternatively, when calculating the second group of material quantity calculation results, the first group of material quantity calculation results are transmitted to the verification module to verify whether it is the target calculation result using a preset objective function.
[0105] Based on the above Figure 4It can be seen from the implementation method that in this embodiment, when setting the constraint conditions, the difference between the calculated total amount of the material bill and the actual total amount of the material bill for each material bill is set to be less than 0.1, that is, a relatively small range is constrained. The material quantity calculation result calculated using this constraint condition can make the calculated total cost of the entire project closer to the actual total cost, that is, the calculated target calculation result is more in line with the actual situation, and the calculated material quantity used in the project is more accurate, which can reduce unnecessary calculation processes and screening processes, and greatly improve the calculation efficiency.
[0106] Furthermore, as a response to the above Figure 1-4 The implementation of the method embodiment shown in the figure, the embodiment of the present invention provides a device for calculating the quantity of materials used in a project, and the device is used to automatically calculate the material quantity details of the materials used in the project. The embodiment of the device corresponds to the aforementioned method embodiment. For ease of reading, this embodiment will no longer repeat the details of the aforementioned method embodiment one by one, but it should be clear that the device in this embodiment can correspond to all the contents of the aforementioned method embodiment. Specifically, Figure 5 As shown, the device comprises:
[0107] The acquisition unit 51 is used to acquire multiple sets of first estimated material quantity information and multiple material lists, each set of first estimated material quantity information includes the estimated total number of each material and the material quantity used for the missing item in the material list;
[0108] The calculation unit 52 is used to calculate the quantity of each material in the multiple bills of materials obtained by the obtaining unit 51 according to the estimated total number in each group of first estimated material quantity information obtained by the obtaining unit 51, using a preset material quantity linear programming model to obtain corresponding multiple groups of first material quantity calculation results;
[0109] A first determining unit 53 is used to determine whether there is a target calculation result of the material quantity among the multiple groups of first material quantity calculation results calculated by the calculating unit 52 by using a preset target function;
[0110] a generating unit 54 configured to generate a plurality of sets of second estimated material quantity information by using a genetic algorithm if the first determining unit 53 determines that there is no target material quantity calculation result in the plurality of sets of first material quantity calculation results, so as to determine the target calculation result according to the corresponding calculation results;
[0111] The second determining unit 55 is used to determine the target calculation result determined by the first determining unit 53 as the material quantity used for the project.
[0112] Further, such as Figure 6 As shown, the first determining unit 53 includes:
[0113] A verification module 531 is used to verify, based on the generation order of the multiple sets of first material quantity calculation results, whether the multiple sets of first material quantity calculation results meet a preset objective function;
[0114] The determination module 532 is used to terminate the verification and determine the current first material quantity calculation result as the target calculation result if the verification module 531 verifies that the current first material quantity calculation result satisfies the preset target function;
[0115] The determination module 532 is further configured to determine that there is no target calculation result in the multiple sets of first material quantity calculation results if none of the multiple sets of first material quantity calculation results obtained by the verification module 531 satisfy a preset target function.
[0116] Further, such as Figure 6 As shown, the verification module 531 includes:
[0117] The acquisition submodule 5311 is used to acquire the material information to be verified, where the material information to be verified includes the current first material quantity calculation result to be verified and multiple material lists;
[0118] The substitution submodule 5312 is used to substitute the material information to be verified obtained by the acquisition submodule 5311 into the preset objective function to obtain the value to be verified;
[0119] A verification submodule 5313 is used to verify whether the value to be verified obtained by substituting into the submodule 5312 meets a preset threshold;
[0120] The first determination submodule 5314 is used to determine that the current calculation result of the first material quantity satisfies a preset objective function if the value to be verified obtained by the verification submodule 5313 satisfies a preset threshold value;
[0121] The verification submodule 5313 is also used to verify whether the next set of first material quantity calculation results meets a preset target function if the verified value does not meet a preset threshold.
[0122] Further, such as Figure 6 As shown, the verification module 531 also includes:
[0123] The second determination submodule 5315 is used to determine a preset objective function.
[0124] Further, such as Figure 6 As shown, the first determination unit 53 further includes a comparison module 533, and the comparison module 533 includes:
[0125] The acquisition submodule 5331 is used to obtain the actual quantity of each material that is not missing in multiple material lists;
[0126] The comparison submodule 5332 is used to compare the calculated quantities of corresponding materials in the multiple groups of first material quantity calculation results with the actual quantities obtained by the obtaining submodule 5331;
[0127] The verification submodule 5333 is used to retain the first material quantity calculation result determined by the comparison submodule 5332 that matches the actual quantity, and to verify whether the first material quantity calculation result satisfies a preset objective function.
[0128] Further, such as Figure 6 As shown, the generating unit 54 includes:
[0129] The acquisition module 541 is used to acquire the matching relationship between various materials used in the project and the price gradient of various materials;
[0130] The determination module 542 is used to determine the individual screening conditions according to the matching relationship and the price gradient obtained by the acquisition module 541. The individual screening conditions are used to screen and determine the parent individuals before each iteration;
[0131] A screening module 543 is used to screen multiple groups of first estimated material quantity information based on the preset screening conditions determined by the determination module 542, obtain multiple initial parent individuals, and form an initial population through integer coding;
[0132] The calculation module 544 is used to generate multiple sets of second estimated material quantity information based on a preset number of iterations and a preset stopping condition by performing crossover and mutation operations on the initial population screened by the screening module 543 for iteration. The preset number of iterations is the maximum number of iterative operations, and the preset stopping condition is the condition for stopping each iteration.
[0133] Further, such as Figure 6 As shown, the calculation unit 52 includes:
[0134] A first determination module 521 is used to determine the maximum quantity of each material in the current material list according to the estimated total number in the current first estimated material quantity information;
[0135] The calculation module 522 is used to input the maximum quantity of each material in the current material list determined by the first determination module 521 and the material identification, unit price, and total amount of the material list of the current material list into the preset material quantity linear programming model, and calculate the quantity of each material in the current material list based on the constraints in the preset material quantity linear programming model;
[0136] The calculation module 522 is further used to calculate the quantity of each material in the next material bill using the quantity of each material in the current material bill, until multiple material bills are calculated according to the current first estimated material quantity information to obtain a set of current material quantity calculation results;
[0137] The calculation module 522 is further used to perform calculations based on multiple sets of first estimated material quantity information in sequence to obtain multiple sets of first material quantity calculation results.
[0138] Further, such as Figure 6 As shown, the first determining module 521 includes:
[0139] The first determination submodule 5211 is configured to determine that the estimated total in the first estimated material quantity information is the maximum quantity of each material in the current material bill if the current material bill is the first material bill;
[0140] The second determination submodule 5212 is used to, if the current material bill is not the first material bill, subtract the maximum quantity of each material in the previous material bill from the maximum quantity of each material in the previous material bill to obtain the maximum quantity of each material in the current material bill.
[0141] Further, such as Figure 6 As shown, the calculation unit 52 also includes:
[0142] The second determining module 523 is used to determine the constraint condition.
[0143] Further, such as Figure 6 As shown, the device further includes a creation unit 56, and the creation unit 56 includes:
[0144] A creation module 561 is used to create a material quantity linear programming model file using a CPLEX modeling tool;
[0145] A definition module 562 is used to select a solution algorithm and define multiple variables and multiple constraints in the material quantity linear programming model file created by the creation module 561, wherein the multiple variables are the quantities of each material in multiple bills of materials, and the constraints include the association between the quantities of each material in multiple bills of materials and the estimated material quantity information, and the association between the quantities of each material in multiple bills of materials and the material identification, unit price, and total amount of the bill of materials in the corresponding bill of materials;
[0146] The generation module 563 is used to generate a preset material quantity linear programming model according to the material quantity linear programming model file defined by the definition module 562. The material quantity linear programming model is used to calculate the quantity of each material in the material list according to the input estimated material quantity information.
[0147] Furthermore, an embodiment of the present invention also provides a computing device, the computing device comprising: at least one processor, and a memory, wherein the memory stores instructions executable by the processor, the instructions are executed by the processor, so that the processor can perform the above-mentioned Figure 1-4 The method for calculating the quantity of materials used in the project described in .
[0148] Furthermore, an embodiment of the present invention further provides a readable storage medium, wherein the readable storage medium is used to store a computer program, wherein when the computer program is running, the device where the storage medium is located is controlled to execute the above Figure 1-4 The method for calculating the quantity of materials used in the project described in .
[0149] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0150] It is understandable that the related features in the above methods and devices can be referenced to each other. In addition, the "first", "second" and the like in the above embodiments are used to distinguish the embodiments, but do not represent the advantages and disadvantages of the embodiments.
[0151] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0152] The algorithm and display provided herein are not inherently related to any particular computer, virtual system or other device. Various general purpose systems can also be used together with the teachings based on this. According to the above description, it is obvious that the structure required for constructing such systems. In addition, the present invention is not directed to any specific programming language either. It should be understood that various programming languages can be utilized to realize the content of the present invention described herein, and the description of the above specific languages is for disclosing the best mode of the present invention.
[0153] In addition, the memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0154] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0155] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0156] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0157] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0158] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0159] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0160] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0161] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0162] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0163] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A method for calculating the quantity of materials used in a project, characterized in that: The method comprises: Acquire multiple sets of first estimated material quantity information and multiple material lists, each set of the first estimated material quantity information includes the estimated total number of each material, and the material quantity used for the missing item in the material list; According to the estimated total number in each group of the first estimated material quantity information, the preset material quantity linear programming model is used to calculate the quantity of each material in the multiple material lists to obtain corresponding multiple groups of first material quantity calculation results; Determining whether there is a target calculation result of the material quantity in the plurality of groups of first material quantity calculation results by using a preset objective function; If not, using a genetic algorithm to generate multiple sets of second estimated material quantity information, so as to determine the target calculation result according to the corresponding calculation results; The target calculation result is determined as the quantity of materials used in the project.
2. The method according to claim 1, characterized in that The determining whether there is a target calculation result of the material quantity in the plurality of groups of first material quantity calculation results by using a preset target function includes: Based on the generation order of the plurality of groups of first material quantity calculation results, sequentially verifying whether the plurality of groups of first material quantity calculation results satisfy the preset objective function; If the current calculation result of the first material quantity satisfies the preset target function, the verification is terminated, and the current calculation result of the first material quantity is determined as the target calculation result; If none of the multiple groups of first material quantity calculation results satisfies the preset objective function, then the target calculation result does not exist in the multiple groups of first material quantity calculation results.
3. The method according to claim 2, characterized in that The verifying whether the plurality of groups of first material quantity calculation results satisfy the preset objective function includes: Acquire information of materials to be verified, wherein the information of materials to be verified includes a calculation result of the quantity of the current first material to be verified and the multiple bills of materials; Substituting the material information to be verified into the preset objective function to obtain the value to be verified; Checking whether the value to be checked meets a preset threshold; If so, determining that the current calculation result of the first material quantity satisfies the preset objective function; If not, then check whether the next set of first material quantity calculation results meets the preset objective function.
4. The method according to any one of claims 2 to 3, characterized in that: The method further comprises: Obtaining the actual quantity of each material that is not missing in the multiple bills of material; Comparing the calculated quantities of corresponding materials in the plurality of sets of first material quantity calculation results with the actual quantities; The first material quantity calculation result that matches the actual quantity is retained, and it is verified whether the first material quantity calculation result satisfies the preset objective function.
5. The method according to claim 1, characterized in that The method of generating multiple sets of second estimated material quantity information by using a genetic algorithm includes: Obtain the matching relationship between the materials used in the project and the price gradient of each material; Determine individual screening conditions according to the matching relationship and the price gradient, and the individual screening conditions are used to screen and determine the parent individuals before each iteration; Based on the preset screening conditions, the plurality of groups of first estimated material quantity information are screened to obtain a plurality of initial parent individuals, and an initial population is formed through integer coding; Based on a preset number of iterations and a preset stop condition, the multiple groups of second estimated material quantity information are generated by performing crossover and mutation operations on the initial population for iteration, wherein the preset number of iterations is the maximum number of iteration operations, and the preset stop condition is the condition for stopping each iteration.
6. The method according to claim 1, characterized in that According to the estimated total number in each group of the first estimated material quantity information, the quantity of each material in the multiple bills of materials is calculated using a preset material quantity linear programming model to obtain corresponding multiple groups of first material quantity calculation results, including: Determine the maximum quantity of each material in the current material list according to the estimated total in the current first estimated material quantity information; Input the maximum value of each material quantity in the current material list and the material identification, unit price, and total amount of the material list of the current material list into the preset material quantity linear programming model, and calculate the quantity of each material in the current material list based on the constraints in the preset material quantity linear programming model; Calculating the quantity of each material in the next bill of material by using the quantity of each material in the current bill of material, until the calculation of the multiple bills of material is completed according to the current first estimated material quantity information, and obtaining a set of current material quantity calculation results; Calculations are performed based on the multiple sets of first estimated material quantity information in sequence to obtain the multiple sets of first material quantity calculation results.
7. The method according to claim 6, characterized in that The method further comprises: Use CPLEX modeling tools to create material quantity linear programming model files; In the material quantity linear programming model file, a solution algorithm is selected and multiple variables and multiple constraints are defined, wherein the multiple variables are the quantities of each material in multiple bills of materials, and the constraints include the association between the quantities of each material in the multiple bills of materials and the estimated material quantity information, and the association between the quantities of each material in the multiple bills of materials and the material identification, unit price, and total amount of the bill of materials in the corresponding bills of materials; The preset material quantity linear programming model is generated according to the material quantity linear programming model file, and the material quantity linear programming model is used to calculate the quantity of each material in the material list according to the input estimated material quantity information.
8. A device for calculating the quantity of materials used in a project, characterized in that: The device comprises: an acquisition unit, configured to acquire multiple sets of first estimated material quantity information and multiple material lists, each set of the first estimated material quantity information including the estimated total number of each material and the quantity of materials used for the missing items in the material list; a calculation unit, configured to calculate the quantity of each material in the multiple bills of materials obtained by the obtaining unit according to the estimated total number in each group of the first estimated material quantity information obtained by the obtaining unit, using a preset material quantity linear programming model, to obtain corresponding multiple groups of first material quantity calculation results; A first determining unit, configured to determine whether there is a target calculation result of the material quantity among the multiple groups of first material quantity calculation results calculated by the calculation unit by using a preset objective function; a generating unit, configured to generate a plurality of sets of second estimated material quantity information by using a genetic algorithm if the first determining unit determines that there is no target material quantity calculation result in the plurality of sets of first material quantity calculation results, so as to determine the target material quantity calculation result according to the corresponding calculation results; The second determining unit is used to determine the target calculation result determined by the first determining unit as the quantity of materials used in the project.
9. A computing device, characterized in that The computing device includes: at least one processor, and a memory, wherein the memory stores instructions that can be executed by the processor, and the instructions are executed by the processor, so that the processor can execute a method for calculating the quantity of materials used in a project as described in any one of claims 1-7.
10. A readable storage medium, characterized in that: The readable storage medium is used to store a computer program, wherein when the computer program is running, it controls the device where the storage medium is located to execute a method for calculating the quantity of materials used in a project as described in any one of claims 1 to 7.