Skip to content

Add School Enrollment model#301

Open
niteshver wants to merge 17 commits into
mesa:mainfrom
niteshver:student_school_mdoel
Open

Add School Enrollment model#301
niteshver wants to merge 17 commits into
mesa:mainfrom
niteshver:student_school_mdoel

Conversation

@niteshver

Copy link
Copy Markdown
Contributor

Overview

This PR introduces a School Enrollment Agent-Based Model (ABM) that simulates interactions between students and schools in a competitive education system.

The model captures how decentralized student decisions and school constraints lead to emergent enrollment patterns over time.


Key Features

  • Student agents with:

    • Academic progression (achievement, pass/fail, dropout)
    • School choice behavior based on utility
    • Budget and SES constraints
  • School agents with:

    • Capacity constraints
    • Selective and non-selective admission
    • Dynamic tuition updates
  • Probabilistic school selection using a softmax-based utility function

  • Iterative matching process:

    • Students apply to schools
    • Schools select students
    • Rejected students reapply

Motivation

This model aims to explore how:

  • Individual decision-making (students)
  • Institutional constraints (schools)

interact to produce system-level outcomes such as:

  • Enrollment distribution
  • Academic clustering
Screenshot 2026-04-18 at 8 58 21 AM

@coderabbitai

coderabbitai Bot commented Apr 18, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 793dfca4-be39-43f8-a0dc-5a85bcfc77c5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented Apr 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.10%. Comparing base (1e91f24) to head (4ef349a).
⚠️ Report is 72 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #301      +/-   ##
==========================================
+ Coverage   91.20%   92.10%   +0.90%     
==========================================
  Files          19       19              
  Lines        1592     1698     +106     
==========================================
+ Hits         1452     1564     +112     
+ Misses        140      134       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 146b545f10

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread examples/student/agent.py Outdated
Comment on lines +293 to +294
if len(applicants) <= self.capacity:
return applicants

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Enforce remaining capacity when selecting students

matching() runs in multiple rounds and appends newly accepted students to school.students each round, but select_students() always compares only len(applicants) against the full self.capacity. If a school fills in an early round and later receives applicants rejected elsewhere, this method can still admit more students, violating the school capacity constraint and distorting enrollment outcomes.

Useful? React with 👍 / 👎.

Comment thread examples/student/model.py
Comment on lines +227 to +230
for student in self.students:
if student.state == StudentState.APPLIED:
student.state = StudentState.ENROLLED
student.refresh_internal_state()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep unplaced applicants out of ENROLLED state

At the end of matching, every student still in APPLIED is force-converted to ENROLLED even when current_school is None (for example, when choose_school() returns None because their choice set is exhausted). This creates an inconsistent state where students are counted as enrolled and continue progressing academically without any school assignment, which corrupts model metrics and dynamics.

Useful? React with 👍 / 👎.

@IlamaranMagesh

Copy link
Copy Markdown

Hey @niteshver, this looks interesting but would love to see some of your own tests for the model. They make it easier to understand the logic.

@niteshver

Copy link
Copy Markdown
Contributor Author

Hi @IlamaranMagesh , thanks for the feedback!

That makes sense — I’ll add some tests to better demonstrate the model logic.
I’ll push an update shortly 👍

@niteshver

Copy link
Copy Markdown
Contributor Author

Hi @IlamaranMagesh
I have check some test and here is the output
Screenshot 2026-04-18 at 10 57 23 PM

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

Successfully merging this pull request may close these issues.

2 participants