Description: 用回溯解背包问题 假设有n件物品,定义一个结构体a[]来存储,结构体有两个成员weight和value(weight表示重量,value表示价值)先定义一个数组col[]表示每个物品当前状态(为1表示被选,为0表示未被选),其初值全为1,从下标为0开始遍历,当前所选物品总重和总价值分别设为tw和tv(初值均为0),背包的限重设为limit,若第i个物品满足tw+a[i].weight<=limit且col[i]==1 就将a[i].weight和value加入tw和tv,否则col[i]设为0。-Knapsack problem using backtracking solution assumption has n items, the definition of a structure a [] to store, structure, body weight and has two members value (weight, said weight, value, said value) before the definition of an array col [] mean that each and every item current status (as one said to be elected, not selected to express to 0), all of its initial value 1, from the beginning subscript 0 ergodicity, the currently selected items and the total value of gross weight, respectively, as tw and tv (early values are 0), backpack weight limit is set to limit, if paragraph i of goods to meet tw+ a [i]. weight Platform: |
Size: 180224 |
Author:STartBoy |
Hits:
Description: 从文件读入数据,用回溯法实现了0-1背包最优解的问题-Read data from a file, using backtracking to achieve the optimal solution of the 0-1 knapsack problem Platform: |
Size: 1024 |
Author:canon |
Hits:
Description: c++利用回溯法来实现01背包问题
阶段是:在前N件物品中,选取若干件物品放入背包中; 状态是:在前N件物品中,选取若干件物品放入所剩空间为W的背包中的所能获得的最大价值; 决策是:第N件物品放或者不放; -c++ using backtracking to achieve the 01 knapsack problem
Stage: the first N items, select the number of items into the backpack status is: the first N items, select the number of items into the remaining space in the backpack for the W available to the greatest value Decision-making is: The first N items put or hold
Platform: |
Size: 884736 |
Author:林挺 |
Hits:
Description: 用java实现的01背包问题的有分支限界的回溯算法,注释非常详细,是我作业的一部分。伪代码可以参考《计算机算法与数据结构》这本书-Using java to achieve 01 knapsack problem branch-and-bound backtracking algorithm and very detailed notes, is part of my job. The pseudo-code can refer to this book of computer algorithms and data structures Platform: |
Size: 2048 |
Author:xuchao |
Hits:
Description: 用回溯法解决背包问题
用回溯法解决背包问题-Use backtracking to solve knapsack problem using backtracking to solve knapsack problem Platform: |
Size: 1024 |
Author:付鹏 |
Hits:
Description: 运用贪心算法解决0-1背包问题;
运用回溯法解决0-1背包问题;
运用分支界限法解决0-1背包问题。
-Use greedy algorithm to solve 0-1 knapsack problem
Use backtracking to solve the 0-1 knapsack problem
Using the branch and bound method to solve the 0-1 knapsack problem. Platform: |
Size: 4096 |
Author:小白 |
Hits:
Description: 通过vc6.0实现背包问题的基本操作,使用了回溯法并用了回归方程-Knapsack problem by vc6.0 achieve the basic operation, using the backtracking with the regression equation Platform: |
Size: 209920 |
Author:pour |
Hits: