From 46e19eed1b6dbedcc8ec5e51c2c2f7ffd3c499de Mon Sep 17 00:00:00 2001 From: Alinson S Xavier Date: Fri, 31 Jan 2020 10:34:04 -0600 Subject: [PATCH] Knapsack: minor correction to docs; update docstrings --- docs/problems.md | 2 +- miplearn/problems/knapsack.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/problems.md b/docs/problems.md index 678cae0..e085382 100644 --- a/docs/problems.md +++ b/docs/problems.md @@ -93,7 +93,7 @@ If `fix_w=True` is provided, then $w_{ij}$ are kept the same in all generated in If a probability distribution `w_jitter` is provided, then item weights will be set to $w_{ij} + \gamma_{ij}$ where $\gamma_{ij}$ is sampled from `w_jitter`. When combined with `fix_w=True`, this argument may be used to generate instances where the weight of each item is roughly the same, but not exactly identical, across all instances. The prices of the items and the capacities of the knapsacks will be calculated as above, but using these perturbed weights instead. -By default, all generated prices, weights and capacities are rounded to the nearest number. If `round=False` is provided, this rounding will be disabled. +By default, all generated prices, weights and capacities are rounded to the nearest integer number. If `round=False` is provided, this rounding will be disabled. !!! note "References" * Freville, Arnaud, and Gérard Plateau. *An efficient preprocessing procedure for the multidimensional 0–1 knapsack problem.* Discrete applied mathematics 49.1-3 (1994): 189-212. diff --git a/miplearn/problems/knapsack.py b/miplearn/problems/knapsack.py index 366d19f..ec4e182 100644 --- a/miplearn/problems/knapsack.py +++ b/miplearn/problems/knapsack.py @@ -130,7 +130,6 @@ class MultiKnapsackGenerator: from w[i,j], as long as u and K are not constants, the generated instances will still not be completely identical. - If a probability distribution w_jitter is provided, then item weights will be set to w[i,j] + gamma[i,j] where gamma[i,j] is sampled from w_jitter. When combined with fix_w=True, this argument may be used to generate instances where the weight of each item @@ -138,6 +137,9 @@ class MultiKnapsackGenerator: items and the capacities of the knapsacks will be calculated as above, but using these perturbed weights instead. + By default, all generated prices, weights and capacities are rounded to the nearest integer + number. If `round=False` is provided, this rounding will be disabled. + Parameters ---------- n: rv_discrete