Skip to content

[PI Sprint 24/25 / PD-468] - [Feature] Add Hungarian Algorithm #79

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

mbsaloka
Copy link

Jira Link:

https://ichiro-its.atlassian.net/browse/PD-468

Description

Hungarian algorithm implementation, used for landmark matching in likelihood calculation within the MCL algorithm.

Type of Change

  • Bugfix
  • Enhancement
  • New feature
  • Breaking change (fix or feature that would cause the existing functionality to not work as expected)

How Has This Been Tested?

  • New unit tests added.
  • Manual tested.

Checklist:

  • Using Branch Name Convention
    • feature/JIRA-ID-SHORT-DESCRIPTION if has a JIRA ticket
    • enhancement/SHORT-DESCRIPTION if has/has no JIRA ticket and contain enhancement
    • hotfix/SHORT-DESCRIPTION if the change doesn't need to be tested (urgent)
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have made the documentation for the corresponding changes.

@mbsaloka mbsaloka requested a review from threeal April 30, 2025 17:06
case 7:
for (int row = 0; row < actual_size; ++row) {
for (int col = 0; col < actual_size; ++col) {
if (mask[row][col] == 1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we create enum for these constants to give better context?

enum class Mask {
    NONE = 0,
    STAR = 1,
    PRIME = 2
};

Comment on lines 242 to 257
if (row == -1 || col == -1) {
step = 6;
return;
} else {
mask[row][col] = PRIME;
if (star_in_row(row)) {
col = find_star_in_row(row);
row_cover[row] = COVERED;
col_cover[col] = UNCOVERED;
} else {
path_row_0 = row;
path_col_0 = col;
step = 5;
return;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The else block can be removed because the if condition returns the function.

Suggested change
if (row == -1 || col == -1) {
step = 6;
return;
} else {
mask[row][col] = PRIME;
if (star_in_row(row)) {
col = find_star_in_row(row);
row_cover[row] = COVERED;
col_cover[col] = UNCOVERED;
} else {
path_row_0 = row;
path_col_0 = col;
step = 5;
return;
}
}
if (row == -1 || col == -1) {
step = 6;
return;
}
mask[row][col] = PRIME;
if (!star_in_row(row)) {
path_row_0 = row;
path_col_0 = col;
step = 5;
return;
}
col = find_star_in_row(row);
row_cover[row] = COVERED;
col_cover[col] = UNCOVERED;

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

Successfully merging this pull request may close these issues.

3 participants