# Thread:

1. ## Combinatory optimization problem

Dear experts,

for a practical use in a warehouse I'm searching for a way to define this problem in an algorithm:

We need to pick an article with a given amount $x$ where $x \in \mathbb N^+$.
The article is distributed in several boxes in the warehouse. Each box contains the article in different amounts. So we have a limited amount of boxes $n$ with each box containing a quantity $y_n$ where $y_n \in \mathbb N^+$. We want to find the combination of boxes where the sum of the quantity of all selected boxes gets as close as possible to $x$ (but doesn't exceed $x$).

$<br /> \begin{array}{|c||c|c|c|c|c|c|c|}<br /> \hline<br /> n & 1 & 2 & 3 & 4 & 5 & 6 & 7\\<br /> \hline<br /> y_n & 15 & 17 & 8 & 20 & 19 & 20 & 18\\<br /> \hline<br /> \end{array}<br />$

if $x=53$ then the ideal combination would be $y_1+y_4+y_7$ (15+20+18=53).
if $x=30$ the best combination would be $y_3+y_4$ (8+20=28).

It looks a little bit like a 0-1 knapsack problem to me but without the maximimizing of a value. Performance would certainly have to be considered. Can you help me to find an algorithm (I guess this problem is NP-hard)?

Regards,
Gunter
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 12, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9175729155540466, "perplexity_flag": "head"}