beibao

所属分类:超算/并行计算
开发工具:C/C++
文件大小:2KB
下载次数:25
上传日期:2008-06-11 21:15:11
上 传 者shmily7901
说明:  0-1背包问题(0-1 Knapsack Problem)的定义为:设集合 代表m件物品,正整数 分别表示第 件物品的价值与重量,那么0-1背包问题KNAP(A,c)定义为,求A的子集,使得重量之和小于背包的容量c,并使得价值和最大。
(0-1 knapsack problem (0-1 Knapsack Problem) is defined as: set up a collection on behalf of m items, respectively, the first positive integer value of items and weight, then the 0-1 knapsack problem KNAP (A, c) is defined as, A subset of demand, making less than the weight of the backpack and the capacity c, and make the value and the greatest.)

文件列表:
16-4\beibao.c (3058, 2003-09-05)
16-4 (0, 2008-05-21)

Example: 编译:mpicc -o beibao beibao.c -lm 运行:(group_size为处理器个数)  mpirun -np group_size box 这里运行mpirun Cnp 5 beibao 运行结果: my_rank 0 knapscack of capacity = 4 Enter number of values: 6 please input p: 16 34 20 25 30 26 please input w: 2 3 5 6 4 1 my rank is 1 my rank is 3 my rank is 4 the result: z 1:0 z 2:1 z 3:0 z 4:0 z 5:0 z 6:1 my rank is 2 说明:背包的容量为处理器个数-1

近期下载者

相关文件


收藏者