Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Introduction For this assignment, you will implement a program that uses a Constraint Satisfaction Problem (CSP) formulation to find possible degree plans for students in the M.S. in Data Science...

1 answer below »

Introduction

For this assignment, you will implement a program that uses a Constraint Satisfaction Problem (CSP) formulation to find possible degree plans for students in the M.S. in Data Science program at Lewis University. A degree plan is a mapping of academic terms to courses. For example, “Year 1 Fall 2” to “MATH-51100”. This information can be used to help students pick courses and also to determine a course rotation that allows students to complete the degrees in the specified number of terms.

Requirements

You are to use Python 3 with the python-constraint package to determine the number of possible degree plans for a given start and end term under the constraints given below. Also, your code should generate one possible degree plan that satisfies all constraints. The information needed for formulating the CSP is given within the two sheets of the csp_course_rotations.xlsx file. The first sheet (course_rotations) provides a listing of all available courses, their type (foundation, core, elective, or capstone), and the term availability (0 - unavailable, 1 - available) for each of the terms (1: Fall 1, 2: Fall 2, 3: Spring 1, 4: Spring 2, 5: Summer 1, 6: Summer 2). The second sheet (prereqs) specifies which course must be taken before another. Note that a course may have multiple prerequisites.

Your program must output the number of possible degree plans and one possible degree plan for a student that starts in Year 1 Fall 1 and finishes in Year 3 Fall 2. The degree plan must satisfy the following requirements:

1. Student will take one and only one course per term.

2. Course that has prerequisites must be taken in a term that follows the term in which all prerequisites are done.

3. The student does not need to repeat courses.

4. Some terms may be skipped as long as the student finishes in Year 3 Fall 2.

5. Student needs to take 3 out of the 8 elective courses. It doesn’t matter which ones are included in the degree plan. Those courses which are not taken will be labeled as “Not Taken” (see sample output).

6. Student must take all foundation and core courses.

The program will generate the output shown in the sample output at the end.

Additional Requirements

1. The name of your source code file should be mp3.py. All your code should be within a single file.

2. You can only import numpy, pandas, and constraint packages.

3. Your code should follow good coding practices, including good use of whitespace and use of both inline and block comments.

4. You need to use meaningful identifier names that conform to standard naming conventions.

5. At the top of each file, you need to put in a block comment with the following information: your name, date, course name, semester, and assignment name.

What to Turn In

You will turn in the single mp3.py file using BlackBoard.

HINT

· You can load an Excel file using pandas’ pd.read_excel function. The sheet is specified by the sheet_name attribute.




Grading Rubric

Category

Unsatisfactory (0-1 points)

Satisfactory (2-3 point)

Distinguished (4-5 points)

Program Correctness

  • Program does not XXXXXXXXXXexecute due to errors
  • Incorrect results XXXXXXXXXXfor most or all input
  • Program works and XXXXXXXXXXcompletes most tasks appropriately
  • Program fails to XXXXXXXXXXwork for special cases
  • Program runs and XXXXXXXXXXcompletes all required tasks
  • Handles any required XXXXXXXXXXspecial cases
  • Executes without XXXXXXXXXXerrors

Programming Style

  • No name, date, or XXXXXXXXXXassignment title included
  • Poor use of white XXXXXXXXXXspace
  • Disorganized and XXXXXXXXXXmessy
  • No or few comments XXXXXXXXXXin the source code
  • Poor use of XXXXXXXXXXvariables (improper scope/visibility, ambiguous naming).
  • Includes name, date, XXXXXXXXXXand assignment title.
  • White space makes XXXXXXXXXXprogram fairly easy to read.
  • Well organized code.
  • Some comments XXXXXXXXXXmissing in the source code or too many comments
  • Good use of XXXXXXXXXXvariables (few issues with scope/visibility or unambiguous naming).
  • Includes name, date, XXXXXXXXXXand assignment title.
  • Excellent use of XXXXXXXXXXwhite space.
  • Perfectly organized XXXXXXXXXXcode.
  • Source code is XXXXXXXXXXcommented throughout when needed
  • Excellent use of XXXXXXXXXXvariables (no issues with scope/visibility or unambiguous naming).

Following Specifications

  • Incorrect filenames
  • Incorrect specified XXXXXXXXXXidentifier names
  • Source code XXXXXXXXXXorganization different from requirements
  • Additional XXXXXXXXXXrequirements not satisfied
  • Correct filenames XXXXXXXXXXand class names
  • Few issues with XXXXXXXXXXother specified identifier names
  • Source code XXXXXXXXXXorganization close to requirements
  • Some additional requirements XXXXXXXXXXnot satisfied
  • Correct filenames XXXXXXXXXXand specified identifier names
  • Source code XXXXXXXXXXorganization satisfies all requirements
  • All additional XXXXXXXXXXrequirements satisfied


Sample Program Output

CLASS: Artificial Intelligence, Lewis University

NAME: [put your name here]

START TERM = Year 1 Fall 1

Number of Possible Degree Plans is 9488

Sample Degree Plan

Not Taken CPSC-57400

Not Taken CPSC-57200

Not Taken CPSC-57100

Not Taken CPSC-55200

Not Taken CPSC-51700

Year 1 Fall 1 CPSC-50600

Year 1 Fall 2 MATH-51100

Year 1 Spring 1 MATH-51000

Year 1 Spring 2 MATH-51200

Year 1 Summer 1 CPSC-50100

Year 2 Fall 1 CPSC-51100

Year 2 Fall 2 CPSC-53000

Year 2 Spring 1 CPSC-54000

Year 2 Spring 2 CPSC-55500

Year 2 Summer 1 CPSC-51000

Year 2 Summer 2 CPSC-52500

Year 3 Fall 1 CPSC-55000

Year 3 Fall 2 CPSC-59000

Answered Same Day Feb 20, 2021

Solution

Ximi answered on Feb 23 2021
160 Votes
#!/us
in/env python
# coding: utf-8
# In[ ]:
#Reading excel file
import pandas as pd
from constraint import *
data = pd.read_excel("data.xlsx", [0,1])
# In[ ]:
#Getting both sheets of excel
courses = data[0]
preqs = data[1]
# In[ ]:
#Calculating foundation and core courses
foundation_and_core = courses[(courses['Type']=='core') | (courses['Type']=='foundation')]['Course'].tolist()
# In[ ]:
#Calculating the electives
electives = courses[courses['Type']=='elective']['Course'].tolist()
# In[ ]:
#Specifying terms
terms = {
1: "Fall 1",
2: "Fall 2",
3: "Spring 1",
4: "Spring 2",
5: "Summer 1",
6: "Summer 2"
}
# In[ ]:
years = 3
key = 1
yearTerms = {}
#Calculating names of the terms
for i in range(1,years+1):
for year, term in zip([i]*6, range(1,7)):
yearTerms[key] = "Year {} {}".format(year, terms[term])
key += 1
#yearTerms
# In[ ]:
termsCourses...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here