Skip to content

Conversation

@RahwaZeslusHaile
Copy link

@RahwaZeslusHaile RahwaZeslusHaile commented Dec 8, 2025

Manchester | 25-SDC-Nov | Rahwa Haile | Sprint 5 |implement laptop allocation

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

Implement laptop allocation algorithm and detailed output

  • Added allocate_laptops function to assign laptops to people minimizing total sadness
  • Used brute-force permutations approach for small datasets
  • Updated Person dataclass to use tuple for preferred_operating_system (hashable)
  • Printed each person's allocated laptop with individual sadness score

Questions

This solution is good for small data, but it doesn't scale because permutations grow factorially. The SciPy/Hungarian way to solve the problem is polynomial time and stays fast even with more laptops/people. Which approach do you prefer for this version?
Please review my work — thank you!

@RahwaZeslusHaile RahwaZeslusHaile added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Dec 8, 2025
@OracPrime OracPrime added the Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. label Jan 11, 2026
Copy link

@OracPrime OracPrime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need an algorithm that scales. This one doesn't

best_assignment = None
lowest_sadness = float("inf")

for perm in permutations(laptops):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to revisit this algorithm. If you have 20 laptops, how many iterations is this loop?

Laptop(4, "Apple", "MacBook Air", 13, OperatingSystem.MACOS),
Laptop(5, "Apple", "MacBook Pro", 16, OperatingSystem.MACOS),
Laptop(6, "Dell", "Latitude", 15, OperatingSystem.ARCH),
Laptop(7, "HP", "EliteBook", 13, OperatingSystem.MACOS),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HP running MacOS? Cute :)

@@ -1 +1,2 @@
node_modules
.venv

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While it's correct to gitignore .venv, if you've had to create a venv you should probably commit a requirements.txt that describes it.

@OracPrime OracPrime added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Jan 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Reviewed Volunteer to add when completing a review with trainee action still to take.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants