Cost calculation method, cost calculation system and related equipment
By employing vectorized processing and parallel computing methods and systems for cost calculation, the problem of time-consuming total cost calculation for enterprise configuration lists has been solved, enabling fast and accurate total cost calculation and improving computational efficiency and accuracy.
Patent Information
- Application Number
- CN202410613316.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-16
- Publication Date
- 2025-11-18
AI Technical Summary
When companies calculate the total cost of a configuration list before signing a contract, it is time-consuming and inefficient. In particular, since the unit price of each sales unit is affected by multiple calculation factors, it is necessary to manually search and access remote systems one by one, which can take several hours or even days to calculate.
This paper provides a cost calculation method and system that automatically calculates the total cost by acquiring the sales unit identifier, unit price, and corresponding calculation elements input by the user, and by using vectorization processing and parallel computing, thereby reducing manual intervention and improving calculation efficiency and accuracy.
It enables fast and accurate total cost calculation, reduces human calculation errors, improves calculation efficiency, and shortens calculation time.
Smart Images

Figure CN120975812A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a cost calculation method, a cost calculation system, and related equipment. Background Technology
[0002] Large enterprises sign sales contracts worth hundreds of millions or even trillions of yuan every year. Before signing a contract with a customer, the company creates a configuration list (including the various sales units (also known as products) expected to be sold to the customer and the quantity of each sales unit), calculates the total cost of the configuration list, conducts a preliminary assessment, determines the contract amount, and then submits the contract to the customer for approval. If the customer is not satisfied with the configuration list and the contract amount, the configuration list is modified, the total cost and preliminary assessment of the configuration list are recalculated, a new contract amount is determined, and then the new contract is submitted to the customer for approval. The above process usually occurs frequently before a contract is successfully signed with a customer.
[0003] Currently, enterprises mainly rely on dedicated business personnel to perform total cost calculations on frequently modified configuration lists. These configuration lists typically contain a huge number of sales units, such as hundreds of thousands or even millions. Moreover, since the unit price of each sales unit in the configuration list is usually affected by a large number of calculation factors (such as sales region (domestic and international), city tier (first-tier, second-tier, and third-tier), customer type (government, enterprise, and individual)), business personnel need to look up the unit price of each sales unit affected by these factors one by one when performing total cost calculations. In most cases, the unit price of most sales units affected by these factors needs to be obtained by accessing remote systems. The entire cost calculation process takes anywhere from a few hours to several days, which is inefficient. Summary of the Invention
[0004] This application provides a cost calculation method, a cost calculation system, and related equipment to solve the problems of long time consumption and low efficiency in manually calculating the cost of configuration lists.
[0005] Firstly, a cost calculation method is provided, applied to a cost calculation system. The method includes the following steps: First, obtaining a first correspondence input by a user, the first correspondence indicating the correspondence between the identifiers of multiple sales units, the unit prices of multiple sales units, and various calculation elements, where the various calculation elements are factors affecting the unit prices of multiple sales units. Then, obtaining a cost calculation request input by the user, the cost calculation request including the identifiers of multiple first sales units, a first calculation element, and the quantity of multiple first sales units. The cost calculation request is used to calculate the total cost of multiple first sales units, where multiple first sales units belong to multiple sales units, and the first calculation element is a factor affecting the unit prices of multiple first sales units. Next, obtaining a first vector, a second vector, and a second correspondence, where the elements in the first vector are vectorized identifiers of multiple first sales units, the elements in the second vector are vectorized first calculation elements, and the second correspondence indicating the correspondence between the vectorized identifiers of multiple sales units, the unit prices of multiple sales units, and the vectorized various calculation elements. Finally, calculating the total cost of multiple first sales units based on the first vector, the second vector, the second correspondence, and the quantity of multiple first sales units.
[0006] In the above solution, users only need to input the identifiers of multiple sales units, the unit prices of multiple sales units, the correspondence between various calculation elements, and a cost calculation request into the cost calculation system. After receiving the information input by the user, the cost calculation system can automatically perform cost calculations and obtain the results. The entire cost calculation process is simple, fast, and highly efficient. Moreover, compared to manual cost calculation, the cost calculation system is more accurate because manual calculations often involve errors.
[0007] In one possible implementation, the cost calculation system can specifically calculate the total cost of multiple first sales units based on a first vector, a second vector, a second correspondence, and the number of multiple first sales units, in the following way:
[0008] First, look up the second correspondence based on the first and second vectors to obtain the third vector. The elements in the third vector are the unit prices of multiple first sales units. Then, calculate the inner product of the third and fourth vectors in parallel computing to obtain the total cost of multiple first sales units. The elements in the fourth vector are the quantity of multiple first sales units.
[0009] Optionally, after obtaining the third vector, the cost calculation system can also calculate the inner product of the third and fourth vectors in a serial calculation manner to obtain the total cost of multiple first sales units.
[0010] By implementing the above method, the cost calculation system obtains the third vector (which consists of the unit prices of multiple first sales units) by querying the second correspondence. Then, it obtains the cost by calculating the inner product of the third and fourth vectors in parallel. Compared with obtaining the cost by calculating the inner product of the third and fourth vectors in sequence, this method can further improve the cost calculation efficiency.
[0011] In one possible implementation, the cost calculation system includes a first memory area. After obtaining the second correspondence, and before calculating the total cost of the multiple first sales units based on the first vector, the second vector, the second correspondence, and the number of multiple first sales units, the cost calculation system further performs the following steps: writing the second correspondence into the first memory area through an atomic write operation.
[0012] Writing the second correspondence into the first memory area via an atomic write operation refers to the action of the cost calculation system writing the second correspondence into the first memory area, which is a continuous operation that will not be interrupted during execution.
[0013] It is understandable that in the specific implementation, if the cost calculation system is performing the operation of writing the second correspondence to the first memory area, and the cost calculation system starts to query and read the cost calculation related data in the second correspondence in the first memory area, since the second correspondence has not been fully written to the first memory area, it may be possible that the corresponding data cannot be read and the cost calculation cannot be performed.
[0014] By implementing the above method, since the cost calculation system writes the second correspondence into the first memory area through atomic write operations, the cost calculation system can only start to query and read the cost calculation-related data in the second correspondence in the first memory area after the atomic write operation is completed. This avoids the cost calculation system being unable to query and read the corresponding data and thus being unable to perform cost calculation.
[0015] In one possible implementation, the cost calculation system can specifically achieve the following: by querying the second correspondence based on the first vector and the second vector, a third vector is obtained by: using an atomic read operation, querying the second correspondence based on the first vector and the second vector, reading the unit price of multiple first sales units in the second correspondence, and obtaining the third vector.
[0016] The atomic read operation involves querying the second correspondence based on the first and second vectors, reading the unit prices of multiple first sales units in the second correspondence, and obtaining the third vector. This is a continuous operation that is not interrupted during execution.
[0017] It is understandable that, in the specific implementation, if the cost calculation system is performing the operation of querying and reading cost calculation-related data in the second correspondence in the first memory area, and the cost calculation system starts to delete or modify the second correspondence in the first memory area, since the cost calculation system has not yet read all the data required for cost calculation, it may result in the query not being able to read the corresponding data, making cost calculation impossible, or the data read may not be the data in the second correspondence before modification, but the data in the modified second correspondence, resulting in a data reading error, thus leading to a cost calculation error.
[0018] By implementing the above method, since the cost calculation system queries and reads cost calculation-related data from the second correspondence in the first memory area through atomic read operations, the cost calculation system can only begin to perform other operations on the second correspondence in the first memory area after the atomic read operation is completed. For example, it can perform operations to delete or modify the second correspondence in the first memory area. This avoids the cost calculation system failing to read the corresponding data and thus being unable to perform cost calculation, and also avoids the cost calculation error caused by reading data from the modified second correspondence instead of the data in the original second correspondence.
[0019] In one possible implementation, the cost calculation system further includes a second memory region, which is different from the first memory region. The method also includes the following steps: obtaining a new second correspondence and writing the new second correspondence into the second memory region.
[0020] It is understandable that in the specific implementation, if the cost calculation system is querying and reading cost calculation-related data in the second correspondence in the first memory area, and the cost calculation system starts updating the second correspondence in the first memory area, since the cost calculation system has not yet read all the data required for cost calculation, it may result in the query not being able to read the corresponding data, making cost calculation impossible, or the data read may not be the data in the second correspondence before the update, but the data in the updated second correspondence, resulting in a data reading error, which in turn leads to a cost calculation error.
[0021] By implementing the above method, since the cost calculation system updates the new second correspondence to the second memory area, rather than updating the old second correspondence in the first memory area, it can avoid the conflict between the cost calculation system's action of reading cost calculation-related data from the old second correspondence in the first memory area and the cost calculation system's action of updating the second correspondence. This avoids the cost calculation system being unable to find the corresponding data and thus being unable to perform cost calculation, as well as avoiding the error of reading data from the modified second correspondence instead of the data from the original second correspondence, which could lead to cost calculation errors.
[0022] In one possible implementation, the cost calculation system includes at least one computing node, which includes any one or more of a graphics processing unit (GPU), a central processing unit (CPU), a tensor processing unit (TPU), and a neural processing unit (NPU).
[0023] In one possible implementation, at least one computing node is a first GPU, and the first memory region and the second memory region are different regions in the video memory of the first GPU.
[0024] In a cost computing system, at least one computing node is a single GPU, and the first and second memory regions are regions within the GPU's video memory. Compared to a system where at least one computing node is a single GPU, a single CPU, a single TPU, or a single NPU, and the first and second memory regions are regions within the memory of the computing device to which the cost computing system belongs, the GPU's read / write speed to its own video memory is significantly higher than the speed at which the GPU, CPU, TPU, and NPU read / write to the computing device's memory. Therefore, when at least one computing node in the cost computing system is a single GPU, and the first and second memory regions are regions within the GPU's video memory, cost computing efficiency is higher. Furthermore, when at least one computing node in the cost computing system is a single GPU, computational resources can be saved compared to when at least one computing node is multiple GPUs, multiple CPUs, multiple TPUs, or multiple NPUs.
[0025] Secondly, a cost calculation system is provided, the system comprising: a first acquisition module, a second acquisition module, and a cost calculation module;
[0026] The first acquisition module is used to acquire the first correspondence relationship input by the user. The first correspondence relationship indicates the correspondence between the identifiers of multiple sales units, the unit price of multiple sales units, and multiple calculation elements, which are the factors that affect the unit price of multiple sales units.
[0027] The first acquisition module is also used to acquire a cost calculation request input by the user. The cost calculation request includes the identifiers of multiple first sales units, a first calculation element, and the quantity of multiple first sales units. The cost calculation request is used to calculate the total cost of multiple first sales units. Multiple first sales units belong to multiple sales units. The first calculation element is the element that affects the unit price of multiple first sales units.
[0028] The second acquisition module is used to acquire a first vector, a second vector, and a second correspondence. The elements in the first vector are vectorized identifiers of multiple first sales units, the elements in the second vector are vectorized first calculation elements, and the second correspondence indicates the correspondence between the vectorized identifiers of multiple sales units, the unit price of multiple sales units, and the vectorized multiple calculation elements.
[0029] The cost calculation module is used to calculate the total cost of multiple first sales units based on the first vector, the second vector, the second correspondence, and the number of multiple first sales units.
[0030] In one possible implementation, the cost calculation module is specifically used to: query a second correspondence based on the first vector and the second vector to obtain a third vector, the elements of which are the unit prices of multiple first sales units; calculate the inner product of the third vector and the fourth vector in parallel computing to obtain the total cost of the multiple first sales units, wherein the elements of the fourth vector are the quantity of the multiple first sales units.
[0031] In one possible implementation, the cost calculation system further includes a first memory region and a data writing module, wherein the data writing module is used to write the second correspondence into the first memory region through atomic write operations.
[0032] In one possible implementation, the cost calculation module is used to query a second correspondence based on a first vector and a second vector through an atomic read operation, read the unit price of multiple first sales units in the second correspondence, and obtain a third vector.
[0033] In one possible implementation, the cost calculation system further includes a second memory region, which is different from the first memory region; a second acquisition module, which is also used to acquire a new second correspondence; and a data writing module, which is also used to write the new second correspondence into the second memory region.
[0034] In one possible implementation, the cost calculation system includes at least one computing node, which includes any one or more of a GPU, CPU, TPU, and NPU.
[0035] In one possible implementation, at least one computing node is a first GPU, and the first memory region and the second memory region are different regions in the video memory of the first GPU.
[0036] Thirdly, a computing device is provided, the computing device including a processor and a memory, the memory for storing instructions and the processor for executing the instructions, such that the computing device implements the method described in the first aspect.
[0037] Fourthly, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium, and the instructions are executed by a computing device or a cluster of computing devices to implement the method described in the first aspect.
[0038] Fifthly, a computing device cluster is provided, the computing device cluster including at least one computing device, each computing device including a processor and a memory, the processor of the at least one computing device being configured to execute instructions stored in the memory of the at least one computing device, such that the computing device cluster implements the method described in the first aspect.
[0039] In a sixth aspect, a computer program product comprising instructions is provided, the computer program product including instructions capable of running on a computing device or stored in any available medium, and when the computer program product is run on a computing device or a cluster of computing devices, causing the computing device or cluster of computing devices to implement the method described in the first aspect.
[0040] In a seventh aspect, a chip system is provided, comprising a processor and a power supply circuit. The power supply circuit supplies power to the processor, which implements the operation steps corresponding to the method described in the first aspect. The processor can be implemented using a CPU, or it can be implemented using computing devices such as a GPU, a data processing unit (DPU), an NPU, a TPU, an extreme processing unit (XPU), a system-on-chip (SoC), an offload card, or an accelerator card. Attached Figure Description
[0041] Figure 1 This is a schematic diagram of the architecture of a cost calculation system provided in an embodiment of this application;
[0042] Figure 2This is a flowchart illustrating a cost calculation method provided in an embodiment of this application;
[0043] Figure 3 This is a schematic diagram illustrating a process for calculating the total cost of multiple first sales units, provided in an embodiment of this application.
[0044] Figure 4 This is an example diagram of the configuration interface in a cost calculation method provided in an embodiment of this application;
[0045] Figure 5 This is a diagram showing a cost calculation result as provided in an embodiment of this application;
[0046] Figure 6 This is a schematic diagram of the structure of a cost calculation system provided in an embodiment of this application;
[0047] Figure 7 This is a schematic diagram of the structure of a computing device provided in an embodiment of this application;
[0048] Figure 8 This is a schematic diagram of the structure of a computing device cluster provided in an embodiment of this application;
[0049] Figure 9 This is a schematic diagram of another computing device cluster structure provided in an embodiment of this application. Detailed Implementation
[0050] The application scenarios involved in this application will be explained below.
[0051] Large enterprises sign sales contracts worth hundreds of millions or even trillions of yuan every year. Before signing a contract with a client, the company usually drafts the contract internally, creates a contract configuration list (including the various sales units (also known as products or commodities) expected to be sold to the client and the quantity of each sales unit), calculates the total cost of the configuration list, conducts a preliminary assessment, determines the contract amount, and then submits the contract to the client for approval. If the client is satisfied with the configuration list and the contract amount, the contract is usually signed smoothly. If the client is not satisfied with the configuration list and the contract amount, the configuration list needs to be modified, the total cost and preliminary assessment of the configuration list need to be recalculated, a new contract amount needs to be determined, and then the new contract needs to be submitted to the client for approval. The above process usually occurs frequently before a contract is successfully signed with a client.
[0052] Currently, enterprises primarily rely on dedicated business personnel to calculate the total cost of frequently modified configuration lists. These lists typically contain a massive number of sales units, ranging from hundreds of thousands to millions. Furthermore, the unit price of each sales unit is influenced by numerous calculation factors (tens of thousands). For example, if a sales unit is a type A server, its unit price might be affected by factors such as customer type ("government," "enterprise," and "individual"), sales region ("domestic" and "international"), and city tier ("first-tier city," "second-tier city," and "third-tier city"). When calculating the total cost, business personnel must first locate the unit price of each sales unit in the configuration list under the influence of these factors. Since the unit price of most sales units under these factors requires access to a remote system, and if the remote system fails, they must wait for it to recover, the entire cost calculation process can take anywhere from several hours to several days – extremely time-consuming, labor-intensive, and inefficient.
[0053] To address the problem of time-consuming, labor-intensive, and inefficient manual calculation of total costs for configuration lists, this application provides a cost calculation system and method. Users (such as the aforementioned business personnel) only need to input the identifiers of multiple sales units, the unit prices of multiple sales units, and the correspondence between numerous calculation factors affecting the unit prices of multiple sales units into the cost calculation system. Subsequently, whenever a cost calculation is required, a cost calculation request (carrying the identifiers of each sales unit that the user expects to sell to the customer, the quantity of each sales unit, and the calculation factors affecting the unit price of each sales unit) is input into the cost calculation system. Based on this information, the cost calculation system can automatically complete the cost calculation task, which is convenient, fast, and can effectively improve cost calculation efficiency.
[0054] The following sections will detail the cost calculation system and methods provided in the application, with reference to the corresponding attached diagrams.
[0055] Please see Figure 1 , Figure 1 This is a schematic diagram of the architecture of a cost calculation system provided in an embodiment of this application, such as... Figure 1 As shown, the architecture includes a cost calculation system 100 and a client 200. Figure 1 The example given is that three clients 200 establish a connection with the cost calculation system 100. In the actual implementation, the number of clients 200 that establish a connection with the cost calculation system 100 can be arbitrary and is not limited in this application.
[0056] The cost calculation system 100 is deployed on computing devices or clusters of computing devices. Computing devices can be bare metal servers (BMS), virtual machines, or containers. A BMS refers to a general-purpose physical server, such as an ARM server or an x86 server; a virtual machine refers to a complete computer system simulated by software, possessing full hardware system functionality and running in a completely isolated environment. Any task that can be performed on a physical computer can also be performed in a virtual machine. When creating a virtual machine on a computing device, a portion of the physical machine's hard drive and memory capacity is used as the virtual machine's hard drive and memory capacity. Each virtual machine has an independent basic input / output system (BIOS), hard drive, and operating system, and can be operated like a physical machine. A container is a portable software unit that can combine an application and all its dependencies into a single software package. This package is not limited by the underlying host operating system, thus eliminating the need to build complex environments and simplifying the application development and deployment process. The computing device cluster can be a cloud data center, an enterprise private cluster, or a hybrid cloud environment, i.e., a deployment mode that uses both public and private clouds simultaneously; this application does not specifically limit this.
[0057] Client 200 is deployed on terminal devices or computing devices to enable human-computer interaction. Terminal devices include personal computers, smartphones, wearable devices, handheld processors, tablets, mobile laptops, augmented reality (AR) devices, virtual reality (VR) devices, smart conferencing devices, etc., without specific limitations here. The description of computing devices can be found above and will not be repeated here.
[0058] In specific implementation, the client 200 can be software or application running on a terminal device or computing device controlled by the user, such as a personal computer (PC) client, a World Wide Web (web) client accessed through a browser, or an application (APP) client running on a mobile terminal. This application does not make any specific limitations.
[0059] Optionally, the client 200 can be a standalone client specifically designed for cost calculation functions, such as a cost calculation tool or application. Alternatively, the client 200 can also be a cost calculation function module or plugin within comprehensive software, such as the cost calculation module within commonly used data processing software for enterprises; this application does not impose any specific limitations.
[0060] Optionally, client 200 can also be a cloud platform client, such as a cloud platform console. Specifically, it can be a web-based console or an application programming interface (API) based console; this application does not impose any specific limitations. This console can provide users with cost calculation cloud services, and users can obtain access to the cost calculation system 100 provided by this application by purchasing cloud services. Alternatively, the cost calculation method provided by this application can be offered as a sub-service within the data processing cloud services provided by this console, available for purchase and use by users; this application does not impose any specific limitations.
[0061] Optionally, the client 200 and the cost calculation system 100 may be deployed in the same or different computing device clusters. For example, the client 200 may be deployed on a computing device in a first computing device cluster, and the cost calculation system 100 may be deployed on a computing device in a second computing device cluster. Alternatively, the client 200 and the cost calculation system 100 may be deployed in the same computing device cluster. It should be understood that the above examples are for illustration and are not intended to be specific.
[0062] In other possible implementations, the client 200 and the cost calculation system 100 can be distributed on the same device or on different devices. When the client 200 and the cost calculation system 100 are distributed on the same device, both can be hosted on a server. When the client 200 and the cost calculation system 100 are distributed on different devices, the client 200 can be installed on a terminal device, such as a mobile phone, tablet, laptop, desktop computer, etc., while the cost calculation system 100 can be hosted on a server.
[0063] There is a communication connection between the cost calculation system 100 and the client 200. This communication connection can be a wired connection or a wireless connection, and this application does not make any specific limitation.
[0064] The above describes in detail the possible deployment methods of the cost calculation system 100 and the client 200. In actual implementation, the actual deployment method of the cost calculation system 100 and the client 200 can be determined according to the actual application scenario.
[0065] For example, in one application scenario, the cost calculation system 100 is provided by a third party (such as a specialized software development organization, data processing organization, etc.). The enterprise can purchase the cost calculation system 100 from the third party and deploy the cost calculation system 100 and the client 200 on the enterprise's internal office equipment. For example, the cost calculation system 100 is deployed on the enterprise's server, and the client 200 is deployed on the enterprise's office computers, personal mobile phones, etc. The enterprise's employees can use the cost calculation system 100 to perform cost calculations through the client 200.
[0066] In another application scenario, the cost calculation system 100 is provided by a cloud service provider. Enterprises can purchase related cloud services for the cost calculation system 100 from the cloud service provider. The cost calculation system 100 is deployed on an instance in the cloud data center of the cloud service provider. Enterprise employees can remotely connect to the cost calculation system 100 through the client 200 and use the cost calculation system 100 to perform cost calculations.
[0067] It should be understood that the above application scenarios are for illustrative purposes only. The client 200 and cost calculation system 100 can be flexibly deployed according to actual business needs. They will not be listed here.
[0068] To make it easier to understand Figure 1 The specific process of cost calculation for the architecture shown is explained below. Figure 2 The flowchart illustrating a cost calculation method provided in this application embodiment is shown below for more detailed explanation. Figure 2 As shown, the method may include the following steps:
[0069] S201: The client obtains the first correspondence relationship input by the user. The first correspondence relationship indicates the correspondence between the identifiers of multiple sales units, the unit price of multiple sales units, and multiple calculation elements.
[0070] The user is the entity that needs to perform cost calculations. This can be a corporate user, i.e., a business person in a company who is responsible for calculating the total cost of the configuration list, or an individual user who needs cost calculations.
[0071] A sales unit can be a hardware product or a software product. Taking hardware products as an example, a sales unit can be various types of servers, processors, chassis, power cords, power strips, memory modules, headphones, displays, mice, keyboards, and so on. Taking software products as an example, a sales unit can be a virtual machine, a container, or software code capable of implementing any function, such as social media software, shopping software, live streaming software, data processing software, game software, etc. It can also be code used to implement model training, facial recognition, fingerprint recognition, object recognition, text recognition, data calculation, and so on.
[0072] Optionally, the sales unit can also be other products. For example, when the company is a clothing manufacturer, the sales unit can be various styles of clothing produced by the company; when the company is a watch manufacturer, the sales unit can be various types of watches and watch accessories produced by the company; when the company is a mobile phone manufacturer, the sales unit can be various types of mobile phones and mobile phone accessories produced by the company; when the company is a cloud provider, the sales unit can be various cloud services provided by the cloud provider, etc. This application does not specifically limit the sales unit.
[0073] The identifier for a sales unit can be a name, ID, or user-defined name that distinguishes different sales units. For example, if multiple sales units are type A servers, type B servers, type C servers, and type D servers, then the identifier for a sales unit "type A server" can be "A", the identifier for a sales unit "type B server" can be "B", the identifier for a sales unit "type C server" can be "C", and the identifier for a sales unit "type D server" can be "D". Alternatively, the identifier for a sales unit "type A server" can be "001", the identifier for a sales unit "type B server" can be "002", the identifier for a sales unit "type C server" can be "003", and the identifier for a sales unit "D" can be "004". This application does not specifically limit the identifier for the sales unit.
[0074] The unit price of a sales unit can be a product settlement price (PSP), a regional list price (RLP), or a global list price (GLP). PSP refers to the price that the customer ultimately settles with the supplier after deducting various fees and production costs during the sales process of the sales unit. RLP refers to the list price of a specific region or area, used to guide and regulate the pricing level of products or services in that region. GLP refers to the list price of products or services worldwide, spanning multiple countries.
[0075] Multiple calculation factors influence the unit price of various sales units. For example, the unit price differs depending on whether the company sells the unit to a government, a business, or an individual; therefore, the customer type ("government," "business," or "individual") is a calculation factor affecting the unit price. Similarly, the unit price differs depending on whether the company sells the unit domestically or internationally; therefore, the sales region ("domestic" or "international") is a calculation factor affecting the unit price. Furthermore, the unit price differs depending on whether the company sells the unit in first-tier, second-tier, or third-tier cities; therefore, the city tier ("first-tier," "second-tier," or "third-tier") is a calculation factor affecting the unit price.
[0076] It should be noted that the customer types, sales regions, and city tiers mentioned above are merely examples of calculation elements and should not be considered as specific limitations. For example, calculation elements could also include different sales channels (internet platforms and offline physical stores), different sales departments (enterprise business groups (EBG) and carrier network business group (CNBG)), etc.
[0077] Referring to the exemplary first correspondence shown in Table 1, multiple sales units include sales unit 1, sales unit 2, and sales unit 3. Sales unit 1 is identified as "SU1", sales unit 2 as "SU2", and sales unit 3 as "SU3". Multiple calculation elements include calculation element 1, calculation element 2, calculation element 3, etc. Calculation element 1 is the sales region, including two elements: "domestic" and "foreign". Calculation element 2 is the customer type, including two elements: "government" and "individual". Calculation element 3 is the city level, including three elements: "first-tier city", "second-tier city", and "third-tier city". The unit price of sales unit 1, sales unit 2, and sales unit 3 all include three types: PSP, RLP, and GLP.
[0078] Table 1
[0079]
[0080]
[0081] It should be understood that Figure 1 This is merely an example of the first correspondence and should not be considered a specific limitation. In actual implementation, the first correspondence can include more sales units, different identifiers for sales units, more or fewer types of calculation elements, and different unit prices. It should also be understood that the first correspondence can be... Figure 1 The two-dimensional table shown can also be in the form of an array or matrix, etc., and this application does not make any specific limitation.
[0082] In practice, the first correspondence can be user input to the client; a description of the client can be found here. Figure 1 The details of the embodiments will not be repeated here. Users can input the first correspondence through the command-line interface (CLI) provided by the client or by writing an API. Alternatively, the client can provide a graphical user interface (GUI) that displays an upload interface with corresponding relationships, allowing users to input the first correspondence through upload. Or, the GUI provided by the client can display interfaces for creating and editing data tables, allowing users to create data tables on the client and edit the first correspondence within them. This application does not limit the input method of the first correspondence.
[0083] S202: The client sends the first correspondence to the cost calculation system, and the corresponding cost calculation system receives the first correspondence sent by the client.
[0084] In practice, the client can send the first correspondence to the cost calculation system periodically, or it can send the first correspondence to the cost calculation system immediately after obtaining the first correspondence input by the user. This application does not impose any specific limitations.
[0085] S203: The cost calculation system vectorizes the identifiers of multiple sales units and various calculation elements in the first correspondence to obtain vectorized identifiers of multiple sales units and vectorized calculation elements, thereby obtaining the second correspondence.
[0086] The cost calculation system vectorizes the identifiers of multiple sales units in the first correspondence, which means converting the identifiers of multiple sales units into different numerical values so that the subsequent cost calculation system can better process and understand the identifiers of multiple sales units.
[0087] The cost calculation system vectorizes each calculation element in the first correspondence, which means converting the elements of each calculation element into different numerical values for representation, so that the subsequent cost calculation system can better process and understand the multiple elements in each calculation element.
[0088] The second correspondence indicates the relationship between the vectorized identifiers of multiple sales units, the unit price of multiple sales units, and the vectorized various computational elements.
[0089] The following section uses specific examples to detail the process by which the cost calculation system vectorizes the identifiers of multiple sales units in the first correspondence, and also vectorizes each calculation element in the first correspondence.
[0090] (1) The cost calculation system vectorizes the identifiers of multiple sales units in the first correspondence.
[0091] Taking the first correspondence shown in Table 1 as an example:
[0092] For the identifiers of the multiple sales units shown in Table 1, “SU1”, “SU2” and “SU3”, they can be encoded into vector [0 12]. In vector [0 1 2], 0 is the vector form of the identifier “SU1”, 1 is the vector form of the identifier “SU2”, and 2 is the vector form of the identifier “SU3”.
[0093] (2) The cost calculation system vectorizes each calculation element in the first correspondence.
[0094] Continuing with the first correspondence shown in Table 1 as an example:
[0095] For the two elements "domestic" and "foreign" in the calculation element 1 shown in Table 1, they can be encoded into vector
[01] . The 0 in vector [0 1] is the vector form of the element "domestic" in the calculation element 1, and the 1 in vector [0 1] is the vector form of the element "foreign" in the calculation element 1.
[0096] For the two elements "government" and "individual" in the calculation element 2 shown in Table 1, they can be encoded into vector
[01] . The 0 in vector [0 1] is the vector form of the element "government" in calculation element 2, and the 1 in vector [0 1] is the vector form of the element "individual" in calculation element 2.
[0097] For the three elements in calculation element 3 shown in Table 1: "first-tier cities", "second-tier cities" and "third-tier cities", they can be encoded into vector [0 1 2]. In vector [0 1 2], 0 represents the vector form of element "first-tier cities" in calculation element 3, 1 represents the vector form of element "second-tier cities" in calculation element 3, and 2 represents the vector form of element "third-tier cities" in calculation element 3.
[0098] Based on the above, we can extrapolate the vector form corresponding to each type of calculation element by considering the remaining types of calculation elements in the first correspondence shown in Table 1.
[0099] Based on the above, we can obtain the second correspondence (i.e., the vectorized first correspondence). The second correspondence can be in the form of a two-dimensional table, an array, or a matrix.
[0100] First, let's take the second correspondence as an example, which is in the form of a two-dimensional table, as shown in Table 2 below.
[0101] Table 2
[0102]
[0103] Taking the second correspondence in matrix form as an example, see the following matrix:
[0104]
[0105] It should be noted that the vector forms of the identifiers of multiple sales units in the first correspondence shown in Table 1 above, as well as the vector forms of various calculation elements, are merely examples. In specific implementations, they can be encoded into other vectors. For example, the identifiers of multiple sales units in the first correspondence shown in Table 1, namely “SU1”, “SU2”, and “SU3”, can be encoded into vector [100 200 300]. In vector [100 200 300], 100 represents the vector form of the identifier “SU1”, 200 represents the vector form of the identifier “SU2”, and 300 represents the vector form of the identifier “SU3”. Similarly, for the three elements in the third type of calculation element 3 in the first correspondence shown in Table 1, namely “first-tier city”, “second-tier city”, and “third-tier city”, they can be encoded into vector [50 51 52]. In
[52] , 50 is the vector form of the element "first-tier city" in calculation element 3, 51 in vector [50 51 52] is the vector form of the element "second-tier city" in calculation element 3, and 52 in vector [50 51 52] is the vector form of the element "third-tier city" in calculation element 3.
[0106] It should also be noted that in the first correspondence, if a certain calculation element corresponding to a certain sales unit is empty, when vectorizing the calculation element, a specific numerical value can be used as the vector form of the empty element of the calculation element. This specific numerical value is different from the numerical values corresponding to other elements in the calculation element, so as to distinguish the different elements in the calculation element. For example, assuming that in the first correspondence shown in Table 1, calculation element 3 includes not only the three elements "first-tier cities," "second-tier cities," and "third-tier cities," but also an empty element, then when the cost calculation system vectorizes calculation element 3, it can encode it as vector [50 51 52 53]. In vector [50 51 52 53], 50 represents the vector form of the element "first-tier cities" in calculation element 3; 51 represents the vector form of the element "second-tier cities" in calculation element 3; 52 represents the vector form of the element "third-tier cities" in calculation element 3; and 53 represents the vector form of the empty element in calculation element 3. Optionally, it can also be encoded as other numerical vectors; this application does not impose specific limitations.
[0107] S204: The client obtains a cost calculation request input by the user. The cost calculation request includes the identifiers of multiple first sales units, the first calculation element, and the quantity of multiple first sales units. The cost calculation request is used to calculate the total cost of multiple first sales units.
[0108] Multiple first sales units can be sales units that the user expects to sell to customers, belonging to the aforementioned multiple sales units. For a description of sales units in S201, please refer to that description; it will not be repeated here.
[0109] The first calculation element is the element that affects the unit price of multiple first sales units, and belongs to the aforementioned multiple calculation elements. For a description of calculation elements, please refer to S201, which will not be repeated here.
[0110] In one possible embodiment, the cost calculation request may carry a user's contract configuration list. Optionally, the cost calculation request may also carry the user's contract, which includes the configuration list. The configuration list includes identifiers of multiple first sales units, first calculation elements, and the quantity of the multiple first sales units.
[0111] The following two specific examples illustrate the concept of cost calculation requests.
[0112] In the first example, suppose a company has a contract A with the government of a first-tier city in China. The configuration list in contract A consists of 2 sales units 1 and 5 sales units 2. To calculate the total cost of the PSP (Purpose Support Package) for contract A, the user can input the following into the client:
[0113] Cost Calculation Request (1) A cost calculation request for calculating the total cost of the PSP for Contract A. This cost calculation request may include the contents shown in 1.1-1.3 below:
[0114] 1.1. Identification of multiple first sales units, namely, the identifier "SU1" for sales unit 1 and the identifier "SU2" for sales unit 2.
[0115] 1.2 The number of multiple first sales units, namely, the number of sales unit 1 is 2 and the number of sales unit 2 is 5.
[0116] 1.3 The first calculation element includes the elements: "domestic", "government" and "first-tier cities".
[0117] The second example: Suppose there is a contract B for an individual in a third-tier city in China. The configuration list in contract B consists of 2 sales units 2 and 3 sales units 3. To calculate the total RLP cost of contract B, the user can input the following into the client:
[0118] Cost calculation request (2): A cost calculation request for calculating the total RLP cost of Contract B, which may include the contents shown in 2.1-2.3 below:
[0119] 2.1. The identifiers of multiple first sales units, namely the identifier "SU2" for sales unit 2 and the identifier "SU3" for sales unit 3.
[0120] 2.2 The number of multiple first sales units, namely, the number of sales unit 2 is 2 and the number of sales unit 3 is 3.
[0121] 2.3 The first calculation element includes the elements: "Domestic", "Individual" and "Third-tier City".
[0122] In practice, cost calculation requests can be input by the user into the client; a description of the client can be found here. Figure 1The relevant details of the embodiments will not be repeated here. Users can input cost calculation requests through the CLI provided by the client or by writing an API. Alternatively, the client can provide a GUI to the user, which can display a contract upload interface / configuration list upload interface and a cost calculation control. Users can upload a contract including a configuration list through the contract upload interface, or upload a configuration list through the configuration list upload interface, and then click the cost calculation control to input a cost calculation request carrying the contract or a cost calculation request carrying the configuration list. This application does not limit the input method of the cost calculation request.
[0123] S205: The client sends a cost calculation request to the cost calculation system, and the corresponding cost calculation system receives the cost calculation request sent by the client.
[0124] In practice, the client can send cost calculation requests to the cost calculation system periodically, or it can send cost calculation requests to the cost calculation system immediately after receiving the user's input cost calculation request. This application does not impose any specific limitations.
[0125] S206: The cost calculation system vectorizes the identifiers of multiple first sales units carried in the cost calculation request to obtain a first vector.
[0126] When the cost calculation system vectorizes the identifiers of multiple first sales units, the vectorized values corresponding to the identifiers of the same sales unit are the same as when the cost calculation system vectorizes the identifiers of multiple sales units in the first correspondence in S203.
[0127] Taking the identifiers of multiple sales units in the first correspondence shown in Table 1 in the cost calculation system of S203 as vectorized into vector [0 1 2], where 0 in vector [0 1 2] is the vector form of identifier "SU1", 1 in vector [0 1 2] is the vector form of identifier "SU2", and 2 in vector [0 1 2] is the vector form of identifier "SU3" as an example:
[0128] Regarding the cost calculation request (1) in S204, since the cost calculation request (1) carries the identifiers of multiple first sales units as "SU1" and "SU2", the cost calculation system can vectorize the identifiers of multiple first sales units to obtain a first vector [0 1]. In the first vector [0 1], 0 represents the vector form of the identifier "SU1", and 1 represents the vector form of the identifier "SU2". It can be seen that the vector form of "SU1" in multiple first sales units is the same as the vector form of "SU1" in the first correspondence, both being 0. The vector form of "SU2" in multiple first sales units is the same as the vector form of "SU2" in the first correspondence, both being 1.
[0129] Taking the cost calculation request (2) in S204 as an example, since the cost calculation request (2) carries the identifiers of multiple first sales units as "SU2" and "SU3", the cost calculation system can vectorize the identifiers of multiple first sales units to obtain a first vector [1 2]. The 1 in the first vector [1 2] is the vector form of the identifier "SU2", and the 2 in the first vector [1 2] is the vector form of the identifier "SU3". It can be seen that the vector form of "SU2" in multiple first sales units is the same as the vector form of "SU2" in the first correspondence, which is 1. The vector form of "SU3" in multiple first sales units is the same as the vector form of "SU3" in the first correspondence, which is 2.
[0130] S207: The cost calculation system vectorizes the first calculation element carried in the cost calculation request to obtain a second vector.
[0131] When the cost calculation system vectorizes the first calculation element, the vectorized values corresponding to the same calculation element are the same as when the cost calculation system vectorizes the identifiers of multiple calculation elements in the first correspondence in S203.
[0132] Taking the vectorized form of various calculation elements in the first correspondence shown in Table 1, as shown in Table 2, from the cost calculation system in S203, as an example:
[0133] Regarding the cost calculation request (1) in S204, since the first calculation element carried by the cost calculation request (1) includes the elements "domestic", "government" and "first-tier cities", the cost calculation system can vectorize the first calculation element to obtain a second vector [0 0 0]. The first 0 in the second vector [00 0] is the vector form of the element "domestic" in the first calculation element, the second 0 is the vector form of the element "government" in the first calculation element, and the third 0 is the vector form of the element "first-tier cities" in the first calculation element. It can be seen that the vector form of the element "domestic" in the first calculation element is the same as the vector form of the element "domestic" in calculation element 1 in the first correspondence, both being 0. The vector form of the element "government" is the same as the vector form of the element "government" in calculation element 2 in the first correspondence, both being 0. The vector form of the element "first-tier cities" is the same as the vector form of the element "first-tier cities" in calculation element 3 in the first correspondence, both being 0.
[0134] Regarding the cost calculation request (2) in S204, since the first calculation element carried by the cost calculation request (2) includes the elements "domestic", "individual" and "third-tier city", the cost calculation system can vectorize the first calculation element to obtain the second vector [0 1 2]. In the second vector [0 1 2], 0 is the vector form of the element "domestic" in the first calculation element, 1 is the vector form of the element "individual" in the first calculation element, and 2 is the vector form of the element "third-tier city" in the first calculation element. It can be seen that the vector form of the first calculation element "domestic" is the same as the vector form of the element "domestic" in calculation element 1 in the first correspondence, both being 0. The vector form of the element "individual" in the first calculation element is the same as the vector form of the element "individual" in calculation element 2 in the first correspondence, both being 1. The vector form of the element "third-tier city" in the first calculation element is the same as the vector form of the element "third-tier city" in calculation element 3 in the first correspondence, both being 2.
[0135] S208: The cost calculation system calculates the total cost of multiple first sales units based on the first vector, the second vector, the number of multiple first sales units, and the second correspondence.
[0136] It is understandable that since the total cost of multiple first sales units = the sum of the costs of each first sales unit in the multiple first sales units, and the cost of each first sales unit = the unit price of each first sales unit under the influence of the first calculation element * the quantity of each first sales unit, and the cost calculation system has already obtained the quantity of each first sales unit, in order to calculate the total cost of multiple first sales units, it is also necessary to obtain the unit price of each first sales unit under the influence of the first calculation element.
[0137] In a specific embodiment of this application, the cost calculation system can calculate the total cost of multiple first sales units through the following process: query the second correspondence relationship according to the first vector and the second vector, read the unit price of multiple first sales units under the influence of the first calculation element in the second correspondence relationship, multiply the unit price of each first sales unit by its quantity to obtain the cost of each first sales unit, and then sum the costs of multiple first sales units to obtain the total cost of multiple first sales units.
[0138] The following section provides a detailed explanation of how the cost calculation system queries and retrieves the unit prices of multiple first sales units under the influence of the first calculation element, and calculates the total cost of these multiple first sales units, using two specific examples.
[0139] The first example is the cost calculation system performing cost calculations on the cost calculation request (1) in S204. The second correspondence is the matrix shown in S203. From the content of S206, it can be seen that the vector form of the identifiers of the multiple first sales units (i.e., “SU1” and “SU2”) carried by the cost calculation request (1) is the first vector [0 1], and the vector form of the first calculation element (containing the elements “domestic”, “government” and “first-tier cities”) carried by the cost calculation request (1) is the second vector [0 0 0].
[0140] (1.1) Query and read the PSP unit price of the first sales unit under the influence of the first calculation element in the second correspondence, specifically including the following (1.1.1) ∽ (1.1.5).
[0141] (1.1.1) The cost calculation system combines each element in the first vector [0 1] and all elements in the second vector [0 0 0] to obtain the combined vector [0 0 0 0] corresponding to the element "0" in the first vector [0 1], and the combined vector [10 0 0] corresponding to the element "1" in the first vector [0 1].
[0142] (1.1.2) The cost calculation system queries the second correspondence in matrix form shown in S203 based on the combination vector [0 0 0 0]. If the value of the first row of the target column in the second correspondence (referring to the calculation element column corresponding to each element in the combination vector [0 0 0 0], i.e. the first four columns in the second correspondence) is the same as that of the combination vector [0 0 0 0], then the PSP unit price "200" in the first row of the second correspondence is determined to be the PSP unit price matched by the combination vector [0 0 0 0].
[0143] Since the combined vector [0 0 0 0] corresponds to sales unit 1, the PSP unit price "200" is the PSP unit price of sales unit 1 as queried by the cost calculation system under the influence of the first calculation element (including the elements "domestic", "government" and "first-tier cities").
[0144] (1.1.3) The cost calculation system queries the second correspondence in matrix form shown in S203 based on the combination vector [1 0 0 0]. It locates the target column of the second correspondence (referring to the calculation element column corresponding to each element in the combination vector [0 0 0 0], i.e., the first four columns in the second correspondence) whose value in the fifth row is the same as the combination vector [1 0 0 0]. Therefore, the PSP unit price "500" in the fifth row of the second correspondence is determined to be the PSP unit price matched by the combination vector [1 0 0 0]. Since the combination vector [1 0 0 0] corresponds to sales unit 2, the PSP unit price "500" is the PSP unit price of sales unit 2 queried by the cost calculation system under the influence of the first calculation element (containing the elements "domestic", "government", and "first-tier cities").
[0145] (1.1.4) The cost calculation system reads the PSP unit price "200".
[0146] (1.1.5) The cost calculation system reads the PSP unit price "500".
[0147] (1.2) Calculate the total cost of PSP for multiple first sales units.
[0148] Specifically, the total cost of PSPs for multiple first sales units = PSP unit price of sales unit 1 under the influence of the first calculation factor (including the elements "domestic", "government" and "first-tier cities") * quantity of sales unit 1 + PSP unit price of sales unit 2 under the influence of the first calculation factor (including the elements "domestic", "government" and "first-tier cities") * quantity of sales unit 2 = 200 * 2 + 500 * 5 = 2900.
[0149] The second example is the cost calculation system performing cost calculations on the cost calculation request (2) in S204. The second correspondence is the matrix shown in S203. From the content of S206, it can be seen that the vector form of the identifiers of the multiple first sales units (i.e., “SU2” and “SU3”) carried by the cost calculation request (2) is the first vector [1 2], and the vector form of the first calculation element (containing the elements “domestic”, “individual” and “third-tier city”) carried by the cost calculation request (2) is the second vector [0 1 2].
[0150] (2.1) Query and read the RLP unit price of the first sales unit under the influence of the first calculation element in the second correspondence, specifically including the following (2.1.1) ∽ (2.1.5).
[0151] (2.1.1) The cost calculation system combines each element in the first vector [1 2] and all elements in the second vector [0 1 2] to obtain the combined vector [1 0 1 2] corresponding to the element "1" in the first vector [1 2], and the combined vector [20 1 2] corresponding to the element "2" in the first vector [1 2].
[0152] (2.1.2) The cost calculation system queries the second correspondence in matrix form shown in S203 based on the combination vector [1 0 1 2]. It locates the second-to-last row of the target column of the second correspondence (referring to the calculation element column corresponding to each element in the combination vector [0 0 0 0], i.e., the first four columns in the second correspondence) whose value is the same as that of the combination vector [1 0 1 2]. Then, it determines that the RLP unit price "1800" in the second-to-last row of the second correspondence is the RLP unit price matched by the combination vector [1 0 1 2].
[0153] Since the combination vector [1 0 1 2] corresponds to sales unit 2, the RLP unit price "1800" is the RLP unit price of sales unit 2 as queried by the cost calculation system under the influence of the first calculation element (including the elements "domestic", "individual" and "third-tier city").
[0154] (2.1.3) The cost calculation system queries the second correspondence in matrix form shown in S203 based on the combination vector [2 0 1 2]. It locates the value of the last row of the target column of the second correspondence (referring to the calculation element column corresponding to each element in the combination vector [0 0 0 0], i.e., the first four columns in the second correspondence) which is the same as the value of the combination vector [2 0 1 2]. Then it determines that the RLP unit price "300" in the last row of the second correspondence is the RLP unit price matched by the combination vector [2 0 1 2].
[0155] Since the combination vector [2 0 1 2] corresponds to sales unit 3, the RLP unit price "300" is the RLP unit price of sales unit 3 as queried by the cost calculation system under the influence of the first calculation element (including the elements "domestic", "individual" and "third-tier city").
[0156] (2.1.4) The cost calculation system reads the RLP unit price "1800".
[0157] (2.1.5) The cost calculation system reads the RLP unit price "300".
[0158] (2.2) Calculate the total RLP cost for multiple first sales units.
[0159] Specifically, the total RLP cost of multiple first sales units = RLP unit price of sales unit 2 affected by the first calculation element (including the elements "domestic", "individual" and "third-tier city") * quantity of sales unit 2 + RLP unit price of sales unit 3 affected by the first calculation element (including the elements "domestic", "individual" and "third-tier city") * quantity of sales unit 3 = 1800*2 + 300*3 = 4500.
[0160] In one possible embodiment, after the cost calculation system queries and reads the unit price (such as PSP unit price or RLP unit price) of each first sales unit under the influence of the first calculation element, it can calculate the total cost of multiple standard sales units using a vector inner product calculation method. For example, it can calculate the total PSP cost of the multiple first sales units shown in (1.2) using a vector inner product calculation method, or calculate the total RLP cost of the multiple first sales units shown in (2.2) using a vector inner product calculation method. For the specific process of the cost calculation system calculating the total cost of multiple standard sales units using the vector inner product calculation method, please refer to [link to documentation]. Figure 3 The steps shown are S301∽S303.
[0161] S301: Combine the unit prices of each first sales unit under the influence of the first calculation element into a third vector.
[0162] S302: Combine the quantities of each first sales unit into a fourth vector.
[0163] S303: Calculate the inner product of the third and fourth vectors, which is the total cost of the multiple first sales units.
[0164] Taking the calculation of the total cost of PSP for multiple first sales units as shown in (1.2) above as an example, after the cost calculation system reads the PSP unit price "200" of sales unit 1 under the influence of the first calculation element (including the elements "domestic", "government" and "first-tier cities"), and reads the PSP unit price "500" of sales unit 2 under the influence of the first calculation element (including the elements "domestic", "government" and "first-tier cities"), it can combine the PSP unit price "200" and the PSP unit price "500" into a third vector [200500], and combine the quantity "2" of sales unit 1 and the quantity "5" of sales unit 2 into a fourth vector [2 5]. Then, the third vector [200500] and the fourth vector [2 5] are multiplied to obtain the inner product, which is the total cost of PSP for sales unit 1 and sales unit 2.
[0165] Taking the calculation of the total cost of PSP for multiple first sales units as shown in (2.2) above as an example, after the cost calculation system reads the RLP unit price "1800" of sales unit 2 under the influence of the first calculation element (including the elements "domestic", "individual" and "third-tier city"), and reads the RLP unit price "300" of sales unit 3 under the influence of the first calculation element (including the elements "domestic", "individual" and "third-tier city"), it can combine the RLP unit price "1800" and the RLP unit price "300" into a third vector [1800300], and combine the quantity "2" of sales unit 2 and the quantity "3" of sales unit 3 into a fourth vector [2 3]. Then, the third vector [1800 300] and the fourth vector [2 3] are multiplied to obtain the inner product, which is the total RLP cost of sales unit 2 and sales unit 3.
[0166] In one possible embodiment, when calculating the inner product of the third and fourth vectors, the cost calculation system can perform the calculation in a serial or parallel manner. That is, the cost calculation system breaks down the task of calculating the inner product of the third and fourth vectors into multiple subtasks, and then executes multiple subtasks serially or in parallel. After the corresponding subtasks are executed serially or in parallel, the results of all subtasks are summarized to obtain the final result, which is the inner product of the third and fourth vectors.
[0167] Taking the above cost calculation system as an example of multiplying the third vector [200 500] and the fourth vector [2 5] to obtain the inner product, the cost calculation system can break down this calculation task into the following two sub-tasks:
[0168] Subtask 11: Multiply the first element "200" in the third vector [200 500] with the first element "2" in the fourth vector [2 5].
[0169] Subtask 12: Multiply the second element "500" in the third vector [200 500] with the second element "5" in the fourth vector [2 5].
[0170] The cost calculation system can execute subtasks 11 and 12 serially / in parallel. After obtaining the execution result R11 (i.e., 400) corresponding to subtask 11 and the execution result R12 (i.e., 2500) corresponding to subtask 12, the execution results R11 and R12 are summarized, that is, the sum of the execution results R11 and R12 is calculated, thereby obtaining the inner product of the third vector [200 500] and the fourth vector [2 5], i.e., 2900.
[0171] Taking the above cost calculation system as an example of multiplying the third vector [1800 300] and the fourth vector [2 3] to obtain the inner product, the cost calculation system can break down this calculation task into the following two sub-tasks:
[0172] Subtask 21: Multiply the first element "1800" in the third vector [1800 300] with the first element "2" in the fourth vector [2 3].
[0173] Subtask 22: Multiply the second element "300" in the third vector [1800 300] with the second element "3" in the fourth vector [2 3].
[0174] The cost calculation system can execute subtasks 21 and 22 serially / in parallel. After obtaining the execution result R21 (i.e., 3600) corresponding to subtask 21 and the execution result R22 (i.e., 900) corresponding to subtask 22, the execution results R21 and R22 are summarized, that is, the sum of the execution results R21 and R22 is calculated, thereby obtaining the inner product of the third vector [1800 300] and the fourth vector [2 3], i.e., 4500.
[0175] In one possible embodiment, the cost calculation system includes at least one computing node, which includes any one or more of GPU, CPU, TPU and NPU. The cost calculation system uses at least one computing node to calculate the inner product of the third vector and the fourth vector in a serial / parallel computing manner.
[0176] The following example illustrates how a cost calculation system can compute the inner product of a third and fourth vector in parallel using at least one computing node, with at least one GPU, multiple GPUs, one CPU, or multiple CPUs as the computing nodes, and the computing method being parallel computing.
[0177] (1) At least one computing node is a GPU.
[0178] Taking the parallel execution of subtasks 11 and 12 in the cost calculation system as an example, one of the many GPU cores included in the GPU in the cost calculation system can execute subtask 11, while another GPU core executes subtask 12.
[0179] (2) At least one computing node consists of multiple GPUs.
[0180] Continuing with the example of the cost calculation system executing subtasks 11 and 12 in parallel, it can be that one GPU core in one of the multiple GPUs in the cost calculation system executes subtask 11, while one GPU core in another GPU executes subtask 12.
[0181] (3) At least one computing node is a CPU, which includes multiple CPU cores.
[0182] Continuing with the example of the cost calculation system executing subtasks 11 and 12 in parallel, one of the CPU cores in the cost calculation system can execute subtask 11 while another CPU core executes subtask 12.
[0183] (4) At least one computing node has multiple CPUs.
[0184] Continuing with the example of the cost calculation system executing subtasks 11 and 12 in parallel, one of the CPUs in the cost calculation system can execute subtask 11 while another CPU executes subtask 12.
[0185] When at least one computing node is a TPU, NPU, etc., the process by which the cost calculation system calculates the inner product of the third and fourth vectors in parallel through at least one computing node is the same as the process by which the cost calculation system calculates the inner product of the third and fourth vectors in parallel through at least one computing node when at least one computing node is a GPU or CPU, and will not be elaborated further.
[0186] It is understandable that at least one computing node can compute the inner product of the third and fourth vectors in parallel, which is more efficient than computing the inner product of the third and fourth vectors in sequence.
[0187] In specific implementations, when the cost calculation system includes multiple computing nodes, these multiple computing nodes can be distributed on the same device (such as a single server) or on different devices; this application does not impose any specific limitations.
[0188] It is understandable that when at least one computing node in a cost calculation system is a single GPU, compared to when at least one computing node is a single CPU, a single TPU, a single NPU, etc., the parallel computing capability of a GPU, which includes a large number of GPU cores, is far superior to that of a CPU, TPU, or NPU. Therefore, using GPUs for cost calculation is more efficient. Furthermore, when at least one computing node in a cost calculation system is a single GPU, a single CPU, a single TPU, or a single NPU, compared to when at least one computing node is multiple GPUs, multiple CPUs, multiple TPUs, or multiple NPUs, computational resources can be saved.
[0189] In one possible embodiment, before calculating the inner product of the third and fourth vectors, the cost calculation system can generate a cost calculation script based on the third and fourth vectors, and then execute the script to calculate the inner product of the third and fourth vectors. Specifically, the cost calculation script can be a high-level language such as Python or JAVA. Taking the generation of a Python cost calculation script based on the third vector [200 500] and the fourth vector [2 5] as an example, the generated cost calculation script code can be as follows:
[0190] import torch
[0191] a = torch.tensor([200 500])
[0192] b = torch.tensor([2 5])
[0193] c = torch.dot(a, b)
[0194] In the cost calculation script code above, "import torch" means to import the vector calculation interface into the cost calculation script to perform vector calculation (also known as tensor calculation), "a=torch.tensor([200 500])" means to define "a" as vector [200 500], "b=torch.tensor([2 5])" means to define "b" as vector [2 5], and "c=torch.dot(a,b)" means to define "c" as the product of "a" and "b".
[0195] S209: The cost calculation system sends the total cost of multiple first sales units to the client, and the client receives the total cost of multiple first sales units sent by the cost calculation system.
[0196] In specific implementation, the cost calculation system can periodically send the total cost of multiple first sales units, or immediately send the total cost of multiple first sales units to the client after obtaining the total cost of multiple first sales units, or send the total cost of multiple first sales units to the client after receiving a user's cost query request from the client. This application does not make any specific limitations.
[0197] S210: The client displays the total cost of multiple first sales units.
[0198] It is understood that in the cost calculation method provided in this application, after the cost calculation system obtains the second correspondence in S203, the process of storing and querying the second correspondence will be involved when performing cost calculation. The storage and querying process of the second correspondence will be described in detail below.
[0199] After obtaining the second correspondence in S203, the cost calculation system can store the second correspondence in a memory region (hereinafter referred to as the first memory region). Then, in S208, the cost calculation system can query and read data from the second correspondence from the first memory region, such as querying and reading the PSP unit price of the first sales unit under the influence of the first calculation element in the second correspondence as shown in (1.1) above, and querying and reading the RLP unit price of the first sales unit under the influence of the first calculation element in the second correspondence as shown in (2.1) above, for cost calculation. The first memory region can be a region in the memory of the computing device on which the cost calculation system is deployed. If the cost calculation system includes a GPU, the first memory region can be a region in the GPU's video memory. This application does not specifically limit the first memory region.
[0200] It is understandable that if the cost calculation system is writing the second mapping relationship to the first memory area while it has already started querying and reading data from the second mapping relationship in the first memory area, the query may fail to retrieve the corresponding data because the second mapping relationship has not yet been fully written to the first memory area, making cost calculation impossible. Furthermore, if the cost calculation system is deleting or modifying the second mapping relationship in the first memory area while it is querying and reading data from the second mapping relationship, the query may fail to retrieve the corresponding data because it has not yet read all the data required for cost calculation, making cost calculation impossible. Alternatively, the data read may be the modified data from the second mapping relationship instead of the original data, resulting in a data reading error and thus a cost calculation error.
[0201] To avoid the aforementioned problems, in the specific embodiments of this application, the action of the cost calculation system writing the second correspondence into the first memory area is an atomic write operation. This atomic write operation is a continuous operation that is not interrupted during execution. The cost calculation system can only begin querying and reading data from the second correspondence in the first memory area for cost calculation after the atomic write operation is completed. Furthermore, the action of the cost calculation system querying and reading data from the second correspondence in the first memory area is an atomic read operation. This atomic read operation is a continuous operation that is not interrupted during execution. The cost calculation system can only begin performing other operations on the second correspondence in the first memory area, such as deleting or modifying it, after the atomic read operation is completed. This avoids the cost calculation system failing to read the corresponding data, thus preventing cost calculation errors, and also avoids the cost calculation error caused by reading data from the modified second correspondence instead of the data from before the modification.
[0202] It is also understood that, over time, the types of multiple sales units for a user, the unit price of the sales unit, and the calculation elements affecting the unit price of the sales unit may change, and subsequent cost calculation tasks need to be based on the changed data. In a specific embodiment of this application, the cost calculation system can obtain a new first correspondence relationship, and based on the new first correspondence relationship, obtain a new second correspondence relationship, and then update the old second correspondence relationship using the new second correspondence relationship. The new first correspondence relationship indicates the correspondence between the identifiers of the new multiple sales units, the unit price of the new multiple sales units, and the new multiple calculation elements. Here, the new multiple sales units may be different from the multiple sales units in the old first correspondence relationship, or may include some or all of the multiple sales units in the old first correspondence relationship. Similarly, the new multiple calculation elements may be different from the multiple calculation elements in the old first correspondence relationship, or may include some or all of the multiple calculation elements in the old first correspondence relationship. This application does not impose specific limitations on these elements. The specific process of the cost calculation system obtaining a new first correspondence and obtaining a new second correspondence based on the updated first correspondence is the same as the process of the cost calculation system obtaining a first correspondence and obtaining a second correspondence based on the first correspondence as shown in S201 to S203 above. Please refer to the relevant descriptions in S201 to S203, and will not be elaborated further.
[0203] After updating the second correspondence based on the new first correspondence, the cost calculation system can perform subsequent cost calculation tasks based on the new second correspondence.
[0204] It is understandable that if the cost calculation system is querying and reading data in the second correspondence, and then the cost calculation system starts to update the second correspondence, since the cost calculation system has not yet read all the data required for cost calculation, it may result in the query not being able to read the corresponding data, making cost calculation impossible, or the data read may not be the data from the second correspondence before the update, but the data from the updated second correspondence, resulting in a data reading error and thus a cost calculation error.
[0205] To avoid the aforementioned problems, in a specific embodiment of this application, the cost calculation system can update the second correspondence using the following update method.
[0206] The first update method: After obtaining the new second correspondence, the cost calculation system can determine whether it is currently querying and reading data from the second correspondence in the first memory area. If it determines that it is not currently querying and reading data from the second correspondence in the first memory area, it can directly use the new second correspondence to update the old second correspondence in the first memory area. If it determines that it is currently querying and reading data from the second correspondence in the first memory area, it waits for the query and reading action to be completed before using the new second correspondence to update the old second correspondence in the first memory area.
[0207] The method of updating the old second correspondence in the first memory region using the new second correspondence can be a full refresh or an incremental refresh, and this application does not specifically limit it. Among them, a full refresh means replacing the old second correspondence with the new second correspondence, while an incremental refresh means comparing the old second correspondence with the new second correspondence, retaining the parts in the old second correspondence that are the same as the new second correspondence, and refreshing the parts in the new second correspondence that are different from the old second correspondence to the old second correspondence.
[0208] The second update method: After obtaining the new second correspondence, the cost calculation system can update the new second correspondence to the second memory area.
[0209] The second memory region can be a region in the memory of the computing device on which the cost computing system is deployed that is different from the first memory region. In the case where the cost computing system includes a GPU and the first memory region is a region in the GPU's video memory, the second memory region can be a region in the GPU's video memory that is different from the first memory region.
[0210] As can be seen, in the first update method, the cost calculation system needs to first determine whether it is currently performing an action to query and read data in the second correspondence in the first memory area, and if it is currently performing a query and read action, it must wait for the query and read action to be completed before it can perform the second correspondence update operation. In the second update method, since the second memory area is different from the first memory area, the cost calculation system can directly update the new second correspondence to the second memory area. The second update method has higher update efficiency.
[0211] After the cost calculation system updates the new second correspondence to the first memory area / second memory area using either of the two update methods mentioned above, if the cost calculation system receives a new cost calculation request, it will query and read the data in the updated second correspondence in the first memory area / second memory area to perform cost calculation based on the new cost calculation request.
[0212] It should be noted that the action of the cost calculation system updating the new second correspondence to the first / second memory area is an atomic write operation. This atomic write operation is a continuous, uninterrupted process. The cost calculation system can only begin querying the updated second correspondence in the first / second memory area for cost calculation after this atomic write operation is completed. Furthermore, the action of the cost calculation system querying and reading the updated second correspondence in the first / second memory area is an atomic read operation. The action of updating the data in the second correspondence in the region is a continuous operation that cannot be interrupted during execution. The cost calculation system can only start performing other operations on the updated second correspondence in the first memory region / second memory region after the atomic read operation is completed. For example, it can perform operations to delete or modify the updated second correspondence in the first memory region / second memory region. This can avoid conflicts between the operation of updating the second correspondence and the operation of querying and reading the updated second correspondence, which would cause the cost calculation system to fail to read the corresponding data and be unable to perform cost calculation, or cause the read data to be the data in the updated second correspondence instead of the data in the second correspondence before the update, resulting in data reading errors and thus cost calculation errors.
[0213] In a specific embodiment of this application, when the update method is the second update method, after the cost calculation system updates the new second correspondence to the second memory area, if the latest second correspondence is obtained, it can update the latest second correspondence to the first memory area. If the latest second correspondence is obtained again subsequently, it can update the second memory area again, and so on. After each update of the second correspondence, when the cost calculation system receives a new cost calculation task, it can point the read pointer (used to obtain the data required for the cost calculation task) to the updated position of the second correspondence. Subsequently, based on the position pointed to by the read pointer, it queries and reads the data in the second correspondence to perform cost calculation, thereby separating the update process of the second correspondence from the process of querying and reading the data in the second correspondence, avoiding read-write conflicts that could lead to data reading errors and cause cost calculation errors.
[0214] When the update method is the second update method, the method of updating the second correspondence each time can be a full refresh or an incremental refresh, and this application does not make a specific limitation. Among them, a full refresh means replacing the old second correspondence with the new second correspondence, while an incremental refresh means comparing the old second correspondence with the new second correspondence, retaining the parts of the old second correspondence that are the same as the new second correspondence, and refreshing the parts of the new second correspondence that are different from the old second correspondence to the old second correspondence.
[0215] It is understandable that when at least one computing node in a cost computing system is a single GPU, and the first and second memory regions are regions within the GPU's video memory, cost computing efficiency is higher compared to when at least one computing node is a single GPU, a single CPU, a single TPU, or a single NPU, and the first and second memory regions are regions within the memory of the computing device to which the cost computing system belongs. This is because the GPU's speed of reading and writing its own video memory is much higher than the speed at which the GPU, CPU, TPU, and NPU read and write to the computing device's memory. Furthermore, when at least one computing node in a cost computing system is a single GPU, a single CPU, a single TPU, or a single NPU, computational resources can be saved compared to when at least one computing node is multiple GPUs, multiple CPUs, multiple TPUs, or multiple NPUs.
[0216] As can be seen, in the cost calculation method provided in this application, the user only needs to input the identifiers of multiple sales units, the unit prices of multiple sales units, and the correspondence between various calculation elements, as well as input the cost calculation request, and then wait for the cost calculation system to complete the cost calculation and obtain the cost calculation result. The entire cost calculation process is simple, fast, and highly efficient. Moreover, compared with manual cost calculation, the cost calculation system is more accurate because manual calculation usually involves calculation errors.
[0217] In order to better understand the technical effects of this application, the following will be combined with Figure 4 and Figure 5 Examples of interface diagrams that may appear in the cost calculation method provided in this application are given.
[0218] Figure 4 This is an example diagram of the configuration interface in a cost calculation method provided in an embodiment of this application. This interface is an exemplary demonstration and is not intended to limit the scope of the application. Figure 4 As shown, the configuration interface includes a sales unit configuration area 410, a contract configuration area 420, and a cost calculation control 430.
[0219] The sales unit configuration area 410 is used for users to upload the identifiers of multiple sales units, the unit prices of multiple sales units, and the correspondence between various calculation elements, i.e., the first correspondence.
[0220] The contract configuration area 420 is used for users to upload contracts (including configuration lists) for which cost calculations will be performed.
[0221] The cost calculation control 430 is for users to click. After the user clicks it, the cost calculation system starts to perform cost calculation based on the first correspondence and the configuration list in the contract.
[0222] Specifically, after the user clicks on the cost calculation control 430, the client executes... Figure 2 As shown in S201~S202 and S204~S205, the cost calculation system executes S203 and S206~S208 to obtain the cost calculation results.
[0223] For example, Figure 5 This is a diagram showing a cost calculation result as provided in an embodiment of this application. This interface is an exemplary representation and is not intended to limit the scope of the application. Figure 5 As shown, the cost display interface includes a cost display area 510 and a contract display area 520.
[0224] The cost display area 510 is used to display the calculated total cost to the user. In practice, the total cost can be highlighted by bolding, highlighting, or adding a horizontal line below it, so that the user can easily and quickly view the total cost.
[0225] The contract display area 520 is used to display the contract to the user.
[0226] It needs to be explained that, Figure 4 For ease of understanding, the sales unit configuration area 410, contract configuration area 420, and cost calculation control 430 are drawn on the same configuration page. In practice, they can also be drawn on different configuration pages. For example, the sales unit configuration area 410 is drawn on one configuration page, while the contract configuration area 420 and cost calculation control 430 are drawn on another configuration page.
[0227] It should also be noted that the above Figure 4 , Figure 5 Examples are provided for illustration purposes and are not intended to be specific.
[0228] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0229] The architecture and cost calculation method of the cost calculation system provided in the embodiments of this application have been described in detail above. The following section, in conjunction with... Figure 6 The unit modules within the cost calculation system provided in the embodiments of this application will be explained and described.
[0230] Figure 6 This is a schematic diagram of the structure of a cost calculation system 600 provided in an embodiment of this application. The system 600 can be... Figures 1-5 The cost calculation system described in the embodiments, such as Figure 6 As shown, the cost calculation system 600 includes a first acquisition module 610, a second acquisition module 620, and a cost calculation module 630. The functions of each module of the cost calculation system 600 are described below as an example.
[0231] The first acquisition module 610 is used to acquire the first correspondence relationship input by the user. The first correspondence relationship indicates the correspondence between the identifiers of multiple sales units, the unit price of multiple sales units, and multiple calculation elements, which are factors that affect the unit price of multiple sales units.
[0232] The first acquisition module 610 is also used to acquire a cost calculation request input by the user. The cost calculation request includes the identifiers of multiple first sales units, a first calculation element, and the quantity of multiple first sales units. The cost calculation request is used to calculate the total cost of multiple first sales units. Multiple first sales units belong to multiple sales units. The first calculation element is an element that affects the unit price of multiple first sales units.
[0233] The second acquisition module 620 is used to acquire a first vector, a second vector, and a second correspondence. The elements in the first vector are vectorized identifiers of multiple first sales units, the elements in the second vector are vectorized first calculation elements, and the second correspondence indicates the correspondence between the vectorized identifiers of multiple sales units, the unit price of multiple sales units, and the vectorized multiple calculation elements.
[0234] The cost calculation module 630 is used to calculate the total cost of multiple first sales units based on the first vector, the second vector, the second correspondence, and the number of multiple first sales units.
[0235] In some possible embodiments, such as Figure 6 As shown, system 600 also includes a cost sending module 640 for sending the total cost of multiple first sales units to the client.
[0236] In some possible embodiments, the cost calculation module 630 is specifically used to: query a second correspondence based on the first vector and the second vector to obtain a third vector, wherein the elements in the third vector are the unit prices of multiple first sales units; calculate the inner product of the third vector and the fourth vector in parallel computing mode as the total cost of multiple first sales units, wherein the elements in the fourth vector are the quantity of multiple first sales units.
[0237] In some possible embodiments, such as Figure 6 As shown, the system 600 also includes a first memory region and a data writing module 650. The data writing module 650 is used to write the second correspondence into the first memory region through an atomic write operation.
[0238] In some possible embodiments, the cost calculation module 630 is used to query a second correspondence based on a first vector and a second vector through an atomic read operation, read the unit price of multiple first sales units in the second correspondence, and obtain a third vector.
[0239] In some possible embodiments, such as Figure 6 As shown, the system 600 also includes a second memory region, which is different from the first memory region. The second acquisition module 620 is also used to acquire a new second correspondence, and the data writing module 650 is also used to write the new second correspondence into the second memory region.
[0240] In some possible embodiments, the system includes at least one computing node, which includes one or more of a GPU, CPU, TPU, and NPU. Figure 6 Not shown.
[0241] In some possible embodiments, at least one computing node is a first GPU, and the first memory region and the second memory region are different regions in the video memory of the first GPU.
[0242] In some possible embodiments, after acquiring the first correspondence and cost calculation request, the first acquisition module 610 can store the identifiers, first calculation elements, and quantities of the multiple first sales units in the first correspondence and cost calculation request in a third memory area. Subsequently, the second acquisition module 620 can acquire the first correspondence, the identifiers of the multiple first sales units, and the first calculation elements from the third memory area, and acquire the first vector, the second vector, and the second correspondence based on these data. The third memory area is different from both the first and second memory areas.
[0243] In specific implementations, modules such as the first acquisition module 610, the second acquisition module 620, the cost calculation module 630, and the cost sending module 640 can all be implemented in software or in hardware. For example, the implementation of the cost calculation module 630 will be described below. Similarly, the implementation methods of modules such as the first acquisition module 610, the second acquisition module 620, and the cost sending module 640 can refer to the implementation method of the cost calculation module 630.
[0244] As an example of a software functional unit, the cost calculation module 630 may include code running on a computing instance. The computing instance may include at least one of a physical host (computing device), a virtual machine, or a container. Further, the aforementioned computing instance may be one or more. For example, the cost calculation module 630 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed within the same region or in different regions. Further, the multiple hosts / virtual machines / containers used to run the code may be distributed within the same availability zone (AZ) or in different AZs, each AZ including one or more geographically proximate data centers. Typically, a region may include multiple AZs.
[0245] Similarly, multiple hosts / virtual machines / containers used to run this code can be distributed within the same Virtual Private Cloud (VPC) or across multiple VPCs. Typically, a VPC is set up within a region. Communication between two VPCs within the same region, as well as between VPCs in different regions, requires a communication gateway to be set up within each VPC to enable interconnection between VPCs.
[0246] As an example of a hardware functional unit, the cost calculation module 630 may include at least one computing device, such as a server. Alternatively, the cost calculation module 630 may also be implemented using a CPU, GPU, application-specific integrated circuit (ASIC), programmable logic device (PLD), complex programmable logical device (CPLD), field-programmable gate array (FPGA), generic array logic (GAL), DPU, NPU, TPU, XPU, SoC, offload card, accelerator card, or any combination thereof.
[0247] When the cost calculation module 630 includes multiple computing devices, these devices can be distributed within the same region or in different regions. Similarly, the multiple computing devices included in the cost calculation module 630 can be distributed within the same Availability Zone (AZ) or in different AZs. Likewise, the multiple computing devices included in the cost calculation module 630 can be distributed within the same Virtual Private Cloud (VPC) or in multiple VPCs. These multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, GALs, DPUs, NPUs, TPUs, XPUs, SoCs, offloading cards, and accelerator cards.
[0248] It should be noted that, in other embodiments, the cost calculation module 630 can be used to execute any step in the cost calculation method provided in this application, the first acquisition module 610 can be used to execute any step in the cost calculation method provided in this application, the second acquisition module 620 can be used to execute any step in the cost calculation method provided in this application, the cost sending module 640 can be used to execute any step in the cost calculation method provided in this application, and the data writing module 650 can be used to execute any step in the cost calculation method provided in this application. The steps implemented by the first acquisition module 610, the second acquisition module 630, the second acquisition module 620, the cost sending module 640, and the data writing module 650 can be specified as needed. Through the first acquisition module 610, the second acquisition module 620, the cost calculation module 630, the cost sending module 640, and the data writing module 650, different steps in the cost calculation method provided in this application are implemented respectively to realize all the functions of the cost calculation system 600.
[0249] It should be understood that the functions of each module described above are only the functions that the cost calculation system 600 may have in some embodiments of this application, and this application does not limit the functions of each module.
[0250] It should also be understood that Figure 6 This is an exemplary division method. The cost calculation system 600 may also include more or fewer modules. The division method of the modules in the cost calculation system 600 can be flexibly adjusted based on the actual business scenario. This application does not make any specific limitations.
[0251] This application also provides a computing device 700, which can deploy the aforementioned cost calculation system. The operation and / or function of each module in the computing device 700 are respectively to implement the corresponding steps in the cost calculation method provided in this application.
[0252] like Figure 7 As shown, the computing device 700 includes a processor 710, a memory 720, and a communication interface 730, wherein the processor 710, the memory 720, and the communication interface 730 can be interconnected via a bus 740.
[0253] The processor 710 can read program code (including instructions) stored in the memory 720, execute the program code stored in the memory 720, so that the computing device 700 executes the cost calculation method provided in this application, or so that the computing device 700 deploys the cost calculation system 600.
[0254] The processor 710 may include any one or more computing devices such as CPU, GPU, microprocessor (MP) or digital signal processor (DSP), ASIC, FPGA, CPLD, NPU, TPU, XPU, SoC, offload card, accelerator card, etc.
[0255] The processor 710 executes various types of digital storage instructions, such as software or firmware programs stored in the memory 720, which enables the computing device 700 to provide a wide range of services.
[0256] In a specific implementation, as one example, the processor 710 includes one or more CPUs.
[0257] In a specific implementation, as one example, the computing device 700 also includes multiple processors, each of which can be a single-core processor (single-CPU) or a multi-core processor (multi-CPU). Here, a processor refers to one or more devices, circuits, and / or processing cores used to process data (e.g., computer program instructions).
[0258] The memory 720 stores program code, which is executed under the control of the processor 710 to perform the cost calculation method provided in this application. The program code may include one or more software modules, which can be... Figure 6 The software modules provided in the embodiments include the first acquisition module 610, the cost calculation module 630, the second acquisition module 620, and the cost sending module 640.
[0259] The memory 720 may include volatile memory, such as random access memory (RAM); the memory 720 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid-state drive (SSD); the memory 720 may also include combinations of the above types.
[0260] The communication interface 730 can be a wired interface (e.g., an Ethernet interface, a fiber optic interface, or other types of interfaces (e.g., an InfiniBand interface)) or a wireless interface (e.g., a cellular network interface or a wireless LAN interface) for communicating with other computing devices or apparatuses. The communication interface 730 can employ a protocol suite based on Transmission Control Protocol / Internet Protocol (TCP / IP), such as Remote Function Call (RFC), Simple Object Access Protocol (SOAP), Simple Network Management Protocol (SNMP), Common Object Request Broker Architecture (CORBA), and distributed protocols, etc.
[0261] The 740 bus can be a peripheral component interconnect express (PCIe) bus, an extended industry standard architecture (EISA) bus, a unified bus (Ubus or UB), a compute express link (CXL) bus, a cache coherent interconnect for accelerators (CCIX) bus, etc. The 740 bus can be divided into address bus, data bus, control bus, etc.
[0262] In addition to the data bus, bus 740 may also include a power bus, a control bus, and a status signal bus. However, for clarity, all buses are labeled as bus 740 in the diagram. For ease of illustration, Figure 7 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0263] As one possible implementation, the computing device 700 may also include a chip system, which includes a processor 710 and a power supply circuit. The power supply circuit supplies power to the processor 710, which executes the operation steps corresponding to the cost calculation method. For simplicity, further details are omitted here. The processor 710 can be implemented using a CPU, or it can be implemented using computing devices or AI chips such as GPUs, DPUs, NPUs, TPUs, XPUs, SoCs, offloading cards, or accelerator cards.
[0264] As one possible implementation, the computing device 700 may include multiple types of processors 710, meaning the computing device 700 is a heterogeneous device. For example, the computing device 700 may include a CPU and a GPU, and at least one of these processors can execute the operation steps corresponding to the cost calculation method. For the sake of brevity, further details will not be elaborated here.
[0265] The aforementioned computing device 700 is used to execute the cost calculation method provided in this application. The specific implementation process is detailed in the above method embodiments, and will not be repeated here.
[0266] It should be understood that the computing device 700 is merely one example provided in the embodiments of this application, and the computing device 700 may have more than Figure 7 The illustrated components may include more or fewer components, or two or more components may be combined, or different configurations of components may be used. For details regarding anything not shown or described in the embodiments of this application, please refer to the foregoing. Figures 1-6 The relevant descriptions in the embodiments will not be repeated here.
[0267] This application also provides a computing device cluster 800, which can deploy the aforementioned cost calculation system. The operation and / or function of each module in the computing device cluster 800 are respectively to implement the corresponding steps in the cost calculation method provided in this application.
[0268] like Figure 8 As shown, the computing device cluster 800 includes at least one computing device 700. The memory 720 of one or more computing devices 700 in the computing device cluster may store the same instructions for executing the cost calculation method provided in this application. The computing device 700 may be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device 700 may also be a terminal device such as a desktop computer, a laptop computer, or a smartphone.
[0269] In some possible implementations, the memory 720 of one or more computing devices 700 in the computing device cluster 800 may also store instructions for executing the cost calculation method provided in this application. In other words, a combination of one or more computing devices 700 can jointly execute the instructions for executing the cost calculation method provided in this application.
[0270] It should be noted that the memory 720 in different computing devices 700 within the computing device cluster 800 can store different instructions, each used to execute a portion of the functions of the cost calculation system 600. That is, the instructions stored in the memory 720 of different computing devices 700 can implement the functions of one or more modules among the first acquisition module 610, the cost calculation module 630, the second acquisition module 620, the cost sending module 640, and the data writing module 650.
[0271] In some possible implementations, one or more computing devices 700 in the computing device cluster 800 can be connected via a network. This network can be a wide area network (WAN) or a local area network (LAN), etc. Figure 9 One possible implementation is shown, such as Figure 9 As shown, the two computing devices 700A and 700B are connected via a network. Specifically, they are connected to the network through the communication interfaces in each computing device. In this possible implementation, the memory 720 in computing device 700A stores instructions for performing the functions of the first acquisition module 610 and the cost transmission module 640. Simultaneously, the memory 720 in computing device 700B stores instructions for performing the functions of the second acquisition module 620, the cost calculation module 630, and the data writing module 650.
[0272] Figure 9 The implementation of the computing device cluster 800 shown may be based on the fact that the cost calculation method provided in this application requires obtaining a large number of first vectors, second vectors and second correspondences, and performing a large number of cost calculation tasks based on a large number of first vectors, second vectors and second correspondences. Therefore, it is considered that the functions implemented by the second acquisition module 620, the cost calculation module 630 and the data writing module 650 are handed over to the computing device 700B for execution.
[0273] It should be understood that Figure 9 The functions of the computing device 700A shown can also be performed by multiple computing devices 700. Similarly, the functions of the computing device 700B can also be performed by multiple computing devices 700.
[0274] This application also provides a computer program product containing instructions, which may be a software or program product containing instructions capable of running on a computing device or stored on any usable medium. When the computer program product is run on at least one computing device, it causes the at least one computing device to execute the cost calculation method provided in this application.
[0275] This application also provides a computer-readable storage medium, which can be any available medium capable of being stored by a computing device or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., high-density digital video disc (DVD), or a semiconductor medium (e.g., solid-state drive), etc. The computer-readable storage medium includes instructions that instruct a computing device to execute the cost calculation method provided in this application.
[0276] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0277] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium, or a semiconductor medium, etc.
[0278] The above description is merely a specific embodiment of this application. Any variations or substitutions conceived by those skilled in the art based on the specific embodiments provided in this application should be covered within the protection scope of this application.
Claims
1. A cost calculation method, characterized in that, The method, applied to a cost calculation system, includes: Obtain the first correspondence relationship input by the user, the first correspondence relationship indicating the correspondence between the identifiers of multiple sales units, the unit price of the multiple sales units, and multiple calculation elements, the multiple calculation elements being the factors affecting the unit price of the multiple sales units; The user inputs a cost calculation request, which includes the identifiers of multiple first sales units, a first calculation element, and the quantity of the multiple first sales units. The cost calculation request is used to calculate the total cost of the multiple first sales units. The multiple first sales units belong to the multiple sales units. The first calculation element is a factor that affects the unit price of the multiple first sales units. Obtain a first vector, a second vector, and a second correspondence. The elements in the first vector are vectorized identifiers of the plurality of first sales units, the elements in the second vector are vectorized first calculation elements, and the second correspondence indicates the correspondence between the vectorized identifiers of the plurality of sales units, the unit price of the plurality of sales units, and the vectorized multiple calculation elements. The total cost of the plurality of first sales units is calculated based on the first vector, the second vector, the second correspondence, and the number of the plurality of first sales units.
2. The method according to claim 1, characterized in that, The step of calculating the total cost of the plurality of first sales units based on the first vector, the second vector, the second correspondence, and the number of the plurality of first sales units includes: Based on the first vector and the second vector, the second correspondence is queried to obtain the third vector, and the elements in the third vector are the unit prices of the plurality of first sales units; The inner product of the third and fourth vectors is calculated in parallel to represent the total cost of the plurality of first sales units, wherein the elements in the fourth vector represent the number of the plurality of first sales units.
3. The method according to claim 1 or 2, characterized in that, The cost calculation system includes a first memory area. After obtaining the second correspondence, and before calculating the total cost of the plurality of first sales units based on the first vector, the second vector, the second correspondence, and the number of the plurality of first sales units, the method further includes: The second correspondence is written to the first memory region through an atomic write operation.
4. The method according to claim 2 or 3, characterized in that, The step of querying the second correspondence based on the first vector and the second vector to obtain the third vector includes: By performing an atomic read operation, the second correspondence is queried based on the first vector and the second vector, and the unit price of the multiple first sales units in the second correspondence is read to obtain the third vector.
5. The method according to any one of claims 3 or 4, characterized in that, The cost calculation system further includes a second memory region, which is different from the first memory region, and the method further includes: Obtain the new second correspondence and write the new second correspondence into the second memory area.
6. The method according to any one of claims 1 to 5, characterized in that, The cost calculation system includes at least one computing node, which includes any one or more of the following: graphics processing unit (GPU), central processing unit (CPU), tensor processor (TPU), and neural network processor (NPU).
7. The method according to claim 6, characterized in that, The at least one computing node is a first GPU, and the first memory region and the second memory region are different regions in the video memory of the first GPU.
8. A cost calculation system, characterized in that, include: The first acquisition module is used to acquire a first correspondence relationship input by the user. The first correspondence relationship indicates the correspondence between the identifiers of multiple sales units, the unit price of the multiple sales units, and multiple calculation elements, wherein the multiple calculation elements are elements that affect the unit price of the multiple sales units. The first acquisition module is further configured to acquire the cost calculation request input by the user. The cost calculation request includes the identifiers of multiple first sales units, a first calculation element, and the quantity of the multiple first sales units. The cost calculation request is used to calculate the total cost of the multiple first sales units. The multiple first sales units belong to the multiple sales units. The first calculation element is a factor that affects the unit price of the multiple first sales units. The second acquisition module is used to acquire a first vector, a second vector, and a second correspondence. The elements in the first vector are vectorized identifiers of the plurality of first sales units, the elements in the second vector are vectorized first calculation elements, and the second correspondence indicates the correspondence between the vectorized identifiers of the plurality of sales units, the unit price of the plurality of sales units, and the vectorized multiple calculation elements. The cost calculation module is used to calculate the total cost of the plurality of first sales units based on the first vector, the second vector, the second correspondence, and the number of the plurality of first sales units.
9. The system according to claim 8, characterized in that, The cost calculation module is specifically used for: Based on the first vector and the second vector, the second correspondence is queried to obtain the third vector, and the elements in the third vector are the unit prices of the plurality of first sales units; The inner product of the third and fourth vectors is calculated in parallel to represent the total cost of the plurality of first sales units, wherein the elements in the fourth vector represent the number of the plurality of first sales units.
10. The system according to claim 8 or 9, characterized in that, The system also includes a first memory region and a data writing module; The data writing module is used to write the second correspondence into the first memory area through an atomic write operation.
11. The system according to claim 9 or 10, characterized in that, The cost calculation module is used to query the second correspondence based on the first vector and the second vector through atomic read operations, read the unit price of the multiple first sales units in the second correspondence, and obtain the third vector.
12. The system according to any one of claims 10 or 11, characterized in that, The system also includes a second memory region, which is different from the first memory region; The second acquisition module is also used to acquire a new second correspondence; The data writing module is further configured to write the new second correspondence into the second memory region.
13. The system according to any one of claims 8 to 12, characterized in that, The system includes at least one computing node, which includes any one or more of GPU, CPU, TPU and NPU.
14. The system according to claim 13, characterized in that, The at least one computing node is a first GPU, and the first memory region and the second memory region are different regions in the video memory of the first GPU.
15. A computing device, characterized in that, The computing device includes a processor and a memory, the memory being used to store instructions and the processor being used to execute the instructions such that the computing device implements the method as claimed in any one of claims 1 to 7.
16. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed by a computing device or a cluster of computing devices, implement the method as claimed in any one of claims 1 to 7.
17. A computer program product containing instructions, characterized in that, When the instructions are executed by the computing device, the computing device performs the operational steps of the method as described in any one of claims 1 to 7.