<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Hungarian Algorithm in C#</title>
	<atom:link href="http://blog.noldorin.com/2009/09/hungarian-algorithm-in-csharp/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.noldorin.com/2009/09/hungarian-algorithm-in-csharp/</link>
	<description>Musings on science, technology, philosophy, and the many wonders of life</description>
	<lastBuildDate>Fri, 03 Sep 2010 16:40:01 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Bruce</title>
		<link>http://blog.noldorin.com/2009/09/hungarian-algorithm-in-csharp/comment-page-1/#comment-323</link>
		<dc:creator>Bruce</dc:creator>
		<pubDate>Sun, 27 Dec 2009 18:08:28 +0000</pubDate>
		<guid isPermaLink="false">http://noldorin.com/blog/?p=289#comment-323</guid>
		<description>Found my bug... i&#039;m porting to VB, using cols 0-4 and rows 0-4 for a 5x5 matrix.  I needed to init colsCoveredCount=-1 in Step 1 instead, and I&#039;m all good.

Question: why the difference in your code vs. the Ada version for ConvertPath?  You perform an additional test for masks==2, whereas the Ada code doesn&#039;t.   Bug in the Ada code? 

I&#039;m also a little fuzzy on this C# code (in FindAssignment):
        var path = new Location[w * h];
        Location pathStart = default(Location);
Assuming a 5x5 matrix, this code creates 25 instances of Location, all inited to (row,col)=(-1,-1) with Pathstart is initially nil.  That&#039;s how I&#039;ve recoded it.</description>
		<content:encoded><![CDATA[<p>Found my bug&#8230; i&#8217;m porting to VB, using cols 0-4 and rows 0-4 for a 5&#215;5 matrix.  I needed to init colsCoveredCount=-1 in Step 1 instead, and I&#8217;m all good.</p>
<p>Question: why the difference in your code vs. the Ada version for ConvertPath?  You perform an additional test for masks==2, whereas the Ada code doesn&#8217;t.   Bug in the Ada code? </p>
<p>I&#8217;m also a little fuzzy on this C# code (in FindAssignment):<br />
        var path = new Location[w * h];<br />
        Location pathStart = default(Location);<br />
Assuming a 5&#215;5 matrix, this code creates 25 instances of Location, all inited to (row,col)=(-1,-1) with Pathstart is initially nil.  That&#8217;s how I&#8217;ve recoded it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Noldorin</title>
		<link>http://blog.noldorin.com/2009/09/hungarian-algorithm-in-csharp/comment-page-1/#comment-322</link>
		<dc:creator>Noldorin</dc:creator>
		<pubDate>Sun, 27 Dec 2009 12:53:09 +0000</pubDate>
		<guid isPermaLink="false">http://noldorin.com/blog/?p=289#comment-322</guid>
		<description>Hi Bruce,

That&#039;s odd that you&#039;re getting a resulting vector of {2,4,3,0,1}, as I just ran the latest version of the code and it returned {2,4,0,3,1}, which is correct as you say. If you could download the latest algorithm code via the link in the original post (it is now fixed) and let me know if the problem is persisting, that would be helpful.

In case there&#039;s any confusion over how to use it, this is my brief test code:

[csharp]
var costs = new int[,]
    {
        {7,2,1,9,4},
        {9,6,9,6,5},
        {3,8,3,1,8},
        {7,9,4,2,2},
        {8,4,7,4,8},
    };
var result = costs.FindAssignments(); // returns {2,4,3,0,1}
[/csharp]

Hope that resolves the matter for you.</description>
		<content:encoded><![CDATA[<p>Hi Bruce,</p>
<p>That&#8217;s odd that you&#8217;re getting a resulting vector of {2,4,3,0,1}, as I just ran the latest version of the code and it returned {2,4,0,3,1}, which is correct as you say. If you could download the latest algorithm code via the link in the original post (it is now fixed) and let me know if the problem is persisting, that would be helpful.</p>
<p>In case there&#8217;s any confusion over how to use it, this is my brief test code:</p>
<pre class="brush: csharp;">
var costs = new int[,]
    {
        {7,2,1,9,4},
        {9,6,9,6,5},
        {3,8,3,1,8},
        {7,9,4,2,2},
        {8,4,7,4,8},
    };
var result = costs.FindAssignments(); // returns {2,4,3,0,1}
</pre>
<p>Hope that resolves the matter for you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bruce</title>
		<link>http://blog.noldorin.com/2009/09/hungarian-algorithm-in-csharp/comment-page-1/#comment-321</link>
		<dc:creator>Bruce</dc:creator>
		<pubDate>Sun, 27 Dec 2009 06:59:37 +0000</pubDate>
		<guid isPermaLink="false">http://noldorin.com/blog/?p=289#comment-321</guid>
		<description>I&#039;m having problems with this 5x5 matrix:
7,2,1,9,4
9,6,9,6,5
3,8,3,1,8
7,9,4,2,2
8,4,7,4,8

giving an incorrect cost of 18 (ie. agentstasks={2,4,3,0,1}) when it should be 15={2,4,0,3,1}. 

ref: Papadimitriou (ISBN 0-486-40258-4), p. 255.

In Papadimitrou, row 2 is {9,6,9,5,5}.  Nodorin... your alg produces a matching sum=15 via {2,3,0,4,1} instead.  This is good.  

I then altered the costs in row 2 to be {9,6,9,6,5} instead which should force the {2,4,0,3,1}=15 answer but instead it gives the incorrect {2,4,3,0,1}=18 answer.

Awesome work, though... thanks for all the effort on this!</description>
		<content:encoded><![CDATA[<p>I&#8217;m having problems with this 5&#215;5 matrix:<br />
7,2,1,9,4<br />
9,6,9,6,5<br />
3,8,3,1,8<br />
7,9,4,2,2<br />
8,4,7,4,8</p>
<p>giving an incorrect cost of 18 (ie. agentstasks={2,4,3,0,1}) when it should be 15={2,4,0,3,1}. </p>
<p>ref: Papadimitriou (ISBN 0-486-40258-4), p. 255.</p>
<p>In Papadimitrou, row 2 is {9,6,9,5,5}.  Nodorin&#8230; your alg produces a matching sum=15 via {2,3,0,4,1} instead.  This is good.  </p>
<p>I then altered the costs in row 2 to be {9,6,9,6,5} instead which should force the {2,4,0,3,1}=15 answer but instead it gives the incorrect {2,4,3,0,1}=18 answer.</p>
<p>Awesome work, though&#8230; thanks for all the effort on this!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin</title>
		<link>http://blog.noldorin.com/2009/09/hungarian-algorithm-in-csharp/comment-page-1/#comment-288</link>
		<dc:creator>Martin</dc:creator>
		<pubDate>Wed, 09 Dec 2009 22:24:32 +0000</pubDate>
		<guid isPermaLink="false">http://noldorin.com/blog/?p=289#comment-288</guid>
		<description>This is great!

Thank you for a great work. Got it working right away

Regards Martin</description>
		<content:encoded><![CDATA[<p>This is great!</p>
<p>Thank you for a great work. Got it working right away</p>
<p>Regards Martin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mauro</title>
		<link>http://blog.noldorin.com/2009/09/hungarian-algorithm-in-csharp/comment-page-1/#comment-287</link>
		<dc:creator>Mauro</dc:creator>
		<pubDate>Wed, 09 Dec 2009 16:39:21 +0000</pubDate>
		<guid isPermaLink="false">http://noldorin.com/blog/?p=289#comment-287</guid>
		<description>Thanks Noldorin!</description>
		<content:encoded><![CDATA[<p>Thanks Noldorin!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Noldorin</title>
		<link>http://blog.noldorin.com/2009/09/hungarian-algorithm-in-csharp/comment-page-1/#comment-286</link>
		<dc:creator>Noldorin</dc:creator>
		<pubDate>Wed, 09 Dec 2009 15:33:47 +0000</pubDate>
		<guid isPermaLink="false">http://noldorin.com/blog/?p=289#comment-286</guid>
		<description>Hi all,

Apologies for the file being down at the moment. There have been some problems with the server - I&#039;ll try to get it up shortly. In the meanwhile, you can view the code at http://pastebin.ca/1708378.</description>
		<content:encoded><![CDATA[<p>Hi all,</p>
<p>Apologies for the file being down at the moment. There have been some problems with the server &#8211; I&#8217;ll try to get it up shortly. In the meanwhile, you can view the code at <a href="http://pastebin.ca/1708378" rel="nofollow" onclick="pageTracker._trackPageview('/outgoing/pastebin.ca/1708378?referer=');">http://pastebin.ca/1708378</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mauro</title>
		<link>http://blog.noldorin.com/2009/09/hungarian-algorithm-in-csharp/comment-page-1/#comment-285</link>
		<dc:creator>Mauro</dc:creator>
		<pubDate>Wed, 09 Dec 2009 15:24:53 +0000</pubDate>
		<guid isPermaLink="false">http://noldorin.com/blog/?p=289#comment-285</guid>
		<description>Hi Noldorin,
I get the following error when I try to get the .cs file:

HTTP Error 404.7 - Not Found
The request filtering module is configured to deny the file extension.

Mauro</description>
		<content:encoded><![CDATA[<p>Hi Noldorin,<br />
I get the following error when I try to get the .cs file:</p>
<p>HTTP Error 404.7 &#8211; Not Found<br />
The request filtering module is configured to deny the file extension.</p>
<p>Mauro</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin</title>
		<link>http://blog.noldorin.com/2009/09/hungarian-algorithm-in-csharp/comment-page-1/#comment-284</link>
		<dc:creator>Martin</dc:creator>
		<pubDate>Wed, 09 Dec 2009 15:01:11 +0000</pubDate>
		<guid isPermaLink="false">http://noldorin.com/blog/?p=289#comment-284</guid>
		<description>Hi Noldorin.
I&#039;m having trouble downloading your cs file from http://noldorin.com/programming/HungarianAlgorithm.cs

I get the message:
HTTP Error 404.7 - Not Found. The request filtering module is configured to deny the file extension
Can you fix it or is there a mirror somewhere?

Best regards Martin</description>
		<content:encoded><![CDATA[<p>Hi Noldorin.<br />
I&#8217;m having trouble downloading your cs file from <a href="http://noldorin.com/programming/HungarianAlgorithm.cs" rel="nofollow" onclick="pageTracker._trackPageview('/outgoing/noldorin.com/programming/HungarianAlgorithm.cs?referer=');">http://noldorin.com/programming/HungarianAlgorithm.cs</a></p>
<p>I get the message:<br />
HTTP Error 404.7 &#8211; Not Found. The request filtering module is configured to deny the file extension<br />
Can you fix it or is there a mirror somewhere?</p>
<p>Best regards Martin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gelder</title>
		<link>http://blog.noldorin.com/2009/09/hungarian-algorithm-in-csharp/comment-page-1/#comment-239</link>
		<dc:creator>gelder</dc:creator>
		<pubDate>Tue, 10 Nov 2009 08:52:02 +0000</pubDate>
		<guid isPermaLink="false">http://noldorin.com/blog/?p=289#comment-239</guid>
		<description>Hi,
just a quick update: It works fine with matrices like the one above, if you make them square yourself!

gelder</description>
		<content:encoded><![CDATA[<p>Hi,<br />
just a quick update: It works fine with matrices like the one above, if you make them square yourself!</p>
<p>gelder</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gelder</title>
		<link>http://blog.noldorin.com/2009/09/hungarian-algorithm-in-csharp/comment-page-1/#comment-232</link>
		<dc:creator>gelder</dc:creator>
		<pubDate>Mon, 26 Oct 2009 16:23:11 +0000</pubDate>
		<guid isPermaLink="false">http://noldorin.com/blog/?p=289#comment-232</guid>
		<description>Hi,
I came across another type of matrices, that doesn&#039;t work. This time it might be because of a faulty use - a job is not connected to the workers.
A matrix like this produces looping between Step 2 and Step 4:

int[,] values=new int[6,5];
            values[0, 0] = 1;
            values[0, 1] = 0;
            values[0, 2] = 0;
            values[0, 3] = 0;
            values[0, 4] = 0;
            values[1, 0] = 0;
            values[1, 1] = 2;
            values[1, 2] = 0;
            values[1, 3] = 0;
            values[1, 4] = 0;
            values[2, 0] = 0;
            values[2, 1] = 0;
            values[2, 2] = 0;
            values[2, 3] = 0;
            values[2, 4] = 0;
            values[3, 0] = 0;
            values[3, 1] = 3;
            values[3, 2] = 0;
            values[3, 3] = 0;
            values[3, 4] = 0;
            values[4, 0] = 3;
            values[4, 1] = 0;
            values[4, 2] = 0;
            values[4, 3] = 0;
            values[4, 4] = 0;
            values[5, 0] = 0;
            values[5, 1] = 0;
            values[5, 2] = 0;
            values[5, 3] = 3;
            values[5, 4] = 0;

Is this still a bug in the algorithm or should I just try to avoid using matrices like this?
Thanks, gelder</description>
		<content:encoded><![CDATA[<p>Hi,<br />
I came across another type of matrices, that doesn&#8217;t work. This time it might be because of a faulty use &#8211; a job is not connected to the workers.<br />
A matrix like this produces looping between Step 2 and Step 4:</p>
<p>int[,] values=new int[6,5];<br />
            values[0, 0] = 1;<br />
            values[0, 1] = 0;<br />
            values[0, 2] = 0;<br />
            values[0, 3] = 0;<br />
            values[0, 4] = 0;<br />
            values[1, 0] = 0;<br />
            values[1, 1] = 2;<br />
            values[1, 2] = 0;<br />
            values[1, 3] = 0;<br />
            values[1, 4] = 0;<br />
            values[2, 0] = 0;<br />
            values[2, 1] = 0;<br />
            values[2, 2] = 0;<br />
            values[2, 3] = 0;<br />
            values[2, 4] = 0;<br />
            values[3, 0] = 0;<br />
            values[3, 1] = 3;<br />
            values[3, 2] = 0;<br />
            values[3, 3] = 0;<br />
            values[3, 4] = 0;<br />
            values[4, 0] = 3;<br />
            values[4, 1] = 0;<br />
            values[4, 2] = 0;<br />
            values[4, 3] = 0;<br />
            values[4, 4] = 0;<br />
            values[5, 0] = 0;<br />
            values[5, 1] = 0;<br />
            values[5, 2] = 0;<br />
            values[5, 3] = 3;<br />
            values[5, 4] = 0;</p>
<p>Is this still a bug in the algorithm or should I just try to avoid using matrices like this?<br />
Thanks, gelder</p>
]]></content:encoded>
	</item>
</channel>
</rss>
