Method for solving bounded knapsack problem based on improved dynamic programming algorithm
A technology of dynamic programming algorithm and knapsack problem, which is applied in computing, complex mathematical operations, data processing applications, etc., can solve the problems of increasing algorithm time and space complexity, not taking into account the same value and weight, etc., to reduce redundancy More calculations, fast solution, good efficiency effect
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0040] A method for solving the bounded knapsack problem based on an improved dynamic programming algorithm (hereinafter referred to as FBKP), which defines the maximum number of items as N, the maximum capacity of the knapsack as C, the item type as i, 0≤i≤N, and each item A single value of v i , with weight w i , the number of each item is k i ;Define a (N+1)×(C+1) two-dimensional value table f, the knapsack capacity is j, 0≤j≤C; f i (j) indicates the maximum value of putting i items into the knapsack when the capacity is j. When i=0 or j=0, the maximum value obtained is f (i=0) (j) and f (j=0) (i) are all 0.
[0041] Calculate the remainder a, group the capacity states j according to the capacity remainder a, and put the capacity states j with the same capacity remainder into a group for calculation. This embodiment is sequential calculation, so the first group of calculations ends before the next group starts .
[0042] Such as figure 1 As shown, the above method in...
Embodiment 2
[0067] In this embodiment, on the basis of grouping the capacity state j in embodiment 1, the calculation tasks of multiple groups are executed in parallel. First, the maximum number of item types is defined as N in embodiment 1, the maximum capacity of the backpack is C, and the item type is i, 0≤i≤N, the individual value of each item is v i , with weight w i , the number of each item is k i ;Define a (N+1)×(C+1) two-dimensional value table f, the knapsack capacity is j, 0≤j≤C; f i (j) indicates the maximum value of putting i items into the knapsack when the capacity is j. When i=0 or j=0, the maximum value obtained is f (i=0) (j) and f (j=0) (i) are all 0.
[0068] Specifically, such as figure 2 As shown, the method of the present embodiment (hereinafter referred to as FBKP parallel) comprises the steps:
[0069] S1. Calculate the remainder a=j mod w i, there are n types of remainder a, group the capacity state j according to the capacity remainder a, put the capacit...
PUM
Abstract
Description
Claims
Application Information
- R&D Engineer
- R&D Manager
- IP Professional
- Industry Leading Data Capabilities
- Powerful AI technology
- Patent DNA Extraction
Browse by: Latest US Patents, China's latest patents, Technical Efficacy Thesaurus, Application Domain, Technology Topic, Popular Technical Reports.
© 2024 PatSnap. All rights reserved.Legal|Privacy policy|Modern Slavery Act Transparency Statement|Sitemap|About US| Contact US: help@patsnap.com