Skip to content

Recommend Schedule Endpoint#444

Open
raunaqsingh2020 wants to merge 7 commits into
masterfrom
raunaqs/generate-schedules
Open

Recommend Schedule Endpoint#444
raunaqsingh2020 wants to merge 7 commits into
masterfrom
raunaqs/generate-schedules

Conversation

@raunaqsingh2020
Copy link
Copy Markdown

This pull request creates a route (/api/plan/recommendations/schedule/) that generates a schedule given a number of constraints.

Copy link
Copy Markdown
Contributor

@AaDalal AaDalal left a comment

Choose a reason for hiding this comment

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

Overall this is a really interesting feature! I left a few comments, but most of them are questions.

A small note: you also need to lint the PR before we merge.

Comment thread backend/plan/views.py
response_codes={
reverse_func("recommend-schedule"): {
"POST": {
200: "[DESCRIBE_RESPONSE_SCHEMA]Response returned successfully.",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do you know what tag this should fall under in the auto generated docs?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If you don't specify one, it will show up under [PCP] Course Recommendations which is probably correct.

Comment thread backend/plan/views.py
reverse_func("recommend-schedule"): {
"POST": {
200: "[DESCRIBE_RESPONSE_SCHEMA]Response returned successfully.",
201: "[UNDOCUMENTED]",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What does HTTP 201 "Created" mean here?

Comment thread backend/plan/views.py
"The times that sections in the recommended schedule can have "
"meetings within. The start and end time of the filter should be "
"dash-separated. Times should be specified as decimal numbers of "
"the form `h+mm/100` where h is the hour `[0..23]` and mm is the "
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also, are the hour and minute separated by a + or by a .? I think you should clarify in this description.

Comment thread backend/plan/views.py
),
},
"time": {
"type": "string",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this be a string or a decimal number?

Comment thread backend/plan/views.py
"attributes": {
"type": "array",
"description": (
"An array of attributes that must be fulfilled by the recommended "
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What does it mean to fulfill an attribute?

Comment thread backend/plan/views.py
model.AddImplication(sections[section.full_code], courses[course.full_code])
model.AddImplication(courses[course.full_code].Not(), sections[section.full_code].Not())

if section.full_code in locked_sections:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why is it necessary to handle locked_sections both above (ie in constructing the query set) and here?

Comment thread backend/plan/views.py
section_score += section.instructor_quality or 0.0
if min_difficulty:
section_score -= course.difficulty or 4.0
section_score = int(section_score * int(100 * section.credits))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why weight by section credit?

Comment thread backend/plan/views.py
"The maximum number of courses for the recommended schedule. "
),
},
"locked_courses": {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can people specify if they only want to consider a specific set of courses?

Comment thread backend/plan/views.py
for req in attribute_requirements:
model.Add(sum(schedule_attributes[req["code"]]) == req["num"])

if max_quality or min_difficulty:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does it make sense to have a generic scoring mechanism, so we can provide the most optimal schedules?

Comment thread backend/plan/views.py

# Solve the model
solver = cp_model.CpSolver()
solver.parameters.max_time_in_seconds = 10.0
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does it make sense to make this an async celery task? I'm not sure what the performance implications of the having this solver run for 10+ seconds is.

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.

3 participants