public final class Knapsack extends Object implements Problem<ISeq<Knapsack.Item>,BitGene,Double>
Engine.| Modifier and Type | Class and Description |
|---|---|
static class |
Knapsack.Item
This class represents a knapsack item with the specific size and
value.
|
| Constructor and Description |
|---|
Knapsack(ISeq<Knapsack.Item> items,
double knapsackSize)
Create a new
Knapsack definition with the given |
| Modifier and Type | Method and Description |
|---|---|
Codec<ISeq<Knapsack.Item>,BitGene> |
codec() |
Function<ISeq<Knapsack.Item>,Double> |
fitness() |
static Knapsack |
of(int itemCount,
Random random)
Factory method for creating same Knapsack problems for testing
purpose.
|
public Knapsack(ISeq<Knapsack.Item> items, double knapsackSize)
Knapsack definition with the givenitems - the basic Set of knapsack items.knapsackSize - the maximal knapsack sizeNullPointerException - if the items set is nullpublic Function<ISeq<Knapsack.Item>,Double> fitness()
public Codec<ISeq<Knapsack.Item>,BitGene> codec()
public static Knapsack of(int itemCount, Random random)
itemCount - the number of knapsack items in the basic setrandom - the random engine used for creating random knapsack items.
This allows to create reproducible item sets and reproducible
Knapsack problems, respectively.Knapsack problem object (for testing purpose).© 2007-2017 Franz Wilhelmstötter (2017-04-27 23:07)