You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@systemds.apache.org by GitBox <gi...@apache.org> on 2021/06/09 12:36:59 UTC

[GitHub] [systemds] Shafaq-Siddiqi commented on a change in pull request #1306: residency hospital matching

Shafaq-Siddiqi commented on a change in pull request #1306:
URL: https://github.com/apache/systemds/pull/1306#discussion_r648258529



##########
File path: scripts/builtin/residencyMatchMain.dml
##########
@@ -0,0 +1,194 @@
+#-------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+##-------------------------------------------------------------
+# THIS SCRIPT COMPUTES A SOLUTION FOR THE HOSPITAL RESIDENCY MATCH PROBLEM
+#
+# INPUT PARAMETERS:
+# --------------------------------------------------------------------------------------------
+# NAME                  TYPE       DEFAULT      MEANING
+# --------------------------------------------------------------------------------------------
+# R                     Matrix     ---          Residents matrix R.
+#                                               It must be an ORDERED  matrix.
+#
+# H                     Matrix     ---          Hospitals matrix H.
+#                                               It must be an UnORDERED matrix.
+#
+# C                     Matrix     ---          Capacity of Hospitals matrix C.
+#                                               It must be a [c,1] matrix with non zero values.
+#                                               i.e. the leftmost value in a row is the most preferred partner's index.
+#                                               i.e. the leftmost value in a row in P is the preference value for the acceptor with index 1 and vice-versa (higher is better).
+# OUTPUT PARAMETERS:
+# --------------------------------------------------------------------------------------------
+# NAME                  TYPE       DEFAULT      MEANING
+# --------------------------------------------------------------------------------------------
+# ResidencyMatch        Matrix     ---          Result Matrix
+#                                               If cell [i,j] is non-zero, it means that Resident i has matched with Hospital j.
+#                                               Further, if cell [i,j] is non-zero, it holds the preference value that led to the match.
+#
+#
+# HospitalMatch         Matrix     ---          Result Matrix
+#                                               If cell [i,j] is non-zero, it means that Resident i has matched with Hospital j.
+#                                               Further, if cell [i,j] is non-zero, it holds the preference value that led to the match.
+#
+#
+# Residents.mtx:
+# 2.0,1.0,3.0
+# 1.0,2.0,3.0
+# 1.0,2.0,0.0
+#
+# Since it is an ORDERED  matrix, this means that Resident 1 (row 1) likes acceptor 2 the most, followed by acceptor 1 and acceptor 3.
+# If it was UNORDERED, this would mean that proposer 1 (row 1) likes acceptor 3 the most (since the value at [1,3] is the row max),
+# followed by acceptor 1 (2.0 preference value) and acceptor 2 (1.0 preference value).
+#
+# Hospitals.mtx:
+# 2.0,1.0,0.0
+# 0.0,1.0,2.0
+# 1.0,2.0,0.0
+#
+# Since it is an UNORDERED matrix this means that Hospital 1 (row 1) likes Resident 1 the most (since the value at [1,1] is the row max).
+#
+# Capacity.mtx
+# 1.0
+# 1.0
+# 1.0
+#
+# ResidencyMatch.mtx
+# 0.0,0.0,3.0
+# 1.0,0.0,0.0
+# 0.0,2.0,0.0
+#
+# HospitalMatch.mtx
+# 0.0,1.0,0.0
+# 0.0,0.0,2.0
+# 1.0,0.0,0.0
+#
+# Resident 1 has matched with Hospital 3 (since [1,3] is non-zero) at a preference level of 3.0.
+# Resident 2 has matched with Hospital 1 (since [2,1] is non-zero) at a preference level of 1.0.
+# Resident 3 has matched with Hospital 2 (since [3,2] is non-zero) at a preference level of 2.0.
+# --------------------------------------------------------------------------------------------
+m_residencyMatchMain = function(Matrix[Double] R, Matrix[Double] H,Matrix[Double] C )
+  return (Matrix[Double] ResidencyMatch)
+{
+#TODO PLEASE PAY ATTENTION
+# in this step we consider that  Residents Matrix is ORDERED   !!!!
+# in this step we consider that  Hospital  Matrix is UNORDERED !!!!
+
+print("STARTING Resident Hospital Match");
+#TODO set a finite number of maximum iterations so that the execution termiates after maximum iterations.
+
+print("\n")

Review comment:
       in DML we follow two-space indentation. Please indent this code block.

##########
File path: scripts/builtin/residencyMatchMain.dml
##########
@@ -0,0 +1,194 @@
+#-------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+##-------------------------------------------------------------
+# THIS SCRIPT COMPUTES A SOLUTION FOR THE HOSPITAL RESIDENCY MATCH PROBLEM
+#
+# INPUT PARAMETERS:
+# --------------------------------------------------------------------------------------------
+# NAME                  TYPE       DEFAULT      MEANING
+# --------------------------------------------------------------------------------------------
+# R                     Matrix     ---          Residents matrix R.
+#                                               It must be an ORDERED  matrix.
+#
+# H                     Matrix     ---          Hospitals matrix H.
+#                                               It must be an UnORDERED matrix.
+#
+# C                     Matrix     ---          Capacity of Hospitals matrix C.
+#                                               It must be a [c,1] matrix with non zero values.
+#                                               i.e. the leftmost value in a row is the most preferred partner's index.
+#                                               i.e. the leftmost value in a row in P is the preference value for the acceptor with index 1 and vice-versa (higher is better).
+# OUTPUT PARAMETERS:
+# --------------------------------------------------------------------------------------------
+# NAME                  TYPE       DEFAULT      MEANING
+# --------------------------------------------------------------------------------------------
+# ResidencyMatch        Matrix     ---          Result Matrix
+#                                               If cell [i,j] is non-zero, it means that Resident i has matched with Hospital j.
+#                                               Further, if cell [i,j] is non-zero, it holds the preference value that led to the match.
+#
+#
+# HospitalMatch         Matrix     ---          Result Matrix
+#                                               If cell [i,j] is non-zero, it means that Resident i has matched with Hospital j.
+#                                               Further, if cell [i,j] is non-zero, it holds the preference value that led to the match.
+#
+#
+# Residents.mtx:
+# 2.0,1.0,3.0
+# 1.0,2.0,3.0
+# 1.0,2.0,0.0
+#
+# Since it is an ORDERED  matrix, this means that Resident 1 (row 1) likes acceptor 2 the most, followed by acceptor 1 and acceptor 3.
+# If it was UNORDERED, this would mean that proposer 1 (row 1) likes acceptor 3 the most (since the value at [1,3] is the row max),
+# followed by acceptor 1 (2.0 preference value) and acceptor 2 (1.0 preference value).
+#
+# Hospitals.mtx:
+# 2.0,1.0,0.0
+# 0.0,1.0,2.0
+# 1.0,2.0,0.0
+#
+# Since it is an UNORDERED matrix this means that Hospital 1 (row 1) likes Resident 1 the most (since the value at [1,1] is the row max).
+#
+# Capacity.mtx
+# 1.0
+# 1.0
+# 1.0
+#
+# ResidencyMatch.mtx
+# 0.0,0.0,3.0
+# 1.0,0.0,0.0
+# 0.0,2.0,0.0
+#
+# HospitalMatch.mtx
+# 0.0,1.0,0.0
+# 0.0,0.0,2.0
+# 1.0,0.0,0.0
+#
+# Resident 1 has matched with Hospital 3 (since [1,3] is non-zero) at a preference level of 3.0.
+# Resident 2 has matched with Hospital 1 (since [2,1] is non-zero) at a preference level of 1.0.
+# Resident 3 has matched with Hospital 2 (since [3,2] is non-zero) at a preference level of 2.0.
+# --------------------------------------------------------------------------------------------
+m_residencyMatchMain = function(Matrix[Double] R, Matrix[Double] H,Matrix[Double] C )
+  return (Matrix[Double] ResidencyMatch)
+{
+#TODO PLEASE PAY ATTENTION

Review comment:
       Please explain this TODO




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org