residency hospital matching#1306
residency hospital matching#1306atefeh-asayesh wants to merge 3 commits intoapache:masterfrom atefeh-asayesh:ResHosMatch
Conversation
Signed-off-by: Atefeh Asayesh <atefeh.asayesh@gmail.com>
atefeh-asayesh
left a comment
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Please explain this TODO
| print("READING R as residents AND H as Hospitals and also C as capacity..."); | ||
|
|
||
| m = nrow(R) | ||
| n = ncol (R) |
There was a problem hiding this comment.
remove the space and make it ncol(R)
|
|
||
| m = nrow(R) | ||
| n = ncol (R) | ||
| Capacityrows = nrow(C) |
There was a problem hiding this comment.
just to follow the consistent naming conventions please start the variable name with a lower-case.
| prevIndex_Residents_vector = rowIndexMax(HospitalMatch) | ||
| if (as.scalar(HIndex[i]) != 0 ){ | ||
|
|
||
| HosValue = as.scalar (H[as.scalar (HIndex[i]),i]) |
There was a problem hiding this comment.
remove unnecessary space after as.scalar
| m = nrow(R) | ||
| n = ncol (R) | ||
| Capacityrows = nrow(C) | ||
| ####################################################################################################### |
There was a problem hiding this comment.
simplify the comments please do not use unnecessary "#" and "--" as it makes it difficult to read the code.
| 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. |
There was a problem hiding this comment.
Please set a line-width/margin to 80 - 100 characters in your editor to break long lines.
| H = read($2) | ||
| C = read($3) | ||
| alg = $4 | ||
| if( alg == "residencymatch" ) |
There was a problem hiding this comment.
please remove this condition as you have only one algorithm to match.
| C = read($3) | ||
| alg = $4 | ||
| if( alg == "residencymatch" ) | ||
| [Out] = residencyMatchMain(R=R,H=H,C=C) |
There was a problem hiding this comment.
please remove the square brackets as the function only return a single output, not a list.
| addTestConfiguration(TEST_NAME,new TestConfiguration(TEST_CLASS_DIR, TEST_NAME,new String[]{"SM"})); | ||
| } | ||
| @Test | ||
| public void testResidencyMatchTest() { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Also, please do not delete the license files.
|
|
||
| public enum Builtins { | ||
| //builtin functions | ||
| ABSTAIN("abstain", true), |
There was a problem hiding this comment.
Do not delete the existing entries from the file.
residencymatch.dml
residencyMatchMain.dml
BuiltinResidencyMatchTest.java
Builtins.java