Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jtilly committed Aug 7, 2015
1 parent b893a35 commit 0e86b8b
Showing 1 changed file with 1 addition and 49 deletions.
50 changes: 1 addition & 49 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,55 +80,7 @@ results = matchingR::one2one(proposerPref = prefM, reviewerPref = prefW)
```
The original Gale-Shapley algorithm can be easily modified to accommodate unequal numbers of participants on each side of the market as well as one-to-many matchings, i.e. the matching of workers to multi-worker firms or the matching of students to colleges.

### Examples
#### Marriage Market
The following is an example of `one2one` with different numbers of participants on each side of the market. By construction, 500 men will remain unmatched.
```{r}
# set seed
set.seed(1)
# set number of men
nmen = 2500
# set number of women
nwomen = 2000
# generate preferences
uM = matrix(runif(nmen*nwomen), nrow=nwomen, ncol=nmen)
uW = matrix(runif(nmen*nwomen), nrow=nmen, ncol=nwomen)
# male optimal matching
resultsM = matchingR::one2one(uM, uW)
# female optimal matching
resultsW = matchingR::one2one(uW, uM)
# check if matchings are stable
matchingR::checkStability(uM, uW, resultsM$proposals, resultsM$engagements)
matchingR::checkStability(uW, uM, resultsW$proposals, resultsW$engagements)
```

#### College Admissions Problem
The following is an example of `one2many` where 1,000 students get matched to 400 colleges, where each college has two slots. By construction, 200 students will remain unmatched.
```{r}
# set seed
set.seed(1)
# set number of students
nstudents = 1000
# set number of colleges
ncolleges = 400
# generate preferences
uStudents = matrix(runif(ncolleges*nstudents), nrow=ncolleges, ncol=nstudents)
uColleges = matrix(runif(nstudents*ncolleges), nrow=nstudents, ncol=ncolleges)
# worker optimal matching
results = matchingR::one2many(uStudents, uColleges, slots=2)
# check if matching is stable
matchingR::checkStability(uStudents, uColleges, results$proposals, results$engagements)
```
For additional examples, take a look at the [vignette](http://jtilly.io/matchingR/matchingR-intro.html) or at the [examples page](EXAMPLES.md).

## Irving's Stable Roommate Algorithm: How does it work?

Expand Down

0 comments on commit 0e86b8b

Please sign in to comment.