Skip to content

residency hospital matching#1306

Closed
atefeh-asayesh wants to merge 3 commits intoapache:masterfrom
atefeh-asayesh:ResHosMatch
Closed

residency hospital matching#1306
atefeh-asayesh wants to merge 3 commits intoapache:masterfrom
atefeh-asayesh:ResHosMatch

Conversation

@atefeh-asayesh
Copy link
Copy Markdown
Contributor

residencymatch.dml
residencyMatchMain.dml
BuiltinResidencyMatchTest.java
Builtins.java

atefeh-asayesh and others added 3 commits June 9, 2021 00:14
Signed-off-by: Atefeh Asayesh <atefeh.asayesh@gmail.com>
Copy link
Copy Markdown
Contributor Author

@atefeh-asayesh atefeh-asayesh left a comment

Choose a reason for hiding this comment

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

Four files have been updated.

print("STARTING Resident Hospital Match");
#TODO set a finite number of maximum iterations so that the execution termiates after maximum iterations.

print("\n")
Copy link
Copy Markdown
Contributor

@Shafaq-Siddiqi Shafaq-Siddiqi Jun 9, 2021

Choose a reason for hiding this comment

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

in DML we follow two-space indentation. Please indent the code inside the function body.

m_residencyMatchMain = function(Matrix[Double] R, Matrix[Double] H,Matrix[Double] C )
return (Matrix[Double] ResidencyMatch)
{
#TODO PLEASE PAY ATTENTION
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please explain this TODO

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

print("READING R as residents AND H as Hospitals and also C as capacity...");

m = nrow(R)
n = ncol (R)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

remove the space and make it ncol(R)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.


m = nrow(R)
n = ncol (R)
Capacityrows = nrow(C)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

just to follow the consistent naming conventions please start the variable name with a lower-case.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

prevIndex_Residents_vector = rowIndexMax(HospitalMatch)
if (as.scalar(HIndex[i]) != 0 ){

HosValue = as.scalar (H[as.scalar (HIndex[i]),i])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

remove unnecessary space after as.scalar

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

m = nrow(R)
n = ncol (R)
Capacityrows = nrow(C)
#######################################################################################################
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

simplify the comments please do not use unnecessary "#" and "--" as it makes it difficult to read the code.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

while (as.scalar (StarM[i]) == 1) {
SecondIndex = as.scalar (proposer_pointers[i])
HIndex[i] = as.scalar (R[i,SecondIndex])
prev_Residents_vector = rowMaxs(HospitalMatch) # we consider if the preference value is 1 it means it is the first selection of that hospital, the minimum value means most preference.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please set a line-width/margin to 80 - 100 characters in your editor to break long lines.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

H = read($2)
C = read($3)
alg = $4
if( alg == "residencymatch" )
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

please remove this condition as you have only one algorithm to match.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

C = read($3)
alg = $4
if( alg == "residencymatch" )
[Out] = residencyMatchMain(R=R,H=H,C=C)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

please remove the square brackets as the function only return a single output, not a list.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

addTestConfiguration(TEST_NAME,new TestConfiguration(TEST_CLASS_DIR, TEST_NAME,new String[]{"SM"}));
}
@Test
public void testResidencyMatchTest() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please add more tests with different input matrices as we have done in stable marriage test. Also, add tests for single node and spark execution contexts.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also, please do not delete the license files.


public enum Builtins {
//builtin functions
ABSTAIN("abstain", true),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do not delete the existing entries from the file.

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.

2 participants