Fitting the biggest objects into a bin first--for near-optimization: What is this called?












0














I have a $5,000,000 budget.



And I have a list of construction projects with known costs.



I want to use up as much of the construction projects' budget as is practical--but with minimal complexity.





Using database logic, I can generate an ascending running total column in the list of construction projects. Using the running total, I can successfully omit any projects where the running total is greater than $5,000,000.



In order to reach my goal of using up most of the budget, I have come up with a low-tech technique where I sort the construction projects descending so that the more expensive projects are at the top of the list (and the less expensive projects are at the bottom). This way, when the running total of the projects approaches the $5,000,000 cut-off, I'm left with smaller projects that fit fairly well into the remaining gap.





This technique seems to be fairly successful. While it doesn't achieve 100% optimization, it does have the benefit of being low in complexity.





Question:



What is this kind of optimization called, and how can I find out more about it?










share|cite|improve this question




















  • 1




    Perhaps "greedy"
    – Henry
    Dec 26 '18 at 19:02
















0














I have a $5,000,000 budget.



And I have a list of construction projects with known costs.



I want to use up as much of the construction projects' budget as is practical--but with minimal complexity.





Using database logic, I can generate an ascending running total column in the list of construction projects. Using the running total, I can successfully omit any projects where the running total is greater than $5,000,000.



In order to reach my goal of using up most of the budget, I have come up with a low-tech technique where I sort the construction projects descending so that the more expensive projects are at the top of the list (and the less expensive projects are at the bottom). This way, when the running total of the projects approaches the $5,000,000 cut-off, I'm left with smaller projects that fit fairly well into the remaining gap.





This technique seems to be fairly successful. While it doesn't achieve 100% optimization, it does have the benefit of being low in complexity.





Question:



What is this kind of optimization called, and how can I find out more about it?










share|cite|improve this question




















  • 1




    Perhaps "greedy"
    – Henry
    Dec 26 '18 at 19:02














0












0








0







I have a $5,000,000 budget.



And I have a list of construction projects with known costs.



I want to use up as much of the construction projects' budget as is practical--but with minimal complexity.





Using database logic, I can generate an ascending running total column in the list of construction projects. Using the running total, I can successfully omit any projects where the running total is greater than $5,000,000.



In order to reach my goal of using up most of the budget, I have come up with a low-tech technique where I sort the construction projects descending so that the more expensive projects are at the top of the list (and the less expensive projects are at the bottom). This way, when the running total of the projects approaches the $5,000,000 cut-off, I'm left with smaller projects that fit fairly well into the remaining gap.





This technique seems to be fairly successful. While it doesn't achieve 100% optimization, it does have the benefit of being low in complexity.





Question:



What is this kind of optimization called, and how can I find out more about it?










share|cite|improve this question















I have a $5,000,000 budget.



And I have a list of construction projects with known costs.



I want to use up as much of the construction projects' budget as is practical--but with minimal complexity.





Using database logic, I can generate an ascending running total column in the list of construction projects. Using the running total, I can successfully omit any projects where the running total is greater than $5,000,000.



In order to reach my goal of using up most of the budget, I have come up with a low-tech technique where I sort the construction projects descending so that the more expensive projects are at the top of the list (and the less expensive projects are at the bottom). This way, when the running total of the projects approaches the $5,000,000 cut-off, I'm left with smaller projects that fit fairly well into the remaining gap.





This technique seems to be fairly successful. While it doesn't achieve 100% optimization, it does have the benefit of being low in complexity.





Question:



What is this kind of optimization called, and how can I find out more about it?







optimization






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Dec 26 '18 at 21:51

























asked Dec 26 '18 at 18:58









Wilson

13311




13311








  • 1




    Perhaps "greedy"
    – Henry
    Dec 26 '18 at 19:02














  • 1




    Perhaps "greedy"
    – Henry
    Dec 26 '18 at 19:02








1




1




Perhaps "greedy"
– Henry
Dec 26 '18 at 19:02




Perhaps "greedy"
– Henry
Dec 26 '18 at 19:02










1 Answer
1






active

oldest

votes


















1














The general case you are looking for is commonly called the Knapsack problem. There is no general, efficient way to optimally solve it so your idea of trying to use the most expensive projects first so you have a large selection of less expensive ones to try to fill in most, if not all, of the remaining gap is a quite good, relatively efficient, heuristic way to handle this.



As Henry pointed out, what you propose is a "greedy" type algorithm that, according to the Wikipedia article, was proposed previously by George Dantzig. However, there doesn't seem to be any specific name associated with this. Nonetheless, if you search on & read about the Knapsack problem, you may be able to find other relatively simple & fast techniques you can try using.






share|cite|improve this answer























  • This is wrong. There is a way to solve the knapsack problem using dynamic programming.
    – user110971
    Dec 26 '18 at 19:11










  • @user110971 Thank you for your point. You are correct, as I forgot to indicate "efficient", so I have now corrected my answer accordingly.
    – John Omielan
    Dec 26 '18 at 19:15






  • 1




    the knapsack problem can be solved in pseudo-polynomial time. It is O(nW). One can argue that this is efficient.
    – user110971
    Dec 26 '18 at 21:09






  • 1




    @Wilson n is the number of items and W is the size of the sack. Then, as per the big O notation, the computational complexity satisfies $|f(x)| leq M nW$ for all $x geq x_0$, where $x_0, M$ are constants.
    – user110971
    Dec 26 '18 at 21:56













Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
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
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3053215%2ffitting-the-biggest-objects-into-a-bin-first-for-near-optimization-what-is-thi%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









1














The general case you are looking for is commonly called the Knapsack problem. There is no general, efficient way to optimally solve it so your idea of trying to use the most expensive projects first so you have a large selection of less expensive ones to try to fill in most, if not all, of the remaining gap is a quite good, relatively efficient, heuristic way to handle this.



As Henry pointed out, what you propose is a "greedy" type algorithm that, according to the Wikipedia article, was proposed previously by George Dantzig. However, there doesn't seem to be any specific name associated with this. Nonetheless, if you search on & read about the Knapsack problem, you may be able to find other relatively simple & fast techniques you can try using.






share|cite|improve this answer























  • This is wrong. There is a way to solve the knapsack problem using dynamic programming.
    – user110971
    Dec 26 '18 at 19:11










  • @user110971 Thank you for your point. You are correct, as I forgot to indicate "efficient", so I have now corrected my answer accordingly.
    – John Omielan
    Dec 26 '18 at 19:15






  • 1




    the knapsack problem can be solved in pseudo-polynomial time. It is O(nW). One can argue that this is efficient.
    – user110971
    Dec 26 '18 at 21:09






  • 1




    @Wilson n is the number of items and W is the size of the sack. Then, as per the big O notation, the computational complexity satisfies $|f(x)| leq M nW$ for all $x geq x_0$, where $x_0, M$ are constants.
    – user110971
    Dec 26 '18 at 21:56


















1














The general case you are looking for is commonly called the Knapsack problem. There is no general, efficient way to optimally solve it so your idea of trying to use the most expensive projects first so you have a large selection of less expensive ones to try to fill in most, if not all, of the remaining gap is a quite good, relatively efficient, heuristic way to handle this.



As Henry pointed out, what you propose is a "greedy" type algorithm that, according to the Wikipedia article, was proposed previously by George Dantzig. However, there doesn't seem to be any specific name associated with this. Nonetheless, if you search on & read about the Knapsack problem, you may be able to find other relatively simple & fast techniques you can try using.






share|cite|improve this answer























  • This is wrong. There is a way to solve the knapsack problem using dynamic programming.
    – user110971
    Dec 26 '18 at 19:11










  • @user110971 Thank you for your point. You are correct, as I forgot to indicate "efficient", so I have now corrected my answer accordingly.
    – John Omielan
    Dec 26 '18 at 19:15






  • 1




    the knapsack problem can be solved in pseudo-polynomial time. It is O(nW). One can argue that this is efficient.
    – user110971
    Dec 26 '18 at 21:09






  • 1




    @Wilson n is the number of items and W is the size of the sack. Then, as per the big O notation, the computational complexity satisfies $|f(x)| leq M nW$ for all $x geq x_0$, where $x_0, M$ are constants.
    – user110971
    Dec 26 '18 at 21:56
















1












1








1






The general case you are looking for is commonly called the Knapsack problem. There is no general, efficient way to optimally solve it so your idea of trying to use the most expensive projects first so you have a large selection of less expensive ones to try to fill in most, if not all, of the remaining gap is a quite good, relatively efficient, heuristic way to handle this.



As Henry pointed out, what you propose is a "greedy" type algorithm that, according to the Wikipedia article, was proposed previously by George Dantzig. However, there doesn't seem to be any specific name associated with this. Nonetheless, if you search on & read about the Knapsack problem, you may be able to find other relatively simple & fast techniques you can try using.






share|cite|improve this answer














The general case you are looking for is commonly called the Knapsack problem. There is no general, efficient way to optimally solve it so your idea of trying to use the most expensive projects first so you have a large selection of less expensive ones to try to fill in most, if not all, of the remaining gap is a quite good, relatively efficient, heuristic way to handle this.



As Henry pointed out, what you propose is a "greedy" type algorithm that, according to the Wikipedia article, was proposed previously by George Dantzig. However, there doesn't seem to be any specific name associated with this. Nonetheless, if you search on & read about the Knapsack problem, you may be able to find other relatively simple & fast techniques you can try using.







share|cite|improve this answer














share|cite|improve this answer



share|cite|improve this answer








edited Dec 26 '18 at 19:26

























answered Dec 26 '18 at 19:08









John Omielan

89418




89418












  • This is wrong. There is a way to solve the knapsack problem using dynamic programming.
    – user110971
    Dec 26 '18 at 19:11










  • @user110971 Thank you for your point. You are correct, as I forgot to indicate "efficient", so I have now corrected my answer accordingly.
    – John Omielan
    Dec 26 '18 at 19:15






  • 1




    the knapsack problem can be solved in pseudo-polynomial time. It is O(nW). One can argue that this is efficient.
    – user110971
    Dec 26 '18 at 21:09






  • 1




    @Wilson n is the number of items and W is the size of the sack. Then, as per the big O notation, the computational complexity satisfies $|f(x)| leq M nW$ for all $x geq x_0$, where $x_0, M$ are constants.
    – user110971
    Dec 26 '18 at 21:56




















  • This is wrong. There is a way to solve the knapsack problem using dynamic programming.
    – user110971
    Dec 26 '18 at 19:11










  • @user110971 Thank you for your point. You are correct, as I forgot to indicate "efficient", so I have now corrected my answer accordingly.
    – John Omielan
    Dec 26 '18 at 19:15






  • 1




    the knapsack problem can be solved in pseudo-polynomial time. It is O(nW). One can argue that this is efficient.
    – user110971
    Dec 26 '18 at 21:09






  • 1




    @Wilson n is the number of items and W is the size of the sack. Then, as per the big O notation, the computational complexity satisfies $|f(x)| leq M nW$ for all $x geq x_0$, where $x_0, M$ are constants.
    – user110971
    Dec 26 '18 at 21:56


















This is wrong. There is a way to solve the knapsack problem using dynamic programming.
– user110971
Dec 26 '18 at 19:11




This is wrong. There is a way to solve the knapsack problem using dynamic programming.
– user110971
Dec 26 '18 at 19:11












@user110971 Thank you for your point. You are correct, as I forgot to indicate "efficient", so I have now corrected my answer accordingly.
– John Omielan
Dec 26 '18 at 19:15




@user110971 Thank you for your point. You are correct, as I forgot to indicate "efficient", so I have now corrected my answer accordingly.
– John Omielan
Dec 26 '18 at 19:15




1




1




the knapsack problem can be solved in pseudo-polynomial time. It is O(nW). One can argue that this is efficient.
– user110971
Dec 26 '18 at 21:09




the knapsack problem can be solved in pseudo-polynomial time. It is O(nW). One can argue that this is efficient.
– user110971
Dec 26 '18 at 21:09




1




1




@Wilson n is the number of items and W is the size of the sack. Then, as per the big O notation, the computational complexity satisfies $|f(x)| leq M nW$ for all $x geq x_0$, where $x_0, M$ are constants.
– user110971
Dec 26 '18 at 21:56






@Wilson n is the number of items and W is the size of the sack. Then, as per the big O notation, the computational complexity satisfies $|f(x)| leq M nW$ for all $x geq x_0$, where $x_0, M$ are constants.
– user110971
Dec 26 '18 at 21:56




















draft saved

draft discarded




















































Thanks for contributing an answer to Mathematics Stack Exchange!


  • 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.


Use MathJax to format equations. MathJax reference.


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





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • 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%2fmath.stackexchange.com%2fquestions%2f3053215%2ffitting-the-biggest-objects-into-a-bin-first-for-near-optimization-what-is-thi%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

Human spaceflight

Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

File:DeusFollowingSea.jpg