Smart grouping of item, item quantity












-1















I have a situation where I am receiving orders of multiple products of varying quantity that need to ship on multiple trucks. The goal is minimize the number of products per shipment to make product picking more efficient.



Source Item/Quantity Table



Ideally I don't want 6 different items per truck. What I can pretty easily do and don't need help with is just ordering items by quantity descending and streaming them into groups of 24 (truck limit). I'm struggling to find an algorithm to intelligently break the quantity into "smart groups". My first thought is I'm really looking at developing some sort of AI to do this, and not really sure where to start. Does anybody have thoughts or suggestions on how to accomplish this?



Grouping Examples










share|improve this question

























  • There are many many existing methods. Ten seconds with the magic Google answer machine found me this: stackoverflow.com/q/140406/1070452

    – Make StackOverflow Good Again
    Dec 31 '18 at 18:22











  • It's not clear exactly what you're asking here. Are you just trying to break a set of numbers into groups equal or less than a maximum number? Or do you need to consider the sizes of packages and the volume that different trucks can hold?

    – Rufus L
    Dec 31 '18 at 18:22













  • I use Google and search SO all the time for answers to my problems. In all my years of programming and on SO, this is fourth question I've ever asked. I apologize that my searches didn't yield the results I require and that I didn't know how to properly ask this question. The link you provided does help in that it gives me some better pointed search criteria. Thank you. And yes, I'm trying to break a set of numbers into groups of equal or less than a max. number while minimizing the items per set. I don't need to worry if the number is ever equal to or greater than the limit. Thanks

    – David Gerst
    Dec 31 '18 at 18:51













  • i do not need to consider size of packages, weight, or volume. It's purely grouping into sets of 24.

    – David Gerst
    Dec 31 '18 at 19:22











  • The problem is called a "Packing Problem". The Romans tried solving the problem 2000 years ago and couldn't and it is still not solved. The Romans tried to figure out how to pack the chariots going to war. They wanted to minimize the number chariots they needed and if they over packed the chariots they went slower and tipped over. There are algorithms but none are perfect. Do a search for "Packing Algorithms".

    – jdweng
    Dec 31 '18 at 22:08
















-1















I have a situation where I am receiving orders of multiple products of varying quantity that need to ship on multiple trucks. The goal is minimize the number of products per shipment to make product picking more efficient.



Source Item/Quantity Table



Ideally I don't want 6 different items per truck. What I can pretty easily do and don't need help with is just ordering items by quantity descending and streaming them into groups of 24 (truck limit). I'm struggling to find an algorithm to intelligently break the quantity into "smart groups". My first thought is I'm really looking at developing some sort of AI to do this, and not really sure where to start. Does anybody have thoughts or suggestions on how to accomplish this?



Grouping Examples










share|improve this question

























  • There are many many existing methods. Ten seconds with the magic Google answer machine found me this: stackoverflow.com/q/140406/1070452

    – Make StackOverflow Good Again
    Dec 31 '18 at 18:22











  • It's not clear exactly what you're asking here. Are you just trying to break a set of numbers into groups equal or less than a maximum number? Or do you need to consider the sizes of packages and the volume that different trucks can hold?

    – Rufus L
    Dec 31 '18 at 18:22













  • I use Google and search SO all the time for answers to my problems. In all my years of programming and on SO, this is fourth question I've ever asked. I apologize that my searches didn't yield the results I require and that I didn't know how to properly ask this question. The link you provided does help in that it gives me some better pointed search criteria. Thank you. And yes, I'm trying to break a set of numbers into groups of equal or less than a max. number while minimizing the items per set. I don't need to worry if the number is ever equal to or greater than the limit. Thanks

    – David Gerst
    Dec 31 '18 at 18:51













  • i do not need to consider size of packages, weight, or volume. It's purely grouping into sets of 24.

    – David Gerst
    Dec 31 '18 at 19:22











  • The problem is called a "Packing Problem". The Romans tried solving the problem 2000 years ago and couldn't and it is still not solved. The Romans tried to figure out how to pack the chariots going to war. They wanted to minimize the number chariots they needed and if they over packed the chariots they went slower and tipped over. There are algorithms but none are perfect. Do a search for "Packing Algorithms".

    – jdweng
    Dec 31 '18 at 22:08














-1












-1








-1


1






I have a situation where I am receiving orders of multiple products of varying quantity that need to ship on multiple trucks. The goal is minimize the number of products per shipment to make product picking more efficient.



Source Item/Quantity Table



Ideally I don't want 6 different items per truck. What I can pretty easily do and don't need help with is just ordering items by quantity descending and streaming them into groups of 24 (truck limit). I'm struggling to find an algorithm to intelligently break the quantity into "smart groups". My first thought is I'm really looking at developing some sort of AI to do this, and not really sure where to start. Does anybody have thoughts or suggestions on how to accomplish this?



Grouping Examples










share|improve this question
















I have a situation where I am receiving orders of multiple products of varying quantity that need to ship on multiple trucks. The goal is minimize the number of products per shipment to make product picking more efficient.



Source Item/Quantity Table



Ideally I don't want 6 different items per truck. What I can pretty easily do and don't need help with is just ordering items by quantity descending and streaming them into groups of 24 (truck limit). I'm struggling to find an algorithm to intelligently break the quantity into "smart groups". My first thought is I'm really looking at developing some sort of AI to do this, and not really sure where to start. Does anybody have thoughts or suggestions on how to accomplish this?



Grouping Examples







c# list parsing grouping mathematical-optimization






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 31 '18 at 18:20









Rufus L

18.9k31632




18.9k31632










asked Dec 31 '18 at 18:16









David GerstDavid Gerst

64




64













  • There are many many existing methods. Ten seconds with the magic Google answer machine found me this: stackoverflow.com/q/140406/1070452

    – Make StackOverflow Good Again
    Dec 31 '18 at 18:22











  • It's not clear exactly what you're asking here. Are you just trying to break a set of numbers into groups equal or less than a maximum number? Or do you need to consider the sizes of packages and the volume that different trucks can hold?

    – Rufus L
    Dec 31 '18 at 18:22













  • I use Google and search SO all the time for answers to my problems. In all my years of programming and on SO, this is fourth question I've ever asked. I apologize that my searches didn't yield the results I require and that I didn't know how to properly ask this question. The link you provided does help in that it gives me some better pointed search criteria. Thank you. And yes, I'm trying to break a set of numbers into groups of equal or less than a max. number while minimizing the items per set. I don't need to worry if the number is ever equal to or greater than the limit. Thanks

    – David Gerst
    Dec 31 '18 at 18:51













  • i do not need to consider size of packages, weight, or volume. It's purely grouping into sets of 24.

    – David Gerst
    Dec 31 '18 at 19:22











  • The problem is called a "Packing Problem". The Romans tried solving the problem 2000 years ago and couldn't and it is still not solved. The Romans tried to figure out how to pack the chariots going to war. They wanted to minimize the number chariots they needed and if they over packed the chariots they went slower and tipped over. There are algorithms but none are perfect. Do a search for "Packing Algorithms".

    – jdweng
    Dec 31 '18 at 22:08



















  • There are many many existing methods. Ten seconds with the magic Google answer machine found me this: stackoverflow.com/q/140406/1070452

    – Make StackOverflow Good Again
    Dec 31 '18 at 18:22











  • It's not clear exactly what you're asking here. Are you just trying to break a set of numbers into groups equal or less than a maximum number? Or do you need to consider the sizes of packages and the volume that different trucks can hold?

    – Rufus L
    Dec 31 '18 at 18:22













  • I use Google and search SO all the time for answers to my problems. In all my years of programming and on SO, this is fourth question I've ever asked. I apologize that my searches didn't yield the results I require and that I didn't know how to properly ask this question. The link you provided does help in that it gives me some better pointed search criteria. Thank you. And yes, I'm trying to break a set of numbers into groups of equal or less than a max. number while minimizing the items per set. I don't need to worry if the number is ever equal to or greater than the limit. Thanks

    – David Gerst
    Dec 31 '18 at 18:51













  • i do not need to consider size of packages, weight, or volume. It's purely grouping into sets of 24.

    – David Gerst
    Dec 31 '18 at 19:22











  • The problem is called a "Packing Problem". The Romans tried solving the problem 2000 years ago and couldn't and it is still not solved. The Romans tried to figure out how to pack the chariots going to war. They wanted to minimize the number chariots they needed and if they over packed the chariots they went slower and tipped over. There are algorithms but none are perfect. Do a search for "Packing Algorithms".

    – jdweng
    Dec 31 '18 at 22:08

















There are many many existing methods. Ten seconds with the magic Google answer machine found me this: stackoverflow.com/q/140406/1070452

– Make StackOverflow Good Again
Dec 31 '18 at 18:22





There are many many existing methods. Ten seconds with the magic Google answer machine found me this: stackoverflow.com/q/140406/1070452

– Make StackOverflow Good Again
Dec 31 '18 at 18:22













It's not clear exactly what you're asking here. Are you just trying to break a set of numbers into groups equal or less than a maximum number? Or do you need to consider the sizes of packages and the volume that different trucks can hold?

– Rufus L
Dec 31 '18 at 18:22







It's not clear exactly what you're asking here. Are you just trying to break a set of numbers into groups equal or less than a maximum number? Or do you need to consider the sizes of packages and the volume that different trucks can hold?

– Rufus L
Dec 31 '18 at 18:22















I use Google and search SO all the time for answers to my problems. In all my years of programming and on SO, this is fourth question I've ever asked. I apologize that my searches didn't yield the results I require and that I didn't know how to properly ask this question. The link you provided does help in that it gives me some better pointed search criteria. Thank you. And yes, I'm trying to break a set of numbers into groups of equal or less than a max. number while minimizing the items per set. I don't need to worry if the number is ever equal to or greater than the limit. Thanks

– David Gerst
Dec 31 '18 at 18:51







I use Google and search SO all the time for answers to my problems. In all my years of programming and on SO, this is fourth question I've ever asked. I apologize that my searches didn't yield the results I require and that I didn't know how to properly ask this question. The link you provided does help in that it gives me some better pointed search criteria. Thank you. And yes, I'm trying to break a set of numbers into groups of equal or less than a max. number while minimizing the items per set. I don't need to worry if the number is ever equal to or greater than the limit. Thanks

– David Gerst
Dec 31 '18 at 18:51















i do not need to consider size of packages, weight, or volume. It's purely grouping into sets of 24.

– David Gerst
Dec 31 '18 at 19:22





i do not need to consider size of packages, weight, or volume. It's purely grouping into sets of 24.

– David Gerst
Dec 31 '18 at 19:22













The problem is called a "Packing Problem". The Romans tried solving the problem 2000 years ago and couldn't and it is still not solved. The Romans tried to figure out how to pack the chariots going to war. They wanted to minimize the number chariots they needed and if they over packed the chariots they went slower and tipped over. There are algorithms but none are perfect. Do a search for "Packing Algorithms".

– jdweng
Dec 31 '18 at 22:08





The problem is called a "Packing Problem". The Romans tried solving the problem 2000 years ago and couldn't and it is still not solved. The Romans tried to figure out how to pack the chariots going to war. They wanted to minimize the number chariots they needed and if they over packed the chariots they went slower and tipped over. There are algorithms but none are perfect. Do a search for "Packing Algorithms".

– jdweng
Dec 31 '18 at 22:08












1 Answer
1






active

oldest

votes


















0














One way to obtain the minimum number of different items per truck is to minimize the maximum number of different items. I don't think this fits a standard knapsack or packing problem, but we can easily formulate this as a mixed integer programming problem. To develop a mathematical model we can define the following decision variables:



x(i,j) >= 0     : quantity of item i placed in truck j 

y(i,j) in {0,1} : 1 if any item i is placed in truck j
0 otherwise


x is a non-negative variable and y is a binary variable. With this we can formulate our model as:



enter image description here



The results can look like:



----     56 PARAMETER results  solution

truck1 truck2 truck3 truck4

A 20.000
B 20.000
C 20.000
D 14.000
E 4.000
F 4.000
G 6.000
H 1.000 2.000
I 3.000
J 2.000
total 24.000 24.000 24.000 24.000
diff.items 3.000 2.000 3.000 3.000


This model can be fed into any MIP solver.



In practice you may want to make the objective a bit more complicated: first minimize the maximum and then minimize the sum of y's. This is to make sure the solution is well-behaved for trucks that do not hit the maximum y. In many practical models we need to add such "regularization" terms. This remains a linear MIP model.






share|improve this answer





















  • 1





    Thanks. this is essentially what I'm looking for.

    – David Gerst
    Jan 2 at 17:56






  • 1





    Full post - yetanothermathprogrammingconsultant.blogspot.com/2019/01/…

    – Royi
    Jan 27 at 5:25











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53990308%2fsmart-grouping-of-item-item-quantity%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














One way to obtain the minimum number of different items per truck is to minimize the maximum number of different items. I don't think this fits a standard knapsack or packing problem, but we can easily formulate this as a mixed integer programming problem. To develop a mathematical model we can define the following decision variables:



x(i,j) >= 0     : quantity of item i placed in truck j 

y(i,j) in {0,1} : 1 if any item i is placed in truck j
0 otherwise


x is a non-negative variable and y is a binary variable. With this we can formulate our model as:



enter image description here



The results can look like:



----     56 PARAMETER results  solution

truck1 truck2 truck3 truck4

A 20.000
B 20.000
C 20.000
D 14.000
E 4.000
F 4.000
G 6.000
H 1.000 2.000
I 3.000
J 2.000
total 24.000 24.000 24.000 24.000
diff.items 3.000 2.000 3.000 3.000


This model can be fed into any MIP solver.



In practice you may want to make the objective a bit more complicated: first minimize the maximum and then minimize the sum of y's. This is to make sure the solution is well-behaved for trucks that do not hit the maximum y. In many practical models we need to add such "regularization" terms. This remains a linear MIP model.






share|improve this answer





















  • 1





    Thanks. this is essentially what I'm looking for.

    – David Gerst
    Jan 2 at 17:56






  • 1





    Full post - yetanothermathprogrammingconsultant.blogspot.com/2019/01/…

    – Royi
    Jan 27 at 5:25
















0














One way to obtain the minimum number of different items per truck is to minimize the maximum number of different items. I don't think this fits a standard knapsack or packing problem, but we can easily formulate this as a mixed integer programming problem. To develop a mathematical model we can define the following decision variables:



x(i,j) >= 0     : quantity of item i placed in truck j 

y(i,j) in {0,1} : 1 if any item i is placed in truck j
0 otherwise


x is a non-negative variable and y is a binary variable. With this we can formulate our model as:



enter image description here



The results can look like:



----     56 PARAMETER results  solution

truck1 truck2 truck3 truck4

A 20.000
B 20.000
C 20.000
D 14.000
E 4.000
F 4.000
G 6.000
H 1.000 2.000
I 3.000
J 2.000
total 24.000 24.000 24.000 24.000
diff.items 3.000 2.000 3.000 3.000


This model can be fed into any MIP solver.



In practice you may want to make the objective a bit more complicated: first minimize the maximum and then minimize the sum of y's. This is to make sure the solution is well-behaved for trucks that do not hit the maximum y. In many practical models we need to add such "regularization" terms. This remains a linear MIP model.






share|improve this answer





















  • 1





    Thanks. this is essentially what I'm looking for.

    – David Gerst
    Jan 2 at 17:56






  • 1





    Full post - yetanothermathprogrammingconsultant.blogspot.com/2019/01/…

    – Royi
    Jan 27 at 5:25














0












0








0







One way to obtain the minimum number of different items per truck is to minimize the maximum number of different items. I don't think this fits a standard knapsack or packing problem, but we can easily formulate this as a mixed integer programming problem. To develop a mathematical model we can define the following decision variables:



x(i,j) >= 0     : quantity of item i placed in truck j 

y(i,j) in {0,1} : 1 if any item i is placed in truck j
0 otherwise


x is a non-negative variable and y is a binary variable. With this we can formulate our model as:



enter image description here



The results can look like:



----     56 PARAMETER results  solution

truck1 truck2 truck3 truck4

A 20.000
B 20.000
C 20.000
D 14.000
E 4.000
F 4.000
G 6.000
H 1.000 2.000
I 3.000
J 2.000
total 24.000 24.000 24.000 24.000
diff.items 3.000 2.000 3.000 3.000


This model can be fed into any MIP solver.



In practice you may want to make the objective a bit more complicated: first minimize the maximum and then minimize the sum of y's. This is to make sure the solution is well-behaved for trucks that do not hit the maximum y. In many practical models we need to add such "regularization" terms. This remains a linear MIP model.






share|improve this answer















One way to obtain the minimum number of different items per truck is to minimize the maximum number of different items. I don't think this fits a standard knapsack or packing problem, but we can easily formulate this as a mixed integer programming problem. To develop a mathematical model we can define the following decision variables:



x(i,j) >= 0     : quantity of item i placed in truck j 

y(i,j) in {0,1} : 1 if any item i is placed in truck j
0 otherwise


x is a non-negative variable and y is a binary variable. With this we can formulate our model as:



enter image description here



The results can look like:



----     56 PARAMETER results  solution

truck1 truck2 truck3 truck4

A 20.000
B 20.000
C 20.000
D 14.000
E 4.000
F 4.000
G 6.000
H 1.000 2.000
I 3.000
J 2.000
total 24.000 24.000 24.000 24.000
diff.items 3.000 2.000 3.000 3.000


This model can be fed into any MIP solver.



In practice you may want to make the objective a bit more complicated: first minimize the maximum and then minimize the sum of y's. This is to make sure the solution is well-behaved for trucks that do not hit the maximum y. In many practical models we need to add such "regularization" terms. This remains a linear MIP model.







share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 1 at 19:05

























answered Jan 1 at 16:23









Erwin KalvelagenErwin Kalvelagen

5,2192525




5,2192525








  • 1





    Thanks. this is essentially what I'm looking for.

    – David Gerst
    Jan 2 at 17:56






  • 1





    Full post - yetanothermathprogrammingconsultant.blogspot.com/2019/01/…

    – Royi
    Jan 27 at 5:25














  • 1





    Thanks. this is essentially what I'm looking for.

    – David Gerst
    Jan 2 at 17:56






  • 1





    Full post - yetanothermathprogrammingconsultant.blogspot.com/2019/01/…

    – Royi
    Jan 27 at 5:25








1




1





Thanks. this is essentially what I'm looking for.

– David Gerst
Jan 2 at 17:56





Thanks. this is essentially what I'm looking for.

– David Gerst
Jan 2 at 17:56




1




1





Full post - yetanothermathprogrammingconsultant.blogspot.com/2019/01/…

– Royi
Jan 27 at 5:25





Full post - yetanothermathprogrammingconsultant.blogspot.com/2019/01/…

– Royi
Jan 27 at 5:25




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53990308%2fsmart-grouping-of-item-item-quantity%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

The term 'EXEC' is not recognized as the name of a cmdlet Powershell

NPM command prompt closes immediately [closed]

Error binding properties and functions in emscripten