Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

step 3 should count number of covered columns #16

Closed
kylemcdonald opened this issue Jan 1, 2017 · 0 comments
Closed

step 3 should count number of covered columns #16

kylemcdonald opened this issue Jan 1, 2017 · 0 comments

Comments

@kylemcdonald
Copy link
Contributor

kylemcdonald commented Jan 1, 2017

these lines https://github.com/bmc/munkres/blob/master/munkres.py#L463-L465 read:

if self.marked[i][j] == 1:
    self.col_covered[j] = True
    count += 1

but in the tutorial that this was based on, the count is based on the total number of covered columns:

for i in 1..n loop 
  for j in 1..n loop 
    if M(i,j)=1 then 
      C_cov(j):=1; 
    end if; 
  end loop; 
end loop; 
count:=0; 
for j in 1..n loop 
  count:=count + C_cov(j); 
end loop; 

to fix this, i suggest adding a condition and not self.col_covered[j] like this:

if self.marked[i][j] == 1 and not self.col_covered[j]:
    self.col_covered[j] = True
    count += 1
@kylemcdonald kylemcdonald changed the title step 3 should could count number of covered columns step 3 should count number of covered columns Jan 1, 2017
kylemcdonald added a commit to kylemcdonald/munkres that referenced this issue Jan 1, 2017
@bmc bmc closed this as completed in 76ea3fa Jan 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant