4. STOR-601 - Interfacing R and C++ - Assessment#

4.1. Background#

This is the assessment for the “Interfacing R and C++” component of the STOR-601 module.

To submit the assignment, send a link to the Github repository you create for the assessment by e-mail to dan.grose@lancaster.ac.uk or use Github to send an invite to my Github account. My Github username is grosed.

The assessment should be submitted by 29/03/2024.

4.2. Task 1#

Create an R package using the Rcpp library that exposes a C++ implementation of the Fundamental Algorithm as described on page 9 of Stable Marriage and Its Relation to Other Combinatorial Problems . Your package should provide a stable_marriage function which accepts input(s) that represent the preference tables. This function should return a stable matching as defined in Stable Marriage and Its Relation to Other Combinatorial Problems.

You are free to choose how you represent the preference tables and stable matching in R.

You can use this example Rcpp package as a template if required.

Marks : [30]

4.3. Task 2#

Host the R package you created for Task 1 on a Github repository in a way that allows the package to be installed using the devtools package.

Marks : [10]

4.4. Task 3#

With reference to your this paper, rank your pseudo code and Python (from assessment 1), C++ (from assessment 2), and R package (assessment 3) in the following table.

Replicable

Reproducable

Repeatable

Rerunable

Reusable

Pseudo Code

Python

C++

R package

Use the scale 1 (best) to 4 (worst) for each characteristic and provide a short explanation as to how you arrived at your ranking for each characteristic.

Add your table and explanations to your Github repository using a jupyter notebook.

Marks : [20]

4.5. Task 4#

Bonus marks

Add extra functions / functionality to your package (or both) to assist with pre and post processing of the input and output data of the stable_marriage function. Some examples of what you might provide are (but not limited to) :

  • Add capability to the stable_marriage function so it accepts different types of data structure as input

  • Error checking within the stable_marriage function.

  • A random perturbation of the structure of the preference tables (why might this be interesting ?)

Bonus marks can also be obtained for adding supporting material to your Github repository. For example,

  • A README.rd giving instructions on how to use install and use the package

  • A jupyter notebook with examples of the package being used.

Marks : [40]