<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/246652</link>
    <title>MATLAB Central Newsreader - Simple Optimization Problem</title>
    <description>Feed for thread: Simple Optimization Problem</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Sat, 14 Mar 2009 03:33:01 -0400</pubDate>
      <title>Simple Optimization Problem</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/246652#634787</link>
      <author>Neal Gordon</author>
      <description>OK, here is my question. A simple example: Say you have 4 people who each spend a certain amount. &lt;br&gt;
Bob - $50&lt;br&gt;
Tim - $5&lt;br&gt;
Sal - $95&lt;br&gt;
Jon - $200&lt;br&gt;
Together they spent $350, so thats an average of $87.5/person. &lt;br&gt;
Find a solution to minimize the number of transactions between the people so that everyone has spent the same amount.&lt;br&gt;
&lt;br&gt;
example solution&lt;br&gt;
Tim pays Jon $82.5&lt;br&gt;
Bob pays Jon $30&lt;br&gt;
Bob pays Sal $7.5&lt;br&gt;
&lt;br&gt;
Thanks.&lt;br&gt;
-Neal</description>
    </item>
    <item>
      <pubDate>Sat, 14 Mar 2009 03:39:34 -0400</pubDate>
      <title>Re: Simple Optimization Problem</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/246652#634790</link>
      <author>ImageAnalyst</author>
      <description>On Mar 13, 11:33=A0pm, &quot;Neal Gordon&quot; &amp;lt;gordon....@osu.edu&amp;gt; wrote:&lt;br&gt;
&amp;gt; OK, here is my question. A simple example: Say you have 4 people who each=&lt;br&gt;
&amp;nbsp;spend a certain amount.&lt;br&gt;
&amp;gt; Bob - $50&lt;br&gt;
&amp;gt; Tim - $5&lt;br&gt;
&amp;gt; Sal - $95&lt;br&gt;
&amp;gt; Jon - $200&lt;br&gt;
&amp;gt; Together they spent $350, so thats an average of $87.5/person.&lt;br&gt;
&amp;gt; Find a solution to minimize the number of transactions between the people=&lt;br&gt;
&amp;nbsp;so that everyone has spent the same amount.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; example solution&lt;br&gt;
&amp;gt; Tim pays Jon $82.5&lt;br&gt;
&amp;gt; Bob pays Jon $30&lt;br&gt;
&amp;gt; Bob pays Sal $7.5&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Thanks.&lt;br&gt;
&amp;gt; -Neal&lt;br&gt;
---------------------------------------------------------------------------=&lt;br&gt;
------------------&lt;br&gt;
I don't understand.  If Tim pays $5 total, or even $5 per transaction,&lt;br&gt;
then how can he spend $82.5 which is not a multiple of $5?  And in&lt;br&gt;
your example solution, not everybody has paid the same amount.  Tim&lt;br&gt;
paid $82.50, Bob paid $37.50, and Jon and Sal didn't pay(spend)&lt;br&gt;
anything.  Are you sure you're explaining this correctly?</description>
    </item>
    <item>
      <pubDate>Sat, 14 Mar 2009 04:08:01 -0400</pubDate>
      <title>Re: Simple Optimization Problem</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/246652#634795</link>
      <author>Neal Gordon</author>
      <description>ImageAnalyst &amp;lt;imageanalyst@mailinator.com&amp;gt; wrote in message &amp;lt;84a25b13-1e98-4886-bfa2-f1454477e057@l39g2000yqn.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; On Mar 13, 11:33=A0pm, &quot;Neal Gordon&quot; &amp;lt;gordon....@osu.edu&amp;gt; wrote:&lt;br&gt;
&amp;gt; &amp;gt; OK, here is my question. A simple example: Say you have 4 people who each=&lt;br&gt;
&amp;gt;  spend a certain amount.&lt;br&gt;
&amp;gt; &amp;gt; Bob - $50&lt;br&gt;
&amp;gt; &amp;gt; Tim - $5&lt;br&gt;
&amp;gt; &amp;gt; Sal - $95&lt;br&gt;
&amp;gt; &amp;gt; Jon - $200&lt;br&gt;
&amp;gt; &amp;gt; Together they spent $350, so thats an average of $87.5/person.&lt;br&gt;
&amp;gt; &amp;gt; Find a solution to minimize the number of transactions between the people=&lt;br&gt;
&amp;gt;  so that everyone has spent the same amount.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; example solution&lt;br&gt;
&amp;gt; &amp;gt; Tim pays Jon $82.5&lt;br&gt;
&amp;gt; &amp;gt; Bob pays Jon $30&lt;br&gt;
&amp;gt; &amp;gt; Bob pays Sal $7.5&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Thanks.&lt;br&gt;
&amp;gt; &amp;gt; -Neal&lt;br&gt;
&amp;gt; ---------------------------------------------------------------------------=&lt;br&gt;
&amp;gt; ------------------&lt;br&gt;
&amp;gt; I don't understand.  If Tim pays $5 total, or even $5 per transaction,&lt;br&gt;
&amp;gt; then how can he spend $82.5 which is not a multiple of $5?  And in&lt;br&gt;
&amp;gt; your example solution, not everybody has paid the same amount.  Tim&lt;br&gt;
&amp;gt; paid $82.50, Bob paid $37.50, and Jon and Sal didn't pay(spend)&lt;br&gt;
&amp;gt; anything.  Are you sure you're explaining this correctly?&lt;br&gt;
&lt;br&gt;
Original amount spent:&lt;br&gt;
Bob - $50&lt;br&gt;
Tim - $5&lt;br&gt;
Sal - $95&lt;br&gt;
Jon - $200&lt;br&gt;
Together, as a group, they spent $350 = 50+5+95+200, so thats an average of $87.5/person.&lt;br&gt;
&lt;br&gt;
So, to clarify, we would like to find the quickest way for everyone in the group to have spent the same amount overall. Now, I will show the iterations with the current amount spent per person.&lt;br&gt;
--iteration 0--&lt;br&gt;
Bob : $50&lt;br&gt;
Tim : $5&lt;br&gt;
Sal : $95&lt;br&gt;
Jon : $200&lt;br&gt;
&lt;br&gt;
--iteration 1--Tim pays Jon $82.5--&lt;br&gt;
Bob : $50&lt;br&gt;
Tim : $5 + $82.5 = $87.5&lt;br&gt;
Sal : $95&lt;br&gt;
Jon : $200 - $82.5 = $117.5&lt;br&gt;
&lt;br&gt;
iteration 2--Bob pays Jon $30--&lt;br&gt;
Bob : $50 + $30 = $80&lt;br&gt;
Tim : $87.5&lt;br&gt;
Sal : $95&lt;br&gt;
Jon : $117.5 - $30 = $87.5&lt;br&gt;
&lt;br&gt;
iteration 3--Bob pays Sal $7.5--&lt;br&gt;
Bob :  $80 + $7.5 = $87.5&lt;br&gt;
Tim : $87.5&lt;br&gt;
Sal : $95 - $7.5 = $87.5&lt;br&gt;
Jon :  $87.5&lt;br&gt;
&lt;br&gt;
final spending with 3 iterations(transactions):&lt;br&gt;
Bob : $87.5&lt;br&gt;
Tim : $87.5&lt;br&gt;
Sal  : $87.5&lt;br&gt;
Jon : $87.5&lt;br&gt;
&lt;br&gt;
I hope this helps. This solution is trivial, but I am interested in the solution of 15+ people while trying to achieve less iterations than the &quot;Number of people minus 1&quot;, which in this case is 3 obvious iterations.</description>
    </item>
    <item>
      <pubDate>Sun, 06 Mar 2011 18:30:12 -0500</pubDate>
      <title>Re: Simple Optimization Problem</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/246652#823422</link>
      <author>David Vavra</author>
      <description>Hi,&lt;br&gt;
I'm solving the exact problem. Did you solve it eventually?&lt;br&gt;
&lt;br&gt;
What I plan to do: &lt;br&gt;
- use TORSCHE toolbox for Matlab, which has support for Integer Linear Programming&lt;br&gt;
- define problem using ILP, where I introduce new binary variable which will say who did send money to who - will be used for counting transactions&lt;br&gt;
- set criteria to minimizing number of transactions&lt;br&gt;
&lt;br&gt;
Do you have some other suggestions?&lt;br&gt;
&lt;br&gt;
David Vavra&lt;br&gt;
&lt;br&gt;
&quot;Neal Gordon&quot; &amp;lt;gordon.363@osu.edu&amp;gt; wrote in message &amp;lt;gpfaj1$im7$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; ImageAnalyst &amp;lt;imageanalyst@mailinator.com&amp;gt; wrote in message &amp;lt;84a25b13-1e98-4886-bfa2-f1454477e057@l39g2000yqn.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; On Mar 13, 11:33=A0pm, &quot;Neal Gordon&quot; &amp;lt;gordon....@osu.edu&amp;gt; wrote:&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; OK, here is my question. A simple example: Say you have 4 people who each=&lt;br&gt;
&amp;gt; &amp;gt;  spend a certain amount.&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Bob - $50&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Tim - $5&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Sal - $95&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Jon - $200&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Together they spent $350, so thats an average of $87.5/person.&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Find a solution to minimize the number of transactions between the people=&lt;br&gt;
&amp;gt; &amp;gt;  so that everyone has spent the same amount.&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; example solution&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Tim pays Jon $82.5&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Bob pays Jon $30&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Bob pays Sal $7.5&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Thanks.&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; -Neal&lt;br&gt;
&amp;gt; &amp;gt; ---------------------------------------------------------------------------=&lt;br&gt;
&amp;gt; &amp;gt; ------------------&lt;br&gt;
&amp;gt; &amp;gt; I don't understand.  If Tim pays $5 total, or even $5 per transaction,&lt;br&gt;
&amp;gt; &amp;gt; then how can he spend $82.5 which is not a multiple of $5?  And in&lt;br&gt;
&amp;gt; &amp;gt; your example solution, not everybody has paid the same amount.  Tim&lt;br&gt;
&amp;gt; &amp;gt; paid $82.50, Bob paid $37.50, and Jon and Sal didn't pay(spend)&lt;br&gt;
&amp;gt; &amp;gt; anything.  Are you sure you're explaining this correctly?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Original amount spent:&lt;br&gt;
&amp;gt; Bob - $50&lt;br&gt;
&amp;gt; Tim - $5&lt;br&gt;
&amp;gt; Sal - $95&lt;br&gt;
&amp;gt; Jon - $200&lt;br&gt;
&amp;gt; Together, as a group, they spent $350 = 50+5+95+200, so thats an average of $87.5/person.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; So, to clarify, we would like to find the quickest way for everyone in the group to have spent the same amount overall. Now, I will show the iterations with the current amount spent per person.&lt;br&gt;
&amp;gt; --iteration 0--&lt;br&gt;
&amp;gt; Bob : $50&lt;br&gt;
&amp;gt; Tim : $5&lt;br&gt;
&amp;gt; Sal : $95&lt;br&gt;
&amp;gt; Jon : $200&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; --iteration 1--Tim pays Jon $82.5--&lt;br&gt;
&amp;gt; Bob : $50&lt;br&gt;
&amp;gt; Tim : $5 + $82.5 = $87.5&lt;br&gt;
&amp;gt; Sal : $95&lt;br&gt;
&amp;gt; Jon : $200 - $82.5 = $117.5&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; iteration 2--Bob pays Jon $30--&lt;br&gt;
&amp;gt; Bob : $50 + $30 = $80&lt;br&gt;
&amp;gt; Tim : $87.5&lt;br&gt;
&amp;gt; Sal : $95&lt;br&gt;
&amp;gt; Jon : $117.5 - $30 = $87.5&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; iteration 3--Bob pays Sal $7.5--&lt;br&gt;
&amp;gt; Bob :  $80 + $7.5 = $87.5&lt;br&gt;
&amp;gt; Tim : $87.5&lt;br&gt;
&amp;gt; Sal : $95 - $7.5 = $87.5&lt;br&gt;
&amp;gt; Jon :  $87.5&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; final spending with 3 iterations(transactions):&lt;br&gt;
&amp;gt; Bob : $87.5&lt;br&gt;
&amp;gt; Tim : $87.5&lt;br&gt;
&amp;gt; Sal  : $87.5&lt;br&gt;
&amp;gt; Jon : $87.5&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I hope this helps. This solution is trivial, but I am interested in the solution of 15+ people while trying to achieve less iterations than the &quot;Number of people minus 1&quot;, which in this case is 3 obvious iterations.</description>
    </item>
  </channel>
</rss>

