Skip to content

mariateodorapopescu/stable_marriage_problem_racket

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stable Marriage Problem in Racket

Solve the age-old puzzle of stable marriages with elegance and efficiency using our Racket implementation. Whether you're fascinated by algorithms or simply curious about creating harmonious unions, this program is for you!

About the Stable Marriage Problem

The Stable Marriage Problem (SMP) involves matching an equal number of men and women based on their ranked preferences, ensuring that there are no unstable pairs – where a man and a woman prefer each other over their current partners.

Features

  • Intuitive Representation: SMP instances are modeled as dynamic preference lists for both men and women.
  • Algorithm Implementation: Leverage the Gale-Shapley algorithm to find stable marriages efficiently.
  • Dynamic Preferences: Handle changes in preferences over time with our innovative approach.
  • Functional Programming: Embrace the power of functional programming with Racket's expressive syntax.

Getting Started

  1. Clone the repository: git clone https://github.com/mariateodorapopescu/stable_marriage_problem_racket.git
  2. Run the program: racket main.rkt

Usage

  1. Define your initial preferences in men-preferences-0 and women-preferences-0.
  2. Update preferences for the next time interval in men-preferences-1 and women-preferences-1.
  3. Run the program to find stable marriages over time!

Functions

  • get-men: Retrieve the list of all men in the problem.
  • get-women: Get the list of all women in the problem.
  • get-pref-list: Obtain the preference list of a specific person.
  • preferable?: Check if one person is preferable to another.
  • get-partner: Find the partner of a specific person.
  • better-match-exists?: Determine if a better match exists for a person.
  • stable-match?: Check if a set of marriages is stable.
  • engage: Engage men with women using the Gale-Shapley algorithm.
  • gale-shapley: Execute the Gale-Shapley algorithm for stable marriages.
  • get-couple-members: Extract individual members from a list of couples.

Contribute

Feel free to contribute by opening issues or submitting pull requests. Suggestions are always welcome!

About

This concise yet powerful implementation delves into the intricacies of matching preferences between two groups, ensuring stability in the pairings.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages