<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

	<title>Comments on: The Math of Optimal Shopping Sprees</title>
	<link>http://ask.metafilter.com/36435/The-Math-of-Optimal-Shopping-Sprees/</link>
	<description>Comments on Ask MetaFilter post The Math of Optimal Shopping Sprees</description>
	<pubDate>Sun, 16 Apr 2006 14:37:16 -0800</pubDate>
	<lastBuildDate>Sun, 16 Apr 2006 14:37:16 -0800</lastBuildDate>
	<language>en-us</language>
	<docs>http://blogs.law.harvard.edu/tech/rss</docs>
	<ttl>60</ttl>

	<item>
		<title>Question: The Math of Optimal Shopping Sprees</title>
		<link>http://ask.metafilter.com/36435/The-Math-of-Optimal-Shopping-Sprees</link>	
		<description>I need to spend at least $25 at the grocery store to claim a discount.  I want to minimize how much I go over $25.

I have a list of a half a dozen items I want and their prices.

Is there a program that can generate shopping lists that would meet the criteria?  I want more than just the optimal list because I can get this discount repeatedly and I don&apos;t want to buy the same thing each time.</description>
		<guid isPermaLink="false">post:ask.metafilter.com,2006:site.36435</guid>
		<pubDate>Sun, 16 Apr 2006 14:28:27 -0800</pubDate>
		<dc:creator>storybored</dc:creator>
		
			<category>math</category>
		
			<category>grocery</category>
		
			<category>shopping</category>
		
	</item> <item>
		<title>By: jamescridland</title>
		<link>http://ask.metafilter.com/36435/The-Math-of-Optimal-Shopping-Sprees#565532</link>	
		<description>I&apos;d have thought that an Excel sheet could produce something for you; but a bit of programming would be required. But, probably better, why not just carry a calculator (or use your cellfone&apos;s) while you wander round the store? That way you buy what you want, AND make sure you only just go above $25.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.36435-565532</guid>
		<pubDate>Sun, 16 Apr 2006 14:37:16 -0800</pubDate>
		<dc:creator>jamescridland</dc:creator>
	</item><item>
		<title>By: zpousman</title>
		<link>http://ask.metafilter.com/36435/The-Math-of-Optimal-Shopping-Sprees#565537</link>	
		<description>This is a trivial problem to solve if you&apos;re a programmer. But it&apos;s so specific that there is probably not an existing program to do exactly this (especially since there has to be some way to enter the products you (may) want into the system.&lt;br&gt;
&lt;br&gt;
You might be able to get excel to spit out a list like this, if you knew some VB (or VB.net). If you&apos;re not a programmer then you may want to just work up 4 or 5 different grocery lists that meet your criteria and leave it at that. This may be even better than a computer program, because the program won&apos;t know things like &quot;almost never buy mustard, since it lasts months&quot; and so a program might spit out hundreds of shopping lists that, while they accomplish the mathematical goals (being over $25 but less than $26) will have lots of sub-optimal lists in them. Just sayin&apos;.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.36435-565537</guid>
		<pubDate>Sun, 16 Apr 2006 14:48:55 -0800</pubDate>
		<dc:creator>zpousman</dc:creator>
	</item><item>
		<title>By: frogan</title>
		<link>http://ask.metafilter.com/36435/The-Math-of-Optimal-Shopping-Sprees#565538</link>	
		<description>Suggestion: Don&apos;t worry about optimal lists. Instead, buy multiple units of easy-to-store, non-perishable items you will &lt;em&gt;always &lt;/em&gt;need. Cans of soup, cans of soda, toilet paper, shaving cream, bars of soap, etc.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.36435-565538</guid>
		<pubDate>Sun, 16 Apr 2006 14:49:56 -0800</pubDate>
		<dc:creator>frogan</dc:creator>
	</item><item>
		<title>By: juv3nal</title>
		<link>http://ask.metafilter.com/36435/The-Math-of-Optimal-Shopping-Sprees#565543</link>	
		<description>Is the grocery store thing a metaphor for some other type of situation?&lt;br&gt;
A program seems a bit overkill if there are only 6 items with known prices. &lt;br&gt;
&lt;br&gt;
If you really wanted to, you can just tabulate.&lt;br&gt;
What combination gives you close to but at least $1, $2, $3 etc? You do this recursively of course: If you have an item that&apos;s priced at say $5 then to discover what combinations will give you $25, you can use one of that $5 item plus any of the combinations that work for $20.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.36435-565543</guid>
		<pubDate>Sun, 16 Apr 2006 14:54:22 -0800</pubDate>
		<dc:creator>juv3nal</dc:creator>
	</item><item>
		<title>By: joeblough</title>
		<link>http://ask.metafilter.com/36435/The-Math-of-Optimal-Shopping-Sprees#565549</link>	
		<description>isnt this 1d bin-packing? and as such is NP-hard? IIRC then there is no polynomial-time algorithm that can optimally solve the problem, just approximations. i was really bad at computational theory though...</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.36435-565549</guid>
		<pubDate>Sun, 16 Apr 2006 15:12:56 -0800</pubDate>
		<dc:creator>joeblough</dc:creator>
	</item><item>
		<title>By: weapons-grade pandemonium</title>
		<link>http://ask.metafilter.com/36435/The-Math-of-Optimal-Shopping-Sprees#565555</link>	
		<description>Isn&apos;t this like a &lt;a href=&quot;http://www.cs.arizona.edu/icon/oddsends/bpack/bpack.htm&quot;&gt;packing problem?&lt;/a&gt; I would order all the relatively inexpensive products (e.g., under five dollars) that you would consider buying into ascending order of price. Carry that list with you to the supermarket.  Go and shop for whatever you want, keeping the total a few bucks under $25.  Then select an item or two from your list that will take you over the top. This way you won&apos;t be a slave to the list, since most of your items will be chosen according to your needs or appetite.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.36435-565555</guid>
		<pubDate>Sun, 16 Apr 2006 15:21:47 -0800</pubDate>
		<dc:creator>weapons-grade pandemonium</dc:creator>
	</item><item>
		<title>By: delmoi</title>
		<link>http://ask.metafilter.com/36435/The-Math-of-Optimal-Shopping-Sprees#565556</link>	
		<description>&lt;i&gt;isnt this 1d bin-packing? and as such is NP-hard? IIRC then there is no polynomial-time algorithm that can optimally solve the problem, just approximations. i was really bad at computational theory though...&lt;/i&gt;&lt;br&gt;
&lt;br&gt;
Hmm, I think it may be, however there are only six items and $25 total, so you could still search exhaustively. &lt;br&gt;
&lt;br&gt;
The NP-ness, however, would make it impossible to do by hand.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.36435-565556</guid>
		<pubDate>Sun, 16 Apr 2006 15:23:42 -0800</pubDate>
		<dc:creator>delmoi</dc:creator>
	</item><item>
		<title>By: Kwantsar</title>
		<link>http://ask.metafilter.com/36435/The-Math-of-Optimal-Shopping-Sprees#565567</link>	
		<description>Perhaps I&apos;m missing the point, but isn&apos;t this the exact problem that &lt;a href=&quot;http://www.econ.ucla.edu/riley/104/LPSolver(IE).htm&quot;&gt;solver &lt;/a&gt;was built for?&lt;br&gt;
&lt;br&gt;
If I understand the question correctly, I think I could do this in under 2 minutes without touching VBA. All you need to do is change a constraint (say, buy no more than three cans of spinach, then buy no more than two cans, etc)</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.36435-565567</guid>
		<pubDate>Sun, 16 Apr 2006 16:01:10 -0800</pubDate>
		<dc:creator>Kwantsar</dc:creator>
	</item><item>
		<title>By: devilsbrigade</title>
		<link>http://ask.metafilter.com/36435/The-Math-of-Optimal-Shopping-Sprees#565572</link>	
		<description>This is exactly the packing problem. Excel can do this; a perl script can do this; you can do this by hand (and you can approximate fairly easily, especially if you know the distribution of prices of your items).</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.36435-565572</guid>
		<pubDate>Sun, 16 Apr 2006 16:07:39 -0800</pubDate>
		<dc:creator>devilsbrigade</dc:creator>
	</item><item>
		<title>By: juv3nal</title>
		<link>http://ask.metafilter.com/36435/The-Math-of-Optimal-Shopping-Sprees#565582</link>	
		<description>&lt;em&gt;The NP-ness, however, would make it impossible to do by hand.&lt;/em&gt;&lt;br&gt;
&lt;br&gt;
The general problem is impossible, but with 6 items/$25?&lt;br&gt;
A &lt;a href=&quot;http://www.macs.hw.ac.uk/~alison/ds98/node122.html&quot;&gt;dynamic programming approach&lt;/a&gt; gives you something in O(NxM), and assuming &quot;to within a dollar&quot; is good enough for you, that should yield a table with only 150 elements unless I&apos;m missing something.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.36435-565582</guid>
		<pubDate>Sun, 16 Apr 2006 16:22:57 -0800</pubDate>
		<dc:creator>juv3nal</dc:creator>
	</item><item>
		<title>By: Frank Grimes</title>
		<link>http://ask.metafilter.com/36435/The-Math-of-Optimal-Shopping-Sprees#565665</link>	
		<description>I second the Excel solver. &lt;br&gt;
&lt;br&gt;
Is this coupon available to others? On the Internet? How can I get one of these coupons?</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.36435-565665</guid>
		<pubDate>Sun, 16 Apr 2006 19:29:41 -0800</pubDate>
		<dc:creator>Frank Grimes</dc:creator>
	</item><item>
		<title>By: joeblough</title>
		<link>http://ask.metafilter.com/36435/The-Math-of-Optimal-Shopping-Sprees#565667</link>	
		<description>yeah, i guess i didnt even read the OP well enough to see that it was a trivial # of goods. i just got went all academic on everyone&apos;s ass for no good reason :)</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.36435-565667</guid>
		<pubDate>Sun, 16 Apr 2006 19:30:13 -0800</pubDate>
		<dc:creator>joeblough</dc:creator>
	</item><item>
		<title>By: Sharcho</title>
		<link>http://ask.metafilter.com/36435/The-Math-of-Optimal-Shopping-Sprees#565837</link>	
		<description>I just do what frogan said -- buy non-perishable items.&lt;br&gt;
&lt;br&gt;
Before they pass the least important items through the barcode reader, just ask &quot;how much does this total to?&quot; and leave the extra items you don&apos;t need.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.36435-565837</guid>
		<pubDate>Mon, 17 Apr 2006 05:52:14 -0800</pubDate>
		<dc:creator>Sharcho</dc:creator>
	</item><item>
		<title>By: Robert Angelo</title>
		<link>http://ask.metafilter.com/36435/The-Math-of-Optimal-Shopping-Sprees#565890</link>	
		<description>Backing up a bit...  If you want to use this program repeatedly, how are you going to keep track of price changes?  You can&apos;t just set everything up in your Excel spreadsheet and assume that you&apos;re ready to go, since prices are changing every week, sometimes faster.  I agree that it&apos;s more practical to just keep track of the total as you&apos;re shopping (with calculator) or else ask at the checkout what is the total and then leave the items you don&apos;t want.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.36435-565890</guid>
		<pubDate>Mon, 17 Apr 2006 07:24:03 -0800</pubDate>
		<dc:creator>Robert Angelo</dc:creator>
	</item><item>
		<title>By: storybored</title>
		<link>http://ask.metafilter.com/36435/The-Math-of-Optimal-Shopping-Sprees#566175</link>	
		<description>Thanks for the answers everyone.  I basically took the manual approach and figured out three options on paper using a calculator.  I was curious to know if there was a website/utility that did this with minimal learning curve but after checking out the suggestions, the calculator was just plain faster.  &lt;br&gt;
&lt;br&gt;
But it was so cool to tie this to packing problems and NP completeness!  That is very neat.&lt;br&gt;
&lt;br&gt;
Frank, the coupon&apos;s only available here in Ottawa, Can. at a particular store, today.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.36435-566175</guid>
		<pubDate>Mon, 17 Apr 2006 12:07:13 -0800</pubDate>
		<dc:creator>storybored</dc:creator>
	</item>
	</channel>
</rss>
