A pipeline dynamic sorting scheduling method and system for fruit weighing
Patent Information
- Application Number
- CN202611240460.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-07
- Publication Date
- 2026-10-30
AI Technical Summary
[0004]针对现有技术存在的局部贪心策略易产生死组合、多容器并发分配效率低及缺乏配重指导的问题,本申请通过一种用于水果称重的流水线动态分拣调度方法及系统,实现对未分配待配重单元的全局遍历搜索与边界剪枝、基于消耗优先级的互斥分配以及补充单元配重指导信息的生成,从而提升分拣调度的实时性与资源利用率
[0025]本申请提供一种用于水果称重的流水线动态分拣调度方法及系统,能够通过对待配重单元集合进行基于多重约束条件的遍历搜索与边界剪枝,改变了传统局部贪心策略仅关注当前到达物品的局限,实现了对全局未分配资源的整体寻优,从根源上消除了因局部决策导致的死组合问题,显著提升了目标分配容器的利用率与剩余物品的可组合性。在此基础上,通过基于组合消耗优先级的排序与互斥选择约束,使得多个空闲目标分配容器能够从同一全局候选池中并发获取无冲突的最优组合,解决了多通道场景下的调度瓶颈,提高了分拣线的整体吞吐效率。进一步地,通过在无法生成有效候选组合时自动生成补充单元的配重指导信息,并将该信息与现有物理单元建立可解释的映射关系,将原本被动的等待过程转化为主动的上料指引,有效缩短了成组等待时间,提升了人机协作效率与产线节拍的稳定性。综上,本申请在算力受限的工业环境下,实现了兼顾实时性、全局最优性与操作指导性的动态分拣调度。
Smart Images

Figure CN123014569A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of intelligent sorting and combination optimization technology, and in particular to a dynamic sorting scheduling method and system for fruit weighing production lines. Background Technology
[0002] In fresh produce distribution, logistics delivery, and industrial packaging, weighing and packing of goods are crucial steps. Existing dynamic sorting and scheduling technologies typically employ a local greedy strategy, which involves sequentially adding items to a fixed target distribution container according to their arrival order on the conveyor line. When the accumulated weight reaches a preset target range, a group is allocated. This approach is logically simple and has low real-time requirements for computing resources, making it a commonly used basic scheduling solution in industrial settings.
[0003] However, in actual production, with the increase in sorting line speed and the growing demand for diversified packaging specifications, the unidirectional accumulation based solely on arrival order easily leads to "dead combinations" that are locally feasible but cannot be matched with other remaining items, resulting in decreased utilization of target allocation containers and stockpiling of remaining items. Furthermore, when faced with multiple constraints such as the number of combination units, total weight, and single unit weight, existing solutions struggle to optimize unassigned items globally and cannot support multiple idle target allocation containers concurrently acquiring non-conflicting combinations from the same candidate pool, creating scheduling bottlenecks. In addition, when currently unassigned items cannot meet grouping conditions, the system lacks a reverse deduction mechanism based on the existing item status, failing to provide clear guidance on supplementary item attributes, forcing operators to blindly load and wait, prolonging grouping waiting time. Therefore, a dynamic sorting scheduling method is urgently needed that can achieve global combination optimization under multiple constraints, support concurrent allocation of multiple containers, and provide interpretable weight guidance. Summary of the Invention
[0004] To address the problems of existing technologies, such as the tendency of local greedy strategies to produce dead combinations, low efficiency of concurrent allocation of multiple containers, and lack of weight guidance, this application proposes a dynamic sorting and scheduling method and system for fruit weighing production lines. This method achieves global traversal search and boundary pruning of unassigned units to be weighted, mutual exclusion allocation based on consumption priority, and generation of supplementary unit weight guidance information, thereby improving the real-time performance and resource utilization of sorting and scheduling.
[0005] To achieve the above objectives, this application adopts the following technical solution: In a first aspect, a dynamic sorting and scheduling method for fruit weighing on a production line includes: acquiring an unassigned set of units to be weighed and preset multiple constraints, the multiple constraints including constraints on the number of combined units, total combined weight, and unit weight; based on the multiple constraints, performing traversal search and boundary pruning on the set of units to be weighed to generate a set of candidate combinations that satisfy the multiple constraints; sorting the set of candidate combinations based on the combination consumption priority, and selecting conflict-free candidate combinations from the set of candidate combinations through mutual exclusion selection constraints, and assigning them to an idle target allocation container; and in response to the set of units to be weighed failing to generate a valid candidate combination that satisfies the multiple constraints, generating weighting guidance information for supplementary units.
[0006] The above scheme replaces the traditional local sequential accumulation by performing a global traversal search and boundary pruning on all unassigned units to be counterweighted, fundamentally eliminating the generation of dead combinations. By sorting and mutually exclusive selection based on the priority of combination consumption, multiple idle target allocation containers can concurrently obtain conflict-free combinations from the same global candidate pool, improving scheduling efficiency. By generating counterweight guidance information for supplementary units when grouping is not possible, clear guidance is provided for manual or automatic feeding, shortening the grouping waiting time.
[0007] In conjunction with the first aspect mentioned above, in one possible implementation, the process of traversing and pruning the set of counterweight units to generate a candidate combination set that satisfies multiple constraints includes: arranging each counterweight unit in the set of counterweight units in non-descending order by weight to construct a cumulative weight array; performing a depth-first traversal starting from an empty combination based on the constraint of the number of combination units, using the cumulative weight array for upper and lower bound evaluation during the traversal process to prune search branches that do not satisfy the total weight constraint of the combination; when the number of counterweight units selected by the traversal satisfies the constraint of the number of combination units and the total weight falls within the range of the total weight constraint of the combination, the current combination is recorded as a valid candidate combination in the candidate combination set.
[0008] This implementation reduces the time complexity of combinatorial search from exponential to a manageable range by constructing a cumulative weight array and combining it with depth-first traversal. This enables millisecond-level real-time recalculation even on industrial control equipment with limited computing power, ensuring the engineering feasibility of global optimization.
[0009] In conjunction with the first aspect mentioned above, in one possible implementation, the process of using an accumulated weight array for upper and lower bound evaluation during traversal to prune search branches that do not meet the combined total weight constraint includes: during traversal, assuming the current combination already contains a first number of weight-bearing units, the total weight of the current combination is the first weight value, and the starting position of the next traversal in the set of weight-bearing units is the first index; the current combination is still a second number of weight-bearing units short of the target number of combination units required by the combination unit number constraint, the second number being equal to the target number of combination units minus the first number; in this state: if the sum of the first weight value and the weight of the second number of weight-bearing units with the smallest weight starting from the first index is greater than the upper limit of the combined total weight constraint, then the current branch is determined to be overweight and the current branch is pruned; if the sum of the first weight value and the weight of the second number of weight-bearing units with the largest global weight is less than the lower limit of the combined total weight constraint, then the current branch is determined to be underweight and the current branch is pruned.
[0010] This implementation method terminates invalid search paths that are bound to be overweight or underweight in advance through precise mathematical boundary determination. Without missing any valid candidate combinations, it minimizes computational redundancy and further improves the algorithm's response speed in high-frequency triggering scenarios.
[0011] In conjunction with the first aspect mentioned above, in one possible implementation, the process of sorting the candidate combination set based on the combination consumption priority and selecting conflict-free candidate combinations from the candidate combination set through mutual exclusion selection constraints and allocating them to an idle target allocation container includes: sorting each candidate combination in the candidate combination set in ascending order of the number of combination units and the total weight of the combination; initializing the allocated index set to empty and traversing the sorted candidate combinations in turn; if the unit index contained in the current candidate combination has no intersection with the allocated index set, adding the unit index contained in the selected current candidate combination to the allocated index set and allocating it to an idle target allocation container; stopping the selection when the number of selected candidate combinations reaches the number of currently idle target allocation containers.
[0012] This implementation uses a dual sorting rule of "ascending order of unit number + ascending order of total weight" to prioritize the consumption of fewer units and lighter combinations, while reserving more remaining units and heavier units for subsequent combinations, effectively reducing the overall surplus rate. At the same time, through index mutual exclusion checks, it ensures that the same unit to be weighted will not be allocated repeatedly, guaranteeing data consistency in concurrent scheduling of multiple containers.
[0013] In conjunction with the first aspect above, in one possible implementation, the process of generating counterweight guidance information for supplementary units in response to the inability of the set of units to be counterweighted to generate effective candidate combinations that satisfy multiple constraints includes: based on the constraint of the number of combined units, extracting an existing subset of units containing a target number of units to be counterweighted from the units to be counterweighted sorted by weight through a sliding window, wherein the target number is one less than the target number of combined units in the constraint of the number of combined units, and calculating the total weight of the existing subset of units; based on the constraint of total combined weight and unit weight, calculating an effective weight interval, wherein the effective weight interval is the range of weight values that satisfy multiple constraints after the supplementary unit is added to the existing subset of units; overlapping and merging the effective weight intervals corresponding to the existing subset of units, and retaining a corresponding representative subset of units for each merged effective weight interval to establish a mapping relationship between the effective weight interval and the existing physical units.
[0014] This implementation not only calculates the theoretical supplementary weight range, but also establishes a mapping relationship between the suggested range and the existing physical units by retaining a subset of representative units. This gives the counterweight guidance information interpretability, enabling operators to intuitively understand the source and rationality of the suggestions, and enhancing the trust and execution efficiency of human-machine collaboration.
[0015] In conjunction with the first aspect mentioned above, in one possible implementation, the process of calculating the effective weight range based on the combined total weight constraint and the unit weight constraint includes: determining the maximum value between the difference between the lower limit of the combined total weight constraint and the total weight, and the lower limit of the unit weight constraint, as the lower bound of the effective weight range; determining the minimum value between the difference between the upper limit of the combined total weight constraint and the total weight, and the upper limit of the unit weight constraint, as the upper bound of the effective weight range; and determining the effective weight range as valid when the lower bound is not greater than the upper bound.
[0016] This implementation method ensures that the generated suggested weight range satisfies both combination-level and unit-level constraints by taking the intersection operation. This avoids invalid suggestions that may meet the total weight requirement but exceed the unit weight requirement (or vice versa), thus guaranteeing the engineering effectiveness of the counterweight guidance information.
[0017] In conjunction with the first aspect above, one possible implementation further includes: in response to at least one of the following: detecting a new qualified counterweight unit being enqueued, multiple constraints changing, the target allocation container being released, the temporary weight limit offset being adjusted, or the counterweight unit being abnormally recycled, re-executing the steps of traversal search and boundary pruning and mutual exclusion selection.
[0018] This implementation defines a clear recalculation trigger mechanism to ensure that the system state is always synchronized with the real-time changes in the physical environment. Whether it is the arrival of new materials or the release of resources, global optimization can be triggered in an instant to maintain the continuity and stability of the production line cycle.
[0019] In conjunction with the first aspect mentioned above, in one possible implementation, the process of obtaining the set of unassigned counterweight units includes: adding the counterweight units that have completed weight acquisition to a first-in-first-out queue in the order of arrival; determining the qualification of the counterweight units according to the unit weight constraints when enqueuing; adding qualified counterweight units that meet the unit weight constraints to the set of unassigned counterweight units for subsequent combination optimization; and marking unqualified counterweight units that do not meet the unit weight constraints and excluding them from the combination search range.
[0020] This implementation method performs quality filtering at the data entry point, preventing unqualified units from entering the combinatorial search space. This avoids wasting ineffective computing resources, ensures the purity of the datasets involved in optimization, and improves the accuracy of subsequent algorithm execution.
[0021] In conjunction with the first aspect above, one possible implementation further includes: when the number of selected candidate combinations is less than the number of currently idle target allocation containers after the mutual exclusion selection ends, the selected candidate combinations are allocated to the corresponding idle target allocation containers, and the remaining idle target allocation containers are kept in a waiting state; the unallocated weight units are kept in the unallocated weight unit set, and the steps of traversal search, boundary pruning, and mutual exclusion selection are re-executed when the next triggering event occurs, until all idle target allocation containers are allocated or the candidate combination set is exhausted.
[0022] This implementation adopts a "partial allocation + waiting for recalculation" degradation strategy, which is different from the rigid "all or nothing" allocation mode in the existing technology. It ensures that even if there are insufficient candidate combinations, the existing combinations can still be issued and executed in time, avoiding production line stoppages caused by waiting for a perfect solution, and reflecting the priority guarantee of continuity in industrial control.
[0023] Secondly, a dynamic sorting and scheduling system for fruit weighing production lines is provided, applied to a dynamic sorting and scheduling method for fruit weighing production lines as described in any of the first aspects above. The system includes a communication unit and a processing unit. The communication unit is used to acquire an unassigned set of units to be weighed and preset multiple constraints, including constraints on the number of combined units, the total weight of the combination, and the unit weight; and outputs the target allocation container information and weighting guidance information after allocation. The processing unit is used to perform traversal search and boundary pruning on the set of units to be weighed based on the multiple constraints, generating a set of candidate combinations that satisfy the multiple constraints; sorting the candidate combination set based on the combination consumption priority, and selecting conflict-free candidate combinations from the candidate combination set through mutual exclusion selection constraints, and allocating them to idle target allocation containers; and generating weighting guidance information for supplementary units in response to the set of units to be weighed failing to generate valid candidate combinations that satisfy the multiple constraints.
[0024] The system, through the collaborative work of the communication unit and the processing unit, solidifies the global combinatorial optimization algorithm into a deployable software module, achieving seamless integration with physical sorting equipment and ensuring the stable implementation and efficient execution of optimization strategies in the industrial field.
[0025] This application provides a dynamic sorting and scheduling method and system for fruit weighing production lines. It overcomes the limitations of traditional local greedy strategies that only focus on currently arriving items by performing a multi-constraint-based traversal search and boundary pruning on the set of units to be weighed. This achieves overall optimization of globally unallocated resources, fundamentally eliminating dead combination problems caused by local decisions and significantly improving the utilization rate of target allocation containers and the combinability of remaining items. Furthermore, by using sorting and mutual exclusion constraints based on combination consumption priority, multiple idle target allocation containers can concurrently obtain conflict-free optimal combinations from the same global candidate pool, solving scheduling bottlenecks in multi-channel scenarios and improving the overall throughput efficiency of the sorting line. Moreover, by automatically generating weight guidance information for supplementary units when no effective candidate combination can be generated, and establishing an interpretable mapping relationship between this information and existing physical units, the originally passive waiting process is transformed into proactive loading guidance, effectively shortening group waiting time and improving human-machine collaboration efficiency and production line cycle stability. In summary, this application achieves dynamic sorting scheduling that balances real-time performance, global optimization, and operational guidance in industrial environments with limited computing power. Attached Figure Description
[0026] Figure 1 A flowchart illustrating a dynamic sorting and scheduling method for fruit weighing on a production line, provided in an embodiment of this application; Figure 2A schematic diagram of the traversal search and boundary pruning process based on multiple constraints in a dynamic sorting and scheduling method for fruit weighing provided in an embodiment of this application. Figure 3 A schematic diagram of the sorting and mutual exclusion selection allocation process based on the combined consumption priority in a dynamic sorting and scheduling method for fruit weighing provided in this application embodiment; Figure 4 A schematic diagram of a data consistency guarantee mechanism for mutually exclusive selection in a dynamic sorting and scheduling method for fruit weighing provided in this application embodiment; Figure 5 A schematic diagram of the degradation processing strategy flow in a dynamic sorting and scheduling method for fruit weighing provided in this application embodiment; Figure 6 A schematic diagram of the process for generating supplementary unit counterweight guidance information in a dynamic sorting and scheduling method for fruit weighing provided in this application embodiment; Figure 7 A schematic diagram illustrating the interpretable mapping relationship of counterweight guidance information in a dynamic sorting and scheduling method for fruit weighing provided in this application embodiment; Figure 8 A schematic diagram of the data preprocessing and event-driven recalculation triggering mechanism in a dynamic sorting and scheduling method for fruit weighing provided in this application embodiment; Figure 9 An architecture diagram of a dynamic sorting and scheduling system for fruit weighing provided in this application embodiment; Figure 10 This is a timing diagram of the dynamic sorting scheduling of a fruit weighing assembly line provided in an embodiment of this application. Detailed Implementation
[0027] In the description of this application, unless otherwise stated, " / " means "or," for example, A / B can mean A or B. The "and / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. Furthermore, "at least one" means one or more, and "multiple" means two or more. The terms "first," "second," etc., do not limit the quantity or order of execution, and "first," "second," etc., do not necessarily imply differences.
[0028] It should be noted that, in this application, the terms "exemplary" or "for example" are used to indicate that something is being described as an example, illustration, or illustration. Any embodiment or design described as "exemplary" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or design solutions. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0029] Example 1
[0030] like Figure 1 and 10 As shown, this embodiment provides a dynamic sorting and scheduling method for fruit weighing production lines. This method solves the technical problems of traditional local greedy strategies, such as the tendency to produce dead combinations, low concurrency efficiency, and lack of material loading guidance under multiple constraints, through global-perspective combinatorial optimization and a reverse guidance mechanism. This embodiment mainly provides a functional description of the overall execution flow of the method, aiming to establish the higher-level logic and general principles of each core step: Step S100: Obtain the set of unassigned counterweight units and preset multiple constraints, including constraints on the number of combined units, total combined weight, and unit weight.
[0031] The set of units to be counterweighted refers to the set of physical objects that have completed basic attribute collection within the current scheduling cycle but have not yet been assigned to any target allocation container. It is not limited to fruits, but can also cover any items that need to be combined according to rules, such as logistics packages, pharmaceutical preparations or industrial parts.
[0032] Multiple constraints constitute the rigid boundary of combinatorial optimization, determining the legality of candidate combinations. Specifically, the number of combinatorial units constraint limits the allowable range of the number of items in a single combination, such as a fixed number or a variable range; the total weight constraint defines the acceptable threshold for the overall weight of the combination, usually determined by packaging specifications or shipping standards; and the unit weight constraint specifies the weight eligibility of a single item to participate in the combination, used to eliminate outliers.
[0033] In some implementations, the above constraints can be dynamically loaded from a configuration file, supporting seamless switching between different product specifications on the production line.
[0034] It should be noted that by obtaining these three types of constraints as unified prerequisites, rather than verifying them in stages, it can be ensured that the subsequent search process is always carried out within a complete and consistent feasible domain, avoiding invalid calculations or omissions caused by constraint fragmentation, and laying a data foundation for global optimization.
[0035] Step S200: Based on multiple constraints, perform traversal search and boundary pruning on the set of counterweight units to be rectified to generate a set of candidate combinations that satisfy the multiple constraints.
[0036] Among them, traversal search refers to the process of systematically exploring the solution space composed of unassigned units. Its purpose is to exhaust or approximately exhaust all possible combinations, rather than focusing only on local optima.
[0037] Boundary pruning is an acceleration mechanism based on constraint feedback. It mainly evaluates the relative position of the current partial solution and the constraint boundary in real time during the search process. Once it is determined that the current path cannot satisfy the constraint no matter how it is expanded in the future (such as inevitably being overweight or inevitably being underweight), the exploration of the path is immediately terminated, thereby greatly reducing the amount of invalid computation.
[0038] In some implementations, such evaluation can be achieved based on a variety of means, such as cumulative properties, statistical distributions, or heuristic predictions, rather than being limited to a specific data structure or algorithm paradigm.
[0039] For example, the compensation capability of the remaining units can be quickly determined by pre-computing the extreme value distribution of unit attributes, and machine learning models can be used to predict the feasibility probability of branches.
[0040] It should be noted that this step, by adopting a dual upper-level design of traversal and pruning, not only ensures a full search for the global optimal solution within the limits of computing power, eliminating the dead combination risk caused by local greed, but also adapts to the stringent real-time requirements of industrial sites through dynamic pruning, making it possible to achieve millisecond-level recalculation on devices with limited computing power.
[0041] Step S300: Sort the candidate combination set based on the combination consumption priority, and select conflict-free candidate combinations from the candidate combination set through mutual exclusion selection constraints, and allocate them to the idle target allocation container.
[0042] Among them, the combination consumption priority is a resource-oriented evaluation criterion, which can give priority to combinations that occupy less global resource pool and are more conducive to subsequent continuous production.
[0043] For example, under the same constraint conditions, combinations with fewer units or lighter total weight are consumed first, thereby reserving more and heavier units for subsequent batch recombination and reducing the overall surplus rate.
[0044] Mutual exclusion selection constraints are a safety guarantee for multi-channel concurrent allocation. They ensure that the same unit to be weighted can only be allocated to one target allocation container within the same scheduling cycle, preventing the duplicate occupation of physical resources.
[0045] In some implementations, the system maintains an allocated index set and checks whether the sorted candidate combinations intersect with this set. Only when there is no intersection is the combination selected and the set updated, until the number of selected combinations reaches the upper limit of the current free container.
[0046] It should be noted that the priority-based mutual exclusion selection mechanism described above enables multiple idle containers to obtain the optimal combination without conflict from the same global candidate pool, thus breaking the serial bottleneck of traditional single-channel sequential allocation and improving the overall throughput efficiency and resource utilization of the sorting line.
[0047] Step S400: In response to the fact that the set of units to be counterweighted cannot generate a valid candidate combination that satisfies multiple constraints, counterweight guidance information for supplementary units is generated.
[0048] The counterweight guidance information is a supplementary unit attribute suggestion derived by the system in reverse, based on the gap between the existing unit state and the constraint target, when it detects that the current resources are insufficient to form a self-contained group. It is not a simple numerical display, but rather interpretable information that establishes a mapping relationship between the suggested attribute range and the existing physical units.
[0049] Specifically, when a traversal search fails to find a valid combination, the system analyzes the characteristics of the subset of currently unassigned units, calculates the range of weights or other attributes required to make a new unit a group, and associates this range with a specific subset of existing units, informing the operator which existing units the unit with this weight will be grouped with.
[0050] In some implementations, this guidance information can be displayed through a human-computer interaction interface.
[0051] In other implementations, it can also be converted into control commands for automatic feeding equipment.
[0052] It should be noted that this step can transform the originally passive waiting process into a proactive and precise intervention, solving the problem of operators blindly feeding materials in the existing technology, which leads to long grouping times. At the same time, through explainability, it also enhances the trust in human-machine collaboration.
[0053] Based on the above technical solutions, this embodiment constructs a complete dynamic sorting and scheduling method by uniformly acquiring multiple constraints, performing global traversal pruning based on boundary evaluation, assigning mutually exclusive resources based on priority, and providing weight guidance based on reverse deduction. This method defines an efficient, robust scheduling logic with human-machine collaboration capabilities from both functional and effectiveness perspectives, overcoming the inherent defects of local greedy strategies.
[0054] Example 2 like Figure 2 and 10As shown, this embodiment, based on Embodiment 1, further provides a specific implementation method for traversing and pruning the set of counterweight units based on multiple constraints. This embodiment concretizes the abstract search strategy into an efficient algorithmic closed loop based on data ordering and cumulative statistics, aiming to resolve the contradiction between search space explosion and real-time requirements in industrial settings in combinatorial optimization problems.
[0055] Step S210: Arrange each counterweight unit in the set of counterweight units in non-descending order by weight to construct a cumulative weight array.
[0056] Non-descending order arrangement refers to the process of reorganizing the currently unassigned counterweight units according to their weight attributes from smallest to largest.
[0057] The cumulative weight array is a space-for-time data structure used to store the prefix sum of a sorted sequence. This allows the total weight of any consecutive subsequence to be obtained through two table lookups and one subtraction operation, thereby reducing the time complexity of interval summation from linear to constant.
[0058] Specifically, let the sorted weight sequence of the counterweight units be as follows: Figure 2 and 10 As shown, this embodiment, based on Embodiment 1, further provides a specific implementation method for traversing and pruning the set of counterweight units based on multiple constraints. This embodiment concretizes the abstract search strategy into an efficient algorithmic closed loop based on data ordering and cumulative statistics, aiming to resolve the contradiction between search space explosion and real-time requirements in industrial settings in combinatorial optimization problems.
[0059] Step S210: Arrange each counterweight unit in the set of counterweight units in non-descending order by weight to construct a cumulative weight array.
[0060] Non-descending order arrangement refers to the process of reorganizing the currently unassigned counterweight units according to their weight attributes from smallest to largest.
[0061] The cumulative weight array is a space-for-time data structure used to store the prefix sum of a sorted sequence. This allows the total weight of any consecutive subsequence to be obtained through two table lookups and one subtraction operation, thereby reducing the time complexity of interval summation from linear to constant.
[0062] Specifically, let the sorted weight sequence of the counterweight units be as follows: ,in, Let be the total number of currently unallocated units, and satisfy . .
[0063] The system constructs a cumulative weight array , of which element Indicates the preceding The sum of the weights of the units, i.e. and agreed .
[0064] Using this array, if you need to retrieve the index To index The weights of the continuous units can be calculated directly. .
[0065] It should be noted that the sorting operation described above can give the weight distribution monotonicity, so that the head of the sequence always represents the currently available "lightest" resource and the tail represents the "heaviest" resource. This explicit manifestation of the extreme value characteristic is the basis for subsequent boundary evaluation. The cumulative weight array transforms this monotonicity into computational power that can be called up immediately. The two work together to form the data foundation for efficient pruning.
[0066] Step S220: Based on the constraint of the number of combined units, perform a depth-first traversal starting from an empty combination. During the traversal, use the cumulative weight array to evaluate the upper and lower bounds, and use it to prune search branches that do not meet the total weight constraint of the combination.
[0067] Depth-first traversal is a systematic search strategy for exploring the combinatorial solution space. It selects units layer by layer through recursion or a stack structure until the target number of combinatorial units is met or the termination condition is triggered.
[0068] The upper and lower bound evaluation is a filtering mechanism that predicts the feasibility of the current path based on the relative position of the current search state and the constraint boundary. Specifically, at any node during the traversal process, the system maintains a set of key state variables: the number of units to be counterweighted included in the current combination is denoted as the first quantity. The total weight of the current combination is denoted as the first weight value. The starting position of the next iteration in the set of units to be counterweighted is denoted as the first index. The current combination is still short of the target number of combined elements required by the constraint on the number of combined elements by a second quantity. One unit to be counterweighted, second quantity Equals the target number of combined units minus the first quantity Based on this, the system performs a dual pruning decision: First, pruning at the upper bound (inevitably triggers overweight detection). If the first weight value... With from the first index The second smallest quantity of lifting capacity The sum of the weights of the individual counterweight units exceeds the upper limit of the total combined weight constraint. If the current branch is overweight, it is determined that the current branch is overweight and the branch is immediately pruned.
[0069] Since the sequence is already sorted in non-descending order, from the index Rising The lightest combination of the remaining selectable units is the sum of its weights, which can be calculated using the cumulative weight array. Therefore, the mathematical criterion for upper bound pruning is: .
[0070] If this formula holds true, it means that even if all the lightest units are selected in the future, the weight limit will still be exceeded. Therefore, the current path has no chance of generating a valid solution, so there is no need to continue.
[0071] Secondly, pruning at the lower bound (inevitably biased towards lighter weights). If the first weight value... The second largest number with the largest global weight The sum of the weights of the individual counterweight units is less than the lower limit of the total combined weight constraint. If the current branch is too light, it is determined that the current branch is too light, and the branch is immediately pruned. The globally heaviest branch... The units are located at the end of the sorted sequence, and their sum is . Therefore, the mathematical criterion for lower bound pruning is: .
[0072] If this formula holds true, it means that even if all the heaviest units are selected subsequently, the weight limit cannot be reached, and the current path is also not feasible.
[0073] It should be noted that this boundary evaluation mechanism based on cumulative arrays eliminates invalid combinations that would otherwise only be found at leaf nodes, thus avoiding a large number of meaningless recursive calls. Simultaneously, because sorting ensures the representativeness of extreme values and the cumulative array guarantees the instantaneous nature of computation, the overhead of pruning judgment itself is far lower than the saved search overhead. Therefore, without overlooking any potential optimal solutions, the exponential number of combinations enumerated is compressed to a level acceptable to industrial control equipment.
[0074] Step S230: When the number of selected counterweight units meets the constraint on the number of combined units and the total weight falls within the range of the total weight constraint of the combination, the current combination is recorded as a valid candidate combination in the candidate combination set.
[0075] Among them, a valid candidate combination refers to a combination that has passed the complete search path and is ultimately verified, and is the direct input source for subsequent mutually exclusive selection and allocation.
[0076] Specifically, when the depth-first traversal successfully selects the target number of units (i.e. If the stalks are not pruned midway, the system will perform a final, precise check on the total weight of the combination. Only if the total weight strictly falls within... Only when the interval is within the specified range will the combination and its contained unit index information be registered in the candidate combination set.
[0077] It should be noted that although the aforementioned pruning process has eliminated most obvious out-of-bounds situations, since pruning is based on a conservative judgment of extreme value estimation, the combinations reaching the leaf nodes may still have slight deviations due to fluctuations in intermediate values. Therefore, this step acts as a safety valve to ensure the absolute compliance of the output results.
[0078] It should be noted that after processing steps S210 to S230, the system can quickly filter out all feasible solutions that satisfy multiple constraints from a massive number of possible combinations. This process relies entirely on the ordered structure of the data and mathematical boundary derivation, rather than on specific hardware acceleration or heuristic guessing, which can guarantee the determinism and reproducibility of the algorithm under different working conditions to a certain extent, and provide a sufficient and high-quality candidate pool for subsequent multi-channel concurrent allocation.
[0079] Based on the above technical solution, this embodiment transforms the unordered set of units to be counterweighted into an ordered sequence and a cumulative statistical structure. Combined with bidirectional boundary pruning in depth-first traversal, it leverages the mathematical properties of monotonicity and prefix sums to reduce the computational complexity of the combinatorial optimization problem from a theoretically exponential level to a controllable level in engineering, enabling implementation on industrial tablets with limited computing power. This not only solves the dead combinatorial problem caused by traditional methods resorting to local greedy strategies due to excessive computation time, but also provides a sufficiently rich candidate basis for mutually exclusive allocation based on consumption priority in subsequent embodiments.
[0080] Example 3 like Figure 3-5 As shown in Figure 10, this embodiment, based on Embodiment 1, further provides a specific implementation method for sorting the candidate combination set based on the combination consumption priority, selecting conflict-free candidate combinations from the candidate combination set through mutual exclusion selection constraints, and allocating them to an idle target allocation container. It also covers a degradation processing strategy when there are insufficient candidate combinations. This embodiment aims to solve the technical problem of maximizing resource utilization and ensuring continuous operation of the production line in multi-channel concurrent scenarios.
[0081] Step S310: Sort the candidate combinations in the candidate combination set in ascending order by the number of combination units and the total weight of the combination.
[0082] The dual sorting rules of ascending order of the number of combined units and ascending order of total combined weight are a specific quantitative expression of the priority of combined consumption at the engineering level.
[0083] Specifically, the system first sorts the combinations by the number of counterweight units they contain, from smallest to largest. If the number of units is the same, it then sorts them by the total weight of the combinations, from smallest to largest. At this point, this sorting strategy is not a simple numerical arrangement, but includes a protection mechanism for the potential of subsequent combinations: combinations with fewer units or lighter total weight are consumed first, meaning that "large-scale" combinations containing more or heavier units are kept in the candidate pool.
[0084] In actual production, heavier or more numerous units are often more difficult to match. If they are consumed first, it is easy for a large number of light and small units to form dead combinations because they cannot meet the weight limit or quantity requirements. Conversely, retaining these difficult-to-match resources as the skeleton for subsequent combinations can improve the recombination success rate of the remaining units.
[0085] It should be noted that this dual sorting rule can avoid the deadlock phenomenon common in local greedy algorithms, where "large fruits are used up first and small fruits cannot be collected," by sacrificing the local optimum of a single allocation (such as not prioritizing the heaviest one) in exchange for minimizing the global surplus rate and maximizing the long-term throughput.
[0086] Step S320: Initialize the allocated index set to empty, and iterate through the sorted candidate combinations in turn; if the cell index contained in the current candidate combination has no intersection with the allocated index set, add the cell index contained in the selected current candidate combination to the allocated index set and allocate it to the idle target allocation container; when the number of selected candidate combinations reaches the number of currently idle target allocation containers, stop the selection.
[0087] The allocated index set is a dynamic data structure used in memory to record the status of resources that have been occupied in the current scheduling cycle in real time. It ensures the uniqueness of physical resources and the determinism of allocation results.
[0088] Specifically, at the beginning of each round of allocation, the system initializes the set to empty, and then checks the candidate combinations one by one in strict accordance with the priority order determined in step S310.
[0089] For each candidate combination, the system calculates the intersection of its set of cell indices to be weighted and the set of allocated indices. If the intersection is empty, it means that none of the cells involved in the combination are occupied by other combinations in the current period, satisfying the mutual exclusion condition. The system then marks the combination as selected, merges all its cell indices into the set of allocated indices, and binds the combination to an idle target allocation container. If the intersection is not empty, it means that the combination has a resource conflict with the selected combination, and it is skipped directly.
[0090] The above traversal process continues until the number of selected combinations equals the number of physically available free target allocation containers.
[0091] It should be noted that this mutual exclusion detection mechanism based on index sets can transform the complex multi-channel concurrent allocation problem into a linear set operation problem. This not only ensures that the same unit to be counterweighted will never be repeatedly allocated to two different containers, avoiding collisions and chaos at the physical execution level, but also ensures that the system can always output deterministic allocation results under the same input conditions because the traversal order strictly follows the preset priority sorting. This gives it the debuggability and fault traceability of an industrial control system.
[0092] Step S330: When the mutual exclusion selection ends and the number of selected candidate combinations is less than the number of currently idle target allocation containers, the selected candidate combinations are allocated to the corresponding idle target allocation containers, and the remaining idle target allocation containers are kept in a waiting state; the unallocated weight units are kept in the unallocated weight unit set, and the steps of traversal search, boundary pruning and mutual exclusion selection are re-executed when the next triggering event occurs, until all idle target allocation containers are allocated or the candidate combination set is exhausted.
[0093] Among them, keeping the remaining idle target allocation containers in a waiting state is a degradation processing strategy that prioritizes the continuity of production cycle rather than the completeness of allocation when the ideal solution is missing.
[0094] Specifically, after the complete mutual exclusion selection process, if the number of valid candidate combinations generated is insufficient to fill all the free containers (for example, there are only 4 free containers but only 2 valid combinations are found), the system will not report an error, stop the machine, or forcibly split the combination. Instead, it will immediately send the 2 selected combinations to the corresponding containers to perform the bin packing action, while keeping the remaining 2 containers in an idle waiting state.
[0095] Meanwhile, the units that failed to participate in the grouping process will not be discarded or marked as abnormal, but will remain in the unassigned set, waiting for the next triggering event (such as a new unit being enqueued or a container being released). At that time, the system will re-initiate a global search and assignment based on the updated dataset.
[0096] It should be noted that this step abandons the rigid logic of traditional algorithms, effectively avoiding production line stoppages caused by the pursuit of perfect matching under unstable operating conditions such as fluctuations in material supply or changes in specifications. By decoupling partial allocation from asynchronous recalculation, the system ensures both the immediate conversion of existing resources and the preservation of a complete search space for subsequent opportunities, thus achieving the optimal balance between throughput and stability in a dynamically changing industrial environment.
[0097] Based on the above technical solutions, this embodiment establishes a resource consumption order that is conducive to reducing the surplus rate through a dual sorting rule, ensures data consistency and determinism in multi-channel concurrent allocation through an index mutual exclusion mechanism, and solves the production line continuity problem when there are insufficient candidates through a partial allocation degradation strategy. The synergistic effect of these three elements enables the system to not only efficiently find the current optimal solution when facing complex and ever-changing actual working conditions, but also maintain a stable production rhythm under suboptimal conditions. This improves the robustness and overall throughput efficiency of the sorting and scheduling system, overcoming the defects of existing technologies such as frequent dead combinations and wasted capacity caused by local greedy or rigid allocation. Example
[0098] like Figure 6-7 As shown in Figure 10, this embodiment, based on Embodiment 1, further provides a specific implementation method for generating counterweight guidance information for supplementary units when the set of counterweight units to be counterweighted cannot generate an effective candidate combination that satisfies multiple constraints. This embodiment aims to solve the technical problem in the prior art where, when insufficient materials prevent automatic grouping, operators lack clear material feeding instructions and can only wait blindly. By constructing an interpretable reverse derivation mechanism, passive waiting is transformed into proactive and precise intervention. Step S410: Based on the constraint of the number of combined units, extract the existing unit subset containing the target number of units to be counterweighted from the units to be counterweighted sorted by weight through a sliding window. The target number is one less than the target number of combined units in the constraint of the number of combined units, and calculate the total weight of the existing unit subset.
[0099] The sliding window is a traversal mechanism that performs continuous subset sampling on an ordered data sequence. It also systematically lists all existing basic forms of units that can participate in grouping without omitting any potential combination possibilities.
[0100] Specifically, since the generation of counterweight guidance information is based on the premise that the current unit cannot form a group, the system needs to predict whether a new unit can form a group if a new unit is added.
[0101] Based on the constraint of the number of combined units, assuming the target number of combined units is , then the target number of existing unit subsets is . The system first sets a window of width on the sequence of units to be counterweighted that has been arranged in non-descending order in Example 2. Starting from the beginning of the sequence, it moves backward by one unit step each time, and successively extracts units as an existing unit subset, and calculates the total weight of all units in the subset in real time.
[0102] For example, if the target number of combined units is 6, then the window width is 5, and the system will extract the 1st to 5th, 2nd to 6th, and 3rd to 7th units in sequence as candidate basic subsets.
[0103] It should be noted that by using a sliding window instead of random sampling or full permutation enumeration, we can ensure complete coverage of all adjacent compact combinations in the ordered sequence, avoid suggestion blind spots caused by discrete sampling, and keep the computational complexity within a range that is linearly related to the number of units, thus ensuring the real-time generation of guidance information. At the same time, selecting a unit as a benchmark precisely corresponds to the business logic of forming a group by adding a unit, providing an accurate mathematical premise for subsequent interval calculations.
[0104] Based on the combined total weight constraint and the element weight constraint, the effective weight range is calculated. The effective weight range is the range of weight values that satisfy multiple constraint conditions after the supplementary element is added to the existing element subset.
[0105] The effective weight range refers to the legal weight domain that a newly added unit must possess under the dual constraints of both macroscopic constraints at the combination level and microscopic constraints at the unit level. It is mainly the intersection of projections of the multidimensional constraint space onto the one-dimensional weight axis.
[0106] Specifically, for each existing cell subset extracted in step S410 and its total weight The system performs the following intersection operation to determine the effective weight range. : First, to meet the total weight constraint of the combination The weight of the supplementary unit The total weight must meet the standard, that is ; Secondly, to meet the unit weight constraint The weight of the supplementary unit itself must also meet the requirements, that is... .
[0107] Therefore, the lower bound of the effective weight range Take the maximum of the two lower bounds, and the upper bound. The minimum of the two upper limits is calculated using the following formula: .
[0108] Only if the calculated lower bound is not greater than the upper bound (i.e. Only when this condition is met is the effective weight range determined. For effective; conversely, if If the weight value is zero, it means that for the current subset of units, there is no weight value that can simultaneously satisfy all constraints. This subset is marked as irreparable and discarded.
[0109] It should be noted that the above-mentioned calculation method based on the intersection of dual constraints can solve the problem of invalid suggestions that may occur in traditional solutions, where the suggested weight can meet the total weight but the individual fruit is overweight or the individual fruit is qualified but the total weight is still insufficient. This ensures that every piece of counterweight guidance information output is executable in engineering. At the same time, by filtering out unsolvable subsets through explicit validity judgment, it avoids showing users false data that exists in theory but cannot be met in practice, thus improving the rigor and credibility of human-computer interaction.
[0110] Step S430: Overlap and merge the effective weight intervals corresponding to the existing unit subsets, and retain the corresponding representative unit subset for each merged effective weight interval to establish the mapping relationship between the effective weight interval and the existing physical units.
[0111] The representative unit subset refers to the typical samples selected from all existing unit subsets associated with a certain merged suggestion weight range, which are used to visualize the grouped expectations to the user, thereby constructing a traceable mapping relationship between abstract numerical suggestions and specific physical entities.
[0112] Specifically, since different existing subsets of units may calculate effective weight ranges that overlap with each other (for example, the suggested range for subset A is 2000g-2500g, and the suggested range for subset B is 2200g-2700g), the system first sorts all effective ranges by their lower bounds from smallest to largest, and then scans and merges all the ranges that have intersections to form a set of final suggested ranges that do not overlap (such as 2000g-2700g in the example above).
[0113] During the merging process, the system does not simply discard the source information of the merged intervals. Instead, it retains a limited number (e.g., a maximum of 4) of representative unit subsets for each final interval. These representative subsets record a complete detail of which existing units a supplementary unit will form a group with if its weight falls into that interval.
[0114] In practical applications, when an operator sees the prompt "Recommended to add 2300g", they can view the list of representative subsets corresponding to the suggestion through the interactive interface, thus knowing exactly which specific fruits on the carousel will be paired with this 2300g fruit for packing.
[0115] It should be noted that by retaining a representative subset of units, this step not only informs the system of "what to do" (how much material to load) but also explains "why" (who it will be grouped with), enhancing the operator's trust in the automation system and their willingness to cooperate. This, in turn, shortens the implicit waiting time caused by hesitation in confirmation and improves the overall cycle stability of the production line.
[0116] Based on the above technical solution, this embodiment achieves a full-coverage scan of the existing unit grouping potential through a sliding window mechanism. Through dual-constraint intersection operations, the engineering validity of the suggested weight is ensured. Furthermore, by retaining a representative subset of units, an interpretable mapping between suggested information and physical entities is established. The synergistic effect of these three elements enables the system to automatically generate accurate, reliable, and easy-to-understand counterweight guidance information when faced with the predicament of material shortages preventing automatic grouping. This transforms the originally passive downtime into active human-machine collaborative operation, effectively shortening grouping waiting time and improving the adaptability and production efficiency of the sorting and scheduling system under fluctuating operating conditions.
[0117] Example 5 like Figure 8 , 10 As shown, this embodiment, based on Embodiment 1, further provides a data preprocessing and recalculation triggering mechanism to ensure the stable operation of the dynamic sorting and scheduling algorithm. This embodiment combines input data quality control with real-time synchronization of algorithm status to construct an environment guarantee layer for algorithm operation, aiming to solve the problems of invalid calculation and missed allocation caused by data corruption or state lag in industrial settings.
[0118] Step S510, the process of obtaining the set of unassigned counterweight units, includes: adding the counterweight units that have completed weight acquisition to the first-in-first-out queue in the order of arrival; when enqueuing, judging the qualification of the counterweight units according to the unit weight constraints; adding qualified counterweight units that meet the unit weight constraints to the set of unassigned counterweight units for subsequent combination optimization; marking unqualified counterweight units that do not meet the unit weight constraints and excluding them from the combination search range.
[0119] The first-in-first-out queue is a data buffer structure that strictly follows the time sequence. It is used to maintain the physical arrival order of the units to be counterweighted, ensuring that the scheduling logic is consistent with the actual production line cycle time.
[0120] Specifically, after the weighing device completes the weight acquisition of a counterweight unit, the system does not directly put it into the combination search, but first places it at the end of the queue.
[0121] During the queuing process, the system immediately performs a qualification check on the unit based on the preset unit weight constraints (i.e., the upper and lower limits of the weight of a single fruit). Only units that pass the check and whose weight falls within the legal range will be formally included in the set of unassigned units to be weighted, becoming valid input for subsequent traversal search and boundary pruning.
[0122] Units that fail the verification are marked as defective and completely removed from the logical space of the combined search.
[0123] In another implementation, defective products will also trigger a physical diversion command to direct them to the abnormal recycling channel.
[0124] It should be noted that this pre-filtering mechanism can move the data cleaning work from the time-consuming combinatorial optimization stage to the low-overhead queuing stage, effectively preventing dirty data such as overweight, underweight, or abnormal zero values from polluting the candidate pool, avoiding the waste of computing power in the invalid solution space, and ensuring that the dataset participating in global optimization is always pure and reliable, thereby effectively improving the overall robustness and computational efficiency of the system.
[0125] Step S520: In response to at least one of the following: a new qualified counterweight unit is detected being enqueued, multiple constraints are changed, the target allocation container is released, the temporary weight limit offset is adjusted, or the counterweight unit is abnormally recycled, the traversal search and boundary pruning and mutual exclusion selection steps are re-executed.
[0126] Among them, the steps of re-executing traversal search, boundary pruning, and mutual exclusion selection refer to a new round of global combinatorial optimization calculation that is automatically initiated by the system when it senses a critical change in the external environment or internal state. It is an event-driven real-time response mechanism.
[0127] Specifically, this application defines five categories of critical events that must trigger a recalculation: First, the addition of new qualified units to be counterweighted means that the solution space of the combinatorial search has been expanded, and the newly added units may form effective combinations with existing units that did not exist before. Secondly, changes in multiple constraints, such as switching product specification templates, mean that the mathematical boundary of the entire feasible domain is reconstructed, all the original candidate results become invalid, and optimization must be re-found based on the new constraints. Third, the release of the target allocation container means that the system's concurrent processing capacity or resource quota increases. The search process, which was originally truncated due to the container being full, now has the opportunity to select more combinations or to transform suboptimal solutions that were originally in a waiting state into executable solutions. Fourth, the temporary weight limit offset is adjusted. This is usually an operator intervention during operation to deal with material fluctuations. It is equivalent to dynamically relaxing the upper limit of the total weight of the combination, which may make branches that were originally pruned due to slight overweight feasible again. Fifth, if the counterweight unit is abnormally recycled, it means that the solution space has undergone an unexpected shrinkage or correction. If it is not recalculated in time, the system may try to allocate physical units that no longer exist, leading to errors at the execution level.
[0128] It should be noted that this refined event-triggered strategy ensures that the algorithm always runs based on the latest and most accurate on-site conditions. This avoids the waste of computing power caused by timed polling when there are no changes, and also eliminates the risk of missed or incorrect allocation due to untimely state updates. This enables the dynamic sorting and scheduling system to maintain millisecond-level response speed and decision accuracy in the high-frequency fluctuating industrial environment.
[0129] Based on the above technical solution, this embodiment implements strict pre-filtering for data quality at the data entry point and establishes an event-driven recalculation mechanism covering five key operating conditions during operation. This constructs a complete data quality and state synchronization assurance system, preventing dirty data from interfering with the core algorithm at the source and reducing invalid computational load. Simultaneously, by accurately capturing the moments of spatial expansion, contraction, and boundary reconstruction, it ensures that every combinatorial optimization calculation is based on the latest physical reality. This maximizes the timeliness and resource utilization of dynamic scheduling while ensuring system robustness, overcoming the production cycle disruption problems caused by data pollution or state lag in traditional solutions.
[0130] Example 6 like Figure 9 As shown, this embodiment provides a dynamic sorting and scheduling system for fruit weighing on a production line. This system is applied to the dynamic sorting and scheduling method described in any of the preceding embodiments. The system mainly includes a communication unit and a processing unit, which can interact with each other through inter-process communication, shared memory, or internal API calls, and decouple external interaction from core computing. This allows the system to flexibly adapt to different hardware platforms and deployment environments, while ensuring the independence and portability of the core algorithm logic.
[0131] Step S610: The communication unit acquires the set of unassigned counterweight units and preset multiple constraints, and outputs the target allocation container information and counterweight guidance information after allocation.
[0132] The communication unit is a unified interface layer for data exchange between the system and the external environment. It is responsible for shielding the heterogeneity of the underlying physical devices and converting external signals into standardized internal data structures.
[0133] Specifically, on the input side, the communication unit collects the weight and identification information of the unit to be counterweighted in real time from the weighing sensor, identification device or host computer management system by listening to the message queue, polling the database or receiving network requests, and loads configuration parameters such as the number of combined units, the total weight of the combination and the unit weight.
[0134] On the output side, the communication unit encapsulates the allocation results generated by the processing unit (i.e., which unit enters which target allocation container) and the weight guidance information into standard messages, and pushes them to the human-machine interface for display or sends them to the downstream scheduling controller.
[0135] It should be noted that the communication unit only undertakes the functions of data transfer and protocol conversion, and does not contain any combination optimization logic. This single responsibility design ensures that when the weighing equipment is replaced or the communication protocol is adjusted on site, only the adaptation code of the communication unit needs to be modified, without touching the core algorithm, which reduces the maintenance cost and upgrade risk of the system.
[0136] Step S620: Based on multiple constraints, the processing unit performs traversal search and boundary pruning on the set of counterweight units to be counterweighted, generating a set of candidate combinations that satisfy the multiple constraints; sorts the set of candidate combinations based on the combination consumption priority, and selects conflict-free candidate combinations from the set of candidate combinations through mutual exclusion selection constraints, and assigns them to idle target allocation containers; in response to the set of counterweight units to be counterweighted failing to generate effective candidate combinations that satisfy the multiple constraints, generates counterweight guidance information for supplementary units.
[0137] The processing unit integrates all the computational logic described in the aforementioned embodiments 1 to 5, including global search, mutual exclusion allocation, and guidance information generation.
[0138] Specifically, after receiving the standardized dataset from the communication unit, the processing unit first constructs an ordered sequence and cumulative statistical structure in memory, and performs efficient traversal search and boundary pruning to produce candidate combinations; then, according to the preset priority strategy, it completes mutual exclusion selection and container binding; finally, when resources are insufficient, it reverse-derives the attribute range of the supplementary unit.
[0139] Throughout the process, the processing unit runs entirely in a pure software environment, without directly reading or writing any physical I / O ports or control registers; its output consists only of abstract decision data.
[0140] It should be noted that encapsulating the algorithm logic within an independent processing unit not only allows this unit to be reused by other systems as an independent SDK or microservice, but also completely eliminates the dependence on specific hardware actuators (such as cylinders, push rods, and PLCs).
[0141] In step S630, the communication unit and the processing unit work together through a predefined internal data interface to form a complete data closed loop.
[0142] The internal data interface refers to the standardized data transmission channel connecting the communication unit and the processing unit, which defines strict format specifications for input data packets and output result packets.
[0143] Specifically, when the communication unit senses the arrival of new data, it triggers the processing unit's computation task through this interface, and after the processing unit completes the computation, it also returns a structured result object through this interface.
[0144] This interface-based collaboration model allows two units to be deployed in different threads of the same process, or distributed across different containers or even different physical servers, as long as they adhere to the same interface contract to collaborate seamlessly.
[0145] It should be noted that this loosely coupled system architecture not only supports the performance requirements of millisecond-level real-time recalculation in the aforementioned method embodiments (through the elastic allocation of computing resources), but also establishes the technical paradigm of algorithm as a service, so that the scope of protection of this application is no longer limited to the specific hardware form, and can be used whether deployed on edge computing gateways, industrial tablets or cloud servers.
[0146] Based on the above technical solution, this embodiment constructs a purely software-level dynamic sorting and scheduling system architecture by decoupling the functions of the communication unit and the processing unit and coordinating through standardized interfaces. This architecture, on the one hand, shields the complexity of the physical world through the communication unit, ensuring the purity and stability of the core algorithm's input and output; on the other hand, the independent encapsulation of the processing unit achieves complete separation between the combinatorial optimization algorithm and the hardware execution mechanism, avoiding conflicts with the parent patent while endowing the algorithm with extremely high portability and reusability.
[0147] Example 7: This embodiment, based on the aforementioned embodiments 1 to 6, further provides a specific application scenario verification for a fruit weighing production line. This embodiment aims to concretize the abstract combinatorial optimization logic through real industrial production data and a complete algorithm execution trajectory, empirically verifying the effectiveness and synergy of the aforementioned traversal search, boundary pruning, mutual exclusion selection, and counterweight guidance information generation mechanisms under actual working conditions.
[0148] Step S710: Obtain the set of unassigned counterweight units and preset multiple constraints, and arrange each counterweight unit in the set of counterweight units in non-descending order of weight to construct a cumulative weight array.
[0149] In this application scenario, the multiple constraints are specifically instantiated as a production template configuration named "A 6-36", which defines the rigid physical boundaries of the current batch of fruit sorting.
[0150] Specifically, the total combined weight constraint is set to the target net weight range. The number of combined units is fixed at 6, and the unit weight constraint limits the net weight of a single fruit to a range of [value missing]. Assume that during the current scheduling cycle, the weighing equipment sequentially collects the net weight data of 8 units to be counterweighted, namely: T001 (2700g), T002 (2650g), T003 (2800g), T004 (2450g), T005 (2550g), T006 (2600g), T007 (2400g), and T008 (2800g).
[0151] The system first rearranges these 8 units into a sequence in non-descending order by weight. The corresponding original identifier mapping is Subsequently, a cumulative weight array is constructed based on this ordered sequence. ,in , , ,..., .
[0152] It should be noted that this preprocessing step can transform the originally discrete weighing data into structured data with monotonicity and queryability, so that the subsequent weight summation operation of any continuous sub-interval can be completed in constant time, laying the necessary data foundation for millisecond-level real-time search.
[0153] Step S720: Based on multiple constraints, perform traversal search and boundary pruning on the set of counterweight units to be traversed. During the traversal, the cumulative weight array is used to evaluate the upper and lower bounds, which are used to prune search branches that do not meet the combined total weight constraint.
[0154] In this scenario, traversal search and boundary pruning are manifested as depth-first exploration and real-time feasibility determination of the 6-unit combined space.
[0155] Specifically, when the search algorithm attempts to construct a combination containing the first 5 sorted units (i.e., T007, T004, T005, T006, T002) and the 8th unit (T008), the system first calculates the current state of this partial solution: the number of selected units. Current total weight .
[0156] A more typical pruning scenario occurs during the search process, such as when the system evaluates combinations. At that time, its total weight is calculated as follows: .
[0157] At this point, the system performs a lower bound pruning check: because Even if the combination has selected all 6 units, its total weight is still below the target lower limit. Since the sequence is already sorted, replacing any of the units with a lighter one will only make the total weight smaller. Therefore, it is determined that this branch must be too light, and further exploration of this path and all its potential variants is immediately terminated.
[0158] Similarly, if the sum of the current cumulative weight of a branch and the remaining lightest unit exceeds 16200g, then upper bound pruning is triggered.
[0159] It should be noted that this pruning mechanism based on real values can successfully avoid the system's wasted computing power on invalid solution spaces.
[0160] Step S730: Sort the candidate combination set based on the combination consumption priority, and select conflict-free candidate combinations from the candidate combination set through mutual exclusion selection constraints, and allocate them to the idle target allocation container.
[0161] In this scenario, the combination consumption priority and mutual exclusion selection constraint determine which combination will ultimately be issued and executed.
[0162] Specifically, after the search in step S720, the system generates valid candidate combinations. Its total weight is Strictly implement Interval.
[0163] Assuming there is another valid candidate combination (if any), the system will strictly sort them according to the rules of ascending order of unit count and then ascending order of total weight. Since only one valid 6-unit combination was found in this example, that combination is selected directly. The system then initializes the allocated index set. The index is added to the collection, and the combination is bound to the currently free target allocation container #7.
[0164] At this point, only [number] remain in the unallocated set. Two units. Since the number of remaining units (2) is less than the target combination number (6), the system cannot generate any new valid candidate combinations. Therefore, container 7 receives the allocation instruction and begins execution, while the remaining two units remain in the unallocated queue awaiting the next round of scheduling.
[0165] Step S740: In response to the fact that the set of units to be counterweighted cannot generate a valid candidate combination that satisfies multiple constraints, counterweight guidance information for supplementary units is generated.
[0166] In this scenario, the generation of counterweight guidance information is manifested as the reverse derivation of the grouping potential of the remaining units T004 and T007.
[0167] Specifically, since it cannot currently form its own group, the system activates a sliding window mechanism to retrieve... The existing units are used as a baseline subset. However, since there are only 2 units remaining, less than 5, the system automatically downgrades the evaluation or prompts that more units need to be accumulated.
[0168] To demonstrate the complete logic, assume there are currently 5 remaining units (e.g., T009, T010, and T011 have been added), and their total weight... The system calculates the effective weight range: lower bound. Upper Boundary .because Generate valid suggestion range And associate these 5 units as a representative subset.
[0169] In the actual data of this embodiment, the total weight of the remaining 2 units Calculated And associate these 5 units as a representative subset.
[0170] In the actual data of this embodiment, the total weight of the remaining 2 units Calculated , .
[0171] because If the intersection is empty, the system determines that the remaining units cannot be grouped by adding individual units. Therefore, it outputs a general prompt to continue feeding on the human-machine interface instead of giving invalid numerical suggestions.
[0172] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A dynamic sorting and scheduling method for fruit weighing on a production line, characterized in that, include: Obtain the set of unassigned counterweight units and preset multiple constraints, including constraints on the number of combined units, total combined weight, and unit weight. Based on the multiple constraints, the set of units to be counterweighted is traversed and pruned to generate a set of candidate combinations that satisfy the multiple constraints. The candidate combination set is sorted based on the combination consumption priority, and a conflict-free candidate combination is selected from the candidate combination set through mutual exclusion selection constraints and allocated to an idle target allocation container. In response to the fact that the set of units to be counterweighted cannot generate a valid candidate combination that satisfies the multiple constraints, counterweight guidance information for supplementary units is generated.
2. The method for dynamic sorting and scheduling of fruit weighing on a production line according to claim 1, characterized in that, The process of traversing and performing boundary pruning on the set of units to be counterweighted based on the multiple constraints to generate a set of candidate combinations that satisfy the multiple constraints includes: Arrange the units to be counterweighted in the set of units to be counterweighted in non-descending order of weight to construct a cumulative weight array; Based on the constraint of the number of combined units, a depth-first traversal is performed starting from an empty combination. During the traversal, the cumulative weight array is used to evaluate the upper and lower bounds, which is used to prune search branches that do not meet the constraint of the total weight of the combination. When the number of selected counterweight units satisfies the constraint on the number of combined units, and the total weight falls within the range of the constraint on the total weight of the combination, the current combination is recorded as a valid candidate combination in the candidate combination set.
3. The method for dynamic sorting and scheduling of fruit weighing on a production line according to claim 2, characterized in that, The process of evaluating the upper and lower bounds using the accumulated weight array during traversal to prune search branches that do not satisfy the combined total weight constraint includes: During the traversal, assume that the current combination already contains a first number of counterweight units, the total weight of the current combination is a first weight value, and the starting position of the next traversal in the set of counterweight units is a first index; The current combination is still a second number of counterweight units short of the target number of combination units required by the constraint on the number of combination units. The second number is equal to the target number of combination units minus the first number. In this state: if the sum of the first weight value and the weight of the second number of counterweight units with the smallest weight starting from the first index is greater than the upper limit of the total weight constraint of the combination, then it is determined that the current branch must be overweight and the current branch is cut off. If the sum of the first weight value and the weight of the second number of counterweight units with the largest global weight is less than the lower limit of the total combined weight constraint, then the current branch is determined to be too light, and the current branch is cut off.
4. The method for dynamic sorting and scheduling of fruit weighing on a production line according to claim 1, characterized in that, The process of sorting the candidate combination set based on the combination consumption priority, selecting conflict-free candidate combinations from the candidate combination set through mutual exclusion selection constraints, and allocating them to idle target allocation containers includes: Sort the candidate combinations in the candidate combination set in ascending order by the number of combination units and the total weight of the combination; Initialize the allocated index set to empty, and iterate through the sorted candidate combinations in turn; If the cell indexes contained in the current candidate combination have no intersection with the allocated index set, the cell indexes contained in the selected current candidate combination are added to the allocated index set and allocated to an idle target allocation container. The selection process stops when the number of selected candidate combinations reaches the current number of available target allocation containers.
5. A dynamic sorting and scheduling method for fruit weighing on a production line according to claim 1, characterized in that, The process of generating counterweight guidance information for supplementary units in response to the inability of the set of counterweight units to generate a valid candidate combination that satisfies the multiple constraints includes: Based on the constraint on the number of combined units, a subset of existing units containing a target number of units to be counterweighted is extracted from the units to be counterweighted sorted by weight using a sliding window. The target number is one less than the target number of combined units in the constraint on the number of combined units, and the total weight of the subset of existing units is calculated. Based on the combined total weight constraint and the unit weight constraint, the effective weight range is calculated. The effective weight range is the range of weight values that satisfy the multiple constraint conditions after the supplementary unit is added to the existing unit subset. The effective weight intervals corresponding to the existing unit subsets are overlapped and merged, and a representative unit subset is reserved for each merged effective weight interval to establish the mapping relationship between the effective weight intervals and the existing physical units.
6. A dynamic sorting and scheduling method for fruit weighing on a production line according to claim 5, characterized in that, The process of calculating the effective weight range based on the combined total weight constraint and the unit weight constraint includes: The maximum value of the difference between the lower limit of the combined total weight constraint and the sum of the weights, and the lower limit of the unit weight constraint, is determined as the lower bound of the effective weight range. The minimum value between the upper limit of the combined total weight constraint and the difference between the total weight and the upper limit of the unit weight constraint is determined as the upper bound of the effective weight range. The effective weight range is determined to be valid when the lower bound is not greater than the upper bound.
7. A dynamic sorting and scheduling method for fruit weighing on a production line according to claim 1, characterized in that, Also includes: In response to at least one of the following: a new qualified counterweight unit is detected being enqueued, the multiple constraints are changed, the target allocation container is released, the temporary weight limit offset is adjusted, or the counterweight unit is abnormally recycled, the steps of traversal search and boundary pruning and mutual exclusion selection are re-executed.
8. A dynamic sorting and scheduling method for fruit weighing on a production line according to claim 1, characterized in that, The process of obtaining the set of unassigned counterweight units includes: Add the counterweight units that have completed weight acquisition to the first-in-first-out queue in the order of arrival. Upon joining the team, the unit to be counterweighted is judged to be qualified based on the unit weight constraint. Qualified counterweight units that meet the unit weight constraints are added to the unassigned counterweight unit set for subsequent combination optimization. Unqualified counterweight units that do not meet the unit weight constraints are marked and excluded from the combination search range.
9. A dynamic sorting and scheduling method for fruit weighing on a production line according to claim 4, characterized in that, Also includes: When the mutual exclusion selection ends, if the number of selected candidate combinations is less than the number of currently idle target allocation containers, the selected candidate combinations will be allocated to the corresponding idle target allocation containers, and the remaining idle target allocation containers will remain in a waiting state. Unassigned weight cells are retained in the set of unassigned weight cells. When the next triggering event occurs, the steps of traversal search and boundary pruning and mutual exclusion selection are re-executed until all free target allocation containers are allocated or the candidate combination set is exhausted.
10. A dynamic sorting and scheduling system for fruit weighing on a production line, characterized in that, A dynamic sorting and scheduling method for fruit weighing on a production line, applicable to any one of claims 1-9, the system comprising a communication unit and a processing unit; The communication unit is used to acquire the set of unassigned counterweight units and preset multiple constraints, including constraints on the number of combined units, total combined weight, and unit weight; and output the target allocation container information and the counterweight guidance information after allocation. The processing unit is configured to perform traversal search and boundary pruning on the set of units to be counterweighted based on the multiple constraints, generating a set of candidate combinations that satisfy the multiple constraints; sort the set of candidate combinations based on the combination consumption priority, and select conflict-free candidate combinations from the set of candidate combinations through mutual exclusion selection constraints, and allocate them to an idle target allocation container; in response to the set of units to be counterweighted failing to generate a valid candidate combination that satisfies the multiple constraints, generate counterweight guidance information for supplementary units.