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

galeShapley.collegeAdmissions() does not work properly when slots vector includes zero #48

Open
xerroxcopy opened this issue Feb 26, 2023 · 0 comments

Comments

@xerroxcopy
Copy link

xerroxcopy commented Feb 26, 2023

I would like to set slots for some of the colleges zero, such as this:

studentPref <-
  matrix(data = c(1,2,3,4,1,2,3,4,1,2,3,4), nrow = 4)
collegePref <-
  matrix(data = c(1,2,3,1,2,3,1,2,3,1,2,3), nrow = 3)


galeShapley.collegeAdmissions(
  studentPref = studentPref,
  collegePref = collegePref,
  slots = c(1,2,0,0))

which returns

$matched.colleges
$matched.colleges[[1]]
[1] 1

$matched.colleges[[2]]
[1] 2 3

$matched.colleges[[3]]
[1] NA  3

$matched.colleges[[4]]
[1] NA  3


$matched.students
     [,1]
[1,]    1
[2,]    2
[3,]    4

I believe $matched.colleges[[3]], $matched.colleges[[4]] (both should be empty) as well as $matched.students[3,1] (should be 2) are wrong but I may be doing this wrong.
Setting slots = c(1,2,3,0) in the above example kind of works as expected, except for $matched.colleges[[4]] which should be empty instead of c(NA, NA).

Is it even possible to have zeros as elements of slots vector?

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