Commit fd061e4d authored by Jack Otto's avatar Jack Otto
Browse files

11/15/21 no classes of same color at same time

parent 618abe77
68ro7pl95u549g5qcp21j2dcec
ntf66u694pg9bdg1nrdu5gcsvg
ejhhu0mm3mktmj8nep0rf7h0gk
ot6f1pd47egsbb9nh4efeur2u8
vv0anu5r673isr4vdonmrdjdn0
f2ur1k010e7djon9r1ds6umg84
84kutuql2jh68iqddrhrhoqrjk
g2l8bphu5fde6b8vouiis5thn8
64ur27nmlio8gn6s00qc9le0bc
e590rv112qdm53nul3invsf79s
u7ra1i0s75d0915qu26nhlouu4
dnl18tfi0a1oe2ijcb4d1tke5k
fekj1jnrr8lu2emivsnm3komf8
2670a0rca496std6ndnak3omgk
k7d82ha3hfh581qat8aacv2ndg
jmjd8sj21mn4bro93qrdik8hr0
3qrcq70cfd5vhuceajsn7pmu9k
rbfso18d0vj7mi3jlpl1sl07fg
ldfj4kj7u7mcetjhqb808kjs70
ns0gmm3d5r34m3o2ucivl5sp98
6a7qrb3clvqa5jivum6bnhp1f0
p1rafhdbbj8e4ntvbcdsqvi58c
ugmad57m9hr18qqp9jbqaka1go
kca2o730mmjlvb6m8ud3i91l0g
7gogn9ko4a650nvhh7t476qmt8
g8ft2dob9ua2f1ajipk5a9a17g
diatih8jbmd2g245hup0nnccfc
cpui5gcim4030hv3r1863gnlb8
u1nif2e2tfhdqg85lmlq8dp3gg
vq5fghcrps8apnnnle1sujj3g4
nueop47fi09eq7vgkon1651jbk
ft662ti65s4mmk37r6e0u89kus
1k4dggbitjvlaebnbn0vbtf80o
tg4768qq8ch4de731n0k4dos6g
r93vrjtg03kcaundigdthtn8mg
51me1abd9djtj0p3hemjoijdq8
rtqc818su7sk1ubc98k6cd8g6k
77g9hgag560k9gcfa1ihercat0
o24tekul15qsvg5hbfd96b4s1c
55rn88aduupnvv490e0msflv7c
jecph3akbdnvkeb5p2rp18q0bs
81li2i46u40ut3coa5okkv2304
g9dmfq7jdpf585epdjhkn34pi4
rr4ctqje05o6u11fb4dkaanff8
j0oj0nut81jjtof0485fqsv03k
qokks8ichfkp6mmgeaob0bo6us
h6plrlu0jvsgb9sp61osash2fg
nd6mo7o7vmrgd1oepf0hn8skng
khbruerprbv48293noni0ikfpg
g8rc996gq206ft5jk5cd7pnsuc
06efcspcvtonje2lchj5nu0p4o
3c9pba1skhchc7mevvoqcsqio4
k1butc67aasf8hl0fc7dkft2q0
5imcu3ngh7k2vfj1vato0b390k
08f01362u55chl6ffcj8egh0ts
hvvi07vde753ibabtip47i50vc
30hvria0lnfj7pfor16qddehvo
4mft0s61asibbsnpdjb5sl9qh4
i8176o0iu97sfc6du487menp1g
tuqvlkvg8750c8pini8voc3ngg
grjcr83446qaoqnlu3t8hte1m0
709nmdn9n240g2udg788v5ovpg
bsl5kpama4v4add1883po77668
4sg6arjgvnid4oa2dgjk24vedc
0cbugh7lt1o04jpmf8mra1t4g8
ju1fm0ccgars1k6ccpkkffvsr8
h02qarjf37h8en5f0t935mhmhk
72mh9t9tuvtbqltr7rhg6hfcpc
e126cv5aorsehr79s1c2b35ru8
kg8ercdnnmqcitrv4pbup6p4i4
v6if1bm3k2dij987kni8dh034g
ph9mh5afvsloci56gvcebcojtk
qf6b6mm8q1gdu6qis61j57m3ks
lmhsb3n0a00i8q1647ng6r4bsk
mt4ftu9mu3ohk8ml1e51f0mrf4
......@@ -146,45 +146,45 @@ def full_schedule():
model.Add(sum(sections_taught_at_this_time) <= 1)
print("Adding constraint for classes longer than an hour")
## Make sure if a class is longer than an hour that a class can not be taught in the time span of that class
# for n in courses:
# if n.length != 1:
# for c in rooms:
# for p in profs:
# for d in n.days:
# for h in hours[0:len(hours) - n.length+1]:
# subsequent_hours_of_classes=[]
# for delta_t in range(1, n.length):
# dh = str(int(h) + delta_t)
# dh = str(((2-len(dh))*"0") + dh)
# Make sure if a class is longer than an hour that a class can not be taught in the time span of that class --> slow working version
for n in courses:
if n.length != 1:
for c in rooms:
for p in profs:
for d in n.days:
for h in hours[0:len(hours) - n.length+1]:
subsequent_hours_of_classes=[]
for delta_t in range(1, n.length):
dh = str(int(h) + delta_t)
dh = str(((2-len(dh))*"0") + dh)
# # ALL classes with the prof and room need to be 0
# for other_n in courses:
# for other_p in profs:
# subsequent_hours_of_classes.append(scheduled_classes[other_n, c, other_p, d, dh])
# ALL classes with the prof and room need to be 0
for other_n in courses:
for other_p in profs:
subsequent_hours_of_classes.append(scheduled_classes[other_n, c, other_p, d, dh])
# model.Add(scheduled_classes[n, c, p, d, h] + sum(subsequent_hours_of_classes) <= 1)
# Classes Longer than an hour should block out the following classes
for n in [classes for classes in courses if classes.length > 1]:
for c in [room for room in rooms if n.size <= room.capacity or n.room_requirement == room.features]:
for p in [professor for professor in profs if n in professor.teachable_classes]:
for d in n.days:
for h in hours[0:len(hours) - n.length+1]:
subsequent_hours_of_classes=[]
for delta_t in range(1, n.length):
dh = str(int(h) + delta_t)
dh = str(((2-len(dh))*"0") + dh)
## TODO FIX THIS CONSTRAINT
# ALL classes with the prof and room need to be 0
for other_n in courses:
for other_p in profs:
subsequent_hours_of_classes.append(scheduled_classes[other_n, c, other_p, d, dh])
model.Add(scheduled_classes[n, c, p, d, h] + sum(subsequent_hours_of_classes) <= 1)
model.Add(scheduled_classes[n, c, p, d, h] + sum(subsequent_hours_of_classes) <= 1)
# # Classes Longer than an hour should block out the following classes --> fast meh version
# for n in [classes for classes in courses if classes.length > 1]:
# for c in [room for room in rooms if n.size <= room.capacity or n.room_requirement == room.features]:
# for p in [professor for professor in profs if n in professor.teachable_classes]:
# for d in n.days:
# for h in hours[0:len(hours) - n.length+1]:
# subsequent_hours_of_classes=[]
# for delta_t in range(1, n.length):
# dh = str(int(h) + delta_t)
# dh = str(((2-len(dh))*"0") + dh)
#
# ## TODO FIX THIS CONSTRAINT
#
# # ALL classes with the prof and room need to be 0
# for other_n in courses:
# for other_p in profs:
# subsequent_hours_of_classes.append(scheduled_classes[other_n, c, other_p, d, dh])
#
# model.Add(scheduled_classes[n, c, p, d, h] + sum(subsequent_hours_of_classes) <= 1)
print("Adding constraint for senior design common hour to be blocked off")
......@@ -203,6 +203,18 @@ def full_schedule():
model.Add(scheduled_classes[n, c, p, "Th", "13"] == 0)
model.Add(scheduled_classes[n, c, p, "Th", "14"] == 0)
print("Adding constraint to not schedule classes of same color at the same times")
for n in courses:
for d in day_names:
for h in hours:
classes_of_same_year = []
for c in rooms:
for p in profs:
#only want one class for each year to be taught at a time
for color_year in [cy for cy in courses if cy.color == n.color]:
classes_of_same_year.append(scheduled_classes[color_year, c, p, d, h])
model.Add(sum(classes_of_same_year) <= 1)
## Fix a class at a specific thing
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment