Skip to content

Commit

Permalink
changed knapsack example
Browse files Browse the repository at this point in the history
  • Loading branch information
zaibod committed Jul 17, 2024
1 parent 0f4125d commit e39405c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
public class KnapsackConfiguration {
/**
* An optimization problem:
* For given items each with a weight and value, determine which items are part of a collection where
* the total weight is less than or equal to a given limit and the sum of values is as large as possible.
* For given items each with a weight and value, determine which items are part of a collection
* where the total weight is less than or equal to a given limit
* and the sum of values is as large as possible.
*/
public static final ProblemType<String, String> KNAPSACK = new ProblemType<>(
"knapsack",
Expand All @@ -45,8 +46,8 @@ private Set<Problem<String, String>> loadExampleProblems(
) {
try {
var problemInputStream = Objects.requireNonNull(
getClass().getResourceAsStream("5-items.txt"),
"5-items example for Knapsack is unavailable!"
getClass().getResourceAsStream("10-items.txt"),
"10-items example for Knapsack is unavailable!"
);
var problem = new Problem<>(KNAPSACK);
problem.setInput(resourceProvider.readStream(problemInputStream));
Expand Down
12 changes: 12 additions & 0 deletions src/main/resources/edu/kit/provideq/toolbox/knapsack/10-items.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
10
1 505 23
2 352 26
3 458 20
4 220 18
5 354 32
6 414 27
7 498 29
8 545 26
9 473 30
10 543 27
99

This file was deleted.

0 comments on commit e39405c

Please sign in to comment.