Question
Consider a school with five classes: A, B, C, D, E. The courses can be scheduled in two periods, named 1 and 2. Each class
Consider a school with five classes: A, B, C, D, E. The courses can be scheduled in two periods, named 1 and 2. Each class needs to be scheduled in one of the two periods, but there are some caveats. Some subsets of courses can not be scheduled in the same period because some students need to take both classes. There will be ten variables, one for each course/period combination. For example, for class A, there are a1 and a2. If a1=True this means that class A is scheduled in period 1. 1 Write all your functions in the following parts in python. Each function should output True when the required condition is met.
a) Define a function a(a1, a2, b1, b2, c1, c2, d1, d2, e1, e2). Each of the five classes must be scheduled in either period 1 or period 2, but not both.
b) Define a function b(a1, a2, b1, b2). Class A and B cannot be scheduled in the same period.
c) Define a function c(b1, b2, c1, c2, e1, e2). Class B and E cannot be scheduled in the same period, or Class B and C cannot be scheduled in the same period.
d) Define a function d(a1, a2, c1, c2, e1, e2). The three classes A, E, and C cannot be scheduled in the same period.
e) Define a function e(a1, a2, d1, d2). Class A and D must be scheduled in the same period.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started