Skip to content

Commit

Permalink
optimize integers bit-size for 0/1-KP Node
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume-Helbecque committed Aug 23, 2024
1 parent 6df2bcf commit 9cf4579
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions benchmarks/Knapsack/Node_Knapsack.chpl
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
module Node_Knapsack
{
use CTypes;

config param maxItems: int = 50;

record Node_Knapsack
{
var depth: int;
var items: c_array(int, maxItems);
var items: maxItems*uint(32);
var weight: int;
var profit: int;

Expand Down
2 changes: 1 addition & 1 deletion benchmarks/Knapsack/Problem_Knapsack.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class Problem_Knapsack : Problem
for i in 0..1 {
var child = new Node(parent);
child.depth += 1;
child.items[parent.depth] = i;
child.items[parent.depth] = i:uint(32);
child.weight += i*this.weight[parent.depth];
child.profit += i*this.profit[parent.depth];

Expand Down

0 comments on commit 9cf4579

Please sign in to comment.