How martinakaduc/mm241-assignment works
Main components
• Core Engine Module – represented by main.py, which acts as the central controller.
• Policy Abstraction – the Policy class (in policy.py) that defines the interface (e.g., the get_action method) for all policy implementations.
• Student Submission Modules – a large number of folders under student_submissions, each containing a student’s policy (e.g., policy[some_student_ID].py), associated grading files (grade_p1.json, grade_p2.json, etc.), and sometimes additional support code.
• Evaluation/Grading System – scripts such as grade_all.py, grade_single.py, compute_score.py, and possibly check_wrong_name.py that gather, validate, grade, and score the different submissions.
• Configuration and Utility Modules – configs.py (for parameters and system configuration) and compute_score.py (which may define logic for scoring policies).
• Data Files – Excel sheets (scores.xlsx, scores_by_student.xlsx) and CSV files (wrong_name_public.csv) that serve as inputs or outputs to the system.
• Demonstration/Visualization Component – the demo folder (including a demo GIF) which shows the behavior of the greedy algorithm.
Relationships and interactions
• The Core Engine (main.py) orchestrates the overall process:
• It instantiates the cutting stock problem, loads configuration (configs.py), and selects which policy to use.
• It interacts with the Policy abstraction and calls its get_action method to compute cutting decisions.
• The Policy interface (along with its provided implementation examples) acts as a plug-in point:
• Student-submitted policies inherit from the Policy class.
• The system dynamically loads the appropriate student policy (e.g., by uncommenting an import in main.py).
• The Grading Subsystem:
• Grading scripts (grade_all.py, grade_single.py) call the core engine with each submission.
• They compare the output (grades stored in JSON files within each submission directory) against benchmarks.
• Score files (Excel and CSV) serve to log and summarize the performance.
• The Demo/Visualization Module:
• The demo directory holds assets (e.g., greedy.gif) that show algorithm behavior as a reference example.
• External libraries (numpy, pandas, torch, tensorflow, etc.) support computation within policies.
Architectural patterns and design principles
• Modularity and Separation of Concerns are evident:
• The core workflow is separated from grading, demonstration, and policy implementations.
• The Policy class abstracts out the decision-making so that new policies can be “plugged in” without modifying the core engine.
• Extensibility:
• Encourages new implementations by external contributors (students) via standardized naming and folder structure (e.g., student_submissions/s22110xxx).
• Uses inheritance (students create Policy2210xxx that inherits from Policy) as the primary extensibility mechanism.
• Workflow Pipeline:
• The system can be seen as a pipeline where input data (demands, stock sizes) moves through the core engine, processed by the selected policy, then evaluated by the grading process.