<jupyter_start><jupyter_text>American International School of Lusaka - School Timetable 2016-2017 This notebook was provided by [François](https://github.com/fderyckel) In this scenario, The PE classes are at the same times for each grade level (ie. both grade 06 classes have PE together for instance).  All MYP years, have 4 language acquisition teachers (2 for French and 2 for Spanish).  Math in grade06 and 07 is taught by the same teachers for the same grade level (lighter load on preps).    Math in grade 09 and 10 is taught at the same time for the same grade level (better for differentiation).   IN DP:  Group 6 is arts (VA + Drama ++ CHEMISTRY! + one group 3 class which is econ now.]Check to try: Grade 06 fewer teachers: then Engl+I&S = 1 teacher, math + science = 1 teacherNeed to have more variety of teachers (who would be interested in teaching what in what grade level?)<jupyter_code>from pyschedule import Scenario, solvers, plotters
import matplotlib

## small defintion to plot the solution if there is one
def run(scen):
    if solvers.mip.solve(scen):
        %matplotlib inline
        plotters.matplotlib.plot(scen, fig_size=(25, 30))
    else:
        print('no solution exist')
aisl = Scenario('AISL_trial01', horizon=8)

# Defining the Teacher Resources
alta_conte = aisl.Resource('Alta_Conte')
andrew_muyamwa = aisl.Resource('Andrew_Muyamwa')
becky_oliver = aisl.Resource('Becky_Oliver')
bob_stewart = aisl.Resource('Bob_Stewart')
bupe_mulenga = aisl.Resource('Bupe_Mulenga')
carlos_gayete = aisl.Resource('Carlos_Gayete')
chell_illingworth = aisl.Resource('Chell_Illingworth')
chris_mcdonald = aisl.Resource('Chris_McDonald')
dana_Schwarzkopf = aisl.Resource('Dana_Schwarzkopf')
elna_vanrensburg = aisl.Resource('Elna_VanRensburg')
florence_bouillot = aisl.Resource('Florence_Bouillot')
francesca_mulazzidevalle = aisl.Resource('Francesca_MulazzideValle')
gregg_cottrell = aisl.Resource('Gregg_Cottrell')
ian_heathcote = aisl.Resource('Ian_Heathcote')
ingrid_turner = aisl.Resource('Ingrid_Turner')
jeff_Redman = aisl.Resource('Jeff_Redman')
julie_frederick = aisl.Resource('Julie_Frederick')
karen_wallace = aisl.Resource('Karen_Wallace')
ken_hoffman = aisl.Resource('Ken_Hoffman')
kevin_frederick = aisl.Resource('Kevin_Frederick')
laurey_nevers = aisl.Resource('Laurey_Nevers')
lionel_honnorat = aisl.Resource('Lionel_Honnorat')
mateo_osorio = aisl.Resource('Mateo_Osorio')
melodie_haussman = aisl.Resource('Melodie_Haussman')
michael_ryan = aisl.Resource('Michael_Ryan')
monica_carilles = aisl.Resource('Monica_Carilles')
oloia_ruiz = aisl.Resource('Oloia_Ruiz')
pete_lawton = aisl.Resource('Pete_Lawton')
rod_oliver = aisl.Resource('Rod_Oliver')
tom_potter = aisl.Resource('Tom_Potter')
tony_potts = aisl.Resource('Tony_Potts')


# Defining the Grade Level as Resources
grade06A, grade06B = aisl.Resource('Grade_06A'), aisl.Resource('Grade_06B')
grade07A, grade07B = aisl.Resource('Grade_07A'), aisl.Resource('Grade_07B')
grade08A, grade08B = aisl.Resource('Grade_08A'), aisl.Resource('Grade_08B')
grade09A, grade09B = aisl.Resource('Grade_09A'), aisl.Resource('Grade_09B')
grade10A, grade10B = aisl.Resource('Grade_10A'), aisl.Resource('Grade_10B')
grade11A, grade11B = aisl.Resource('Grade_11A'), aisl.Resource('Grade_11B')
grade12A, grade12B = aisl.Resource('Grade_12A'), aisl.Resource('Grade_12B')


# Defining the Courses as Tasks
##MYP English + DP Group1
engl6A, engl7A, engl8A = aisl.Task('English_Gr06A'), aisl.Task('English_Gr07A'), aisl.Task('English_Gr08A')
engl6B, engl7B, engl8B = aisl.Task('English_Gr06B'), aisl.Task('English_Gr07B'), aisl.Task('English_Gr08B')
engl9A, engl9B = aisl.Task('English_Gr09A'), aisl.Task('English_Gr09B')
engl10A, engl10B = aisl.Task('English_Gr10A'), aisl.Task('English_Gr10B')
group1_11, group1_12 = aisl.Task('Group1_11'), aisl.Task('Group1_12')
group1dpt = aisl.Task('Group1_Dpt_Meeting')

##MYP+DP language acquisition
la6 = aisl.Task('Lang_Acqui_06')
la7 = aisl.Task('Lang_Acqui_07')
la8 = aisl.Task('Lang_Acqui_08')
la9 = aisl.Task('Lang_Acqui_09')
la10 = aisl.Task('Lang_Acqui_10')
group2_11, group2_12 = aisl.Task('Group2_11'), aisl.Task('Group2_12')
group2dpt = aisl.Task('Group2_Dpt_Meeting')

##MYP Individual & Societies + Group 3
inso6A, inso7A, inso8A = aisl.Task('Ind_Soc_Gr06A'), aisl.Task('Ind_Soc_Gr07A'), aisl.Task('Ind_Soc_Gr08A')
inso6B, inso7B, inso8B = aisl.Task('Ind_Soc_Gr06B'), aisl.Task('Ind_Soc_Gr07B'), aisl.Task('Ind_Soc_Gr08B')
inso9A, inso9B = aisl.Task('Ind_Soc_Gr09A'), aisl.Task('Ind_Soc_Gr09B')
inso10A, inso10B = aisl.Task('Ind_Soc_Gr10A'), aisl.Task('Ind_Soc_Gr10B')
group3_11, group3_12 = aisl.Task('Group3_11'), aisl.Task('Group3_12')
group3dpt = aisl.Task('Group3_Dpt_Meeting')

## MYP Sciences + Group 4
scie6A, scie7A, scie8A = aisl.Task('Sciences_Gr06A'), aisl.Task('Sciences_Gr07A'), aisl.Task('Sciences_Gr08A')
scie6B, scie7B, scie8B = aisl.Task('Sciences_Gr06B'), aisl.Task('Sciences_Gr07B'), aisl.Task('Sciences_Gr08B')
scie9A, scie9B = aisl.Task('Sciences_Gr09A'), aisl.Task('Sciences_Gr09B')
scie10A, scie10B = aisl.Task('Sciences_Gr10A'), aisl.Task('Sciences_Gr10B')
group4_11, group4_12 = aisl.Task('Group4_11'), aisl.Task('Group4_12')
group4dpt = aisl.Task('Group4_Dpt_Meeting')

## MYP Math + Group 5
math6A, math7A, math8A = aisl.Task('Math_Gr06A'), aisl.Task('Math_Gr07A'), aisl.Task('Math_Gr08A')
math6B, math7B, math8B = aisl.Task('Math_Gr06B'), aisl.Task('Math_Gr07B'), aisl.Task('Math_Gr08B')
#math9A, math9B = aisl.Task('Math_Gr09A'), aisl.Task('Math_Gr09B')
#math10A, math10B = aisl.Task('Math_Gr10A'), aisl.Task('Math_Gr10B')
math9 = aisl.Task('Math09')
math10 = aisl.Task('Math10')
group5_11, group5_12 = aisl.Task('Group5_11'), aisl.Task('Group5_12')
group5dpt = aisl.Task('Group5_Dpt_Meeting')

## MYP Arts + Group 6
mus6, mus7, mus8 = aisl.Task('Music_Gr06'), aisl.Task('Music_Gr07'), aisl.Task('Music_Gr08')
art9, art10 = aisl.Task('Arts_Gr09'), aisl.Task('Arts_Gr10')
group6_11, group6_12 = aisl.Task('Group6_11'), aisl.Task('Group6_12')

## MYP PHE
pe6 = aisl.Task('PHE06')
pe7 = aisl.Task('PHE07')
pe8 = aisl.Task('PHE08')
pe9 = aisl.Task('PHE09')
pe10 = aisl.Task('PHE10')

## MYP Design + Arts (gr06 to 08) + MYP Design (gr 09 to 10)
des_art_6 = aisl.Task('Design_Art_Gr06')
des_art_7 = aisl.Task('Design_Art_Gr07')
des_art_8 =  aisl.Task('Design_Art_Gr08')
design9A, design10A = aisl.Task('Design_Gr09A'), aisl.Task('Design_Gr10A')
design9B, design10B = aisl.Task('Design_Gr09B'), aisl.Task('Design_Gr10B')

tok11A, tok11B, tok12A, tok12B = aisl.Task('TOK_11A'), aisl.Task('TOK_11B'), aisl.Task('TOK_12A'), aisl.Task('TOK_12B')

# Assigning the course to a grade level
engl6A += grade06A
la6 += grade06A
inso6A += grade06A
scie6A += grade06A
math6A += grade06A
mus6 += grade06A
pe6 += grade06A
des_art_6 += grade06A

engl6B += grade06B
la6 += grade06B
inso6B += grade06B
scie6B += grade06B
math6B += grade06B
mus6 += grade06B
pe6 += grade06B
des_art_6 += grade06B

engl7A += grade07A
la7 += grade07A
inso7A += grade07A
scie7A += grade07A
math7A += grade07A
mus7 += grade07A
pe7 += grade07A
des_art_7 += grade07A

engl7B += grade07B
la7 += grade07B
inso7B += grade07B
scie7B += grade07B
math7B += grade07B
mus7 += grade07B
pe7 += grade07B
des_art_7 += grade07B

engl8A += grade08A
la8 += grade08A
inso8A += grade08A
scie8A += grade08A
math8A += grade08A
mus8 += grade08A
pe8 += grade08A
des_art_8 += grade08A

engl8B += grade08B
la8 += grade08B
inso8B += grade08B
scie8B += grade08B
math8B += grade08B
mus8 += grade08B
pe8 += grade08B
des_art_8 += grade08B

engl9A += grade09A
la9 += grade09A
inso9A += grade09A
scie9A += grade09A
math9 += grade09A
#math9A += grade09A
art9 += grade09A
pe9 += grade09A
design9A += grade09A

engl9B += grade09B
la9 += grade09B
inso9B += grade09B
scie9B += grade09B
math9 += grade09B
#math9B += grade09B
art9 += grade09B
pe9 += grade09B
design9B += grade09B

engl10A += grade10A
la10 += grade10A
inso10A += grade10A
scie10A += grade10A
math10 += grade10A
#math10A += grade10A
art10 += grade10A
pe10 += grade10A
design10A += grade10A

engl10B += grade10B
la10 += grade10B
inso10B += grade10B
scie10B += grade10B
math10 += grade10B
#math10B += grade10B
art10 += grade10B
pe10 += grade10B
design10B += grade10B

group1_11 += grade11A
group1_11 += grade11B
group2_11 += grade11A
group2_11 += grade11B
group3_11 += grade11A
group3_11 += grade11B
group4_11 += grade11A
group4_11 += grade11B
group5_11 += grade11A
group5_11 += grade11B
group6_11 += grade11A
group6_11 += grade11B
tok11A += grade11A
tok11B += grade11B

group1_12 += grade12A
group1_12 += grade12B
group2_12 += grade12A
group2_12 += grade12B
group3_12 += grade12A
group3_12 += grade12B
group4_12 += grade12A
group4_12 += grade12B
group5_12 += grade12A
group5_12 += grade12B
group6_12 += grade12A
group6_12 += grade12B
tok12A += grade12A
tok12B += grade12B

# Assigning the course to a teacher(s)

#ms_englishteacher = ingrid_turner|alta_conte
#hs_englishteacher = julie_frederick|michael_ryan
#ms_isteacher = alta_conte|rod_oliver
#ms_scienceteacher = elna_vanrensburg
gr6_mathteacher = andrew_muyamwa|ian_heathcote|pete_lawton|elna_vanrensburg
gr7_mathteacher = andrew_muyamwa|ian_heathcote|pete_lawton|elna_vanrensburg

engl6A += ingrid_turner|alta_conte|francesca_mulazzidevalle|becky_oliver
engl6B += ingrid_turner|alta_conte|francesca_mulazzidevalle|becky_oliver
engl7A += ingrid_turner|alta_conte|francesca_mulazzidevalle|becky_oliver
engl7B += ingrid_turner|alta_conte|francesca_mulazzidevalle|becky_oliver
engl8A += ingrid_turner|francesca_mulazzidevalle|alta_conte|becky_oliver
engl8B += ingrid_turner|francesca_mulazzidevalle|alta_conte|becky_oliver
engl9A += julie_frederick|michael_ryan|francesca_mulazzidevalle|becky_oliver
engl9B += julie_frederick|michael_ryan|francesca_mulazzidevalle|becky_oliver
engl10A += julie_frederick|michael_ryan|francesca_mulazzidevalle|becky_oliver
engl10B += julie_frederick|michael_ryan|francesca_mulazzidevalle|becky_oliver

la6 += [tom_potter, lionel_honnorat|florence_bouillot, mateo_osorio, monica_carilles|oloia_ruiz]
la7 += [tom_potter, lionel_honnorat|florence_bouillot, mateo_osorio, monica_carilles|oloia_ruiz]
la8 += [tom_potter, florence_bouillot|lionel_honnorat, monica_carilles, oloia_ruiz]
la9 += [tom_potter, lionel_honnorat|florence_bouillot, monica_carilles, oloia_ruiz]
la10 += [tom_potter, lionel_honnorat|florence_bouillot, mateo_osorio, monica_carilles]

inso6A += alta_conte|rod_oliver
inso6B += alta_conte|rod_oliver
inso7A += alta_conte|rod_oliver
inso7B += alta_conte|rod_oliver
inso8A += alta_conte|ken_hoffman|rod_oliver
inso8B += alta_conte|ken_hoffman|rod_oliver
inso9A += ken_hoffman|rod_oliver|chris_mcdonald
inso9B += ken_hoffman|rod_oliver|chris_mcdonald
inso10A += ken_hoffman|rod_oliver|chris_mcdonald
inso10B += ken_hoffman|rod_oliver|chris_mcdonald

scie6A += elna_vanrensburg|ian_heathcote
scie6B += elna_vanrensburg|ian_heathcote
scie7A += elna_vanrensburg|ian_heathcote
scie7B += elna_vanrensburg|ian_heathcote
scie8A += elna_vanrensburg|gregg_cottrell|bob_stewart
scie8B += elna_vanrensburg|gregg_cottrell|bob_stewart
scie9A += bob_stewart|gregg_cottrell|ian_heathcote|gregg_cottrell|karen_wallace
scie9B += bob_stewart|gregg_cottrell|ian_heathcote|gregg_cottrell|karen_wallace
scie10A += karen_wallace|gregg_cottrell|bob_stewart|ian_heathcote
scie10B += karen_wallace|gregg_cottrell|bob_stewart|ian_heathcote

math6A += gr6_mathteacher
math6B += gr6_mathteacher
math7A += gr7_mathteacher
math7B += gr7_mathteacher
math8A += andrew_muyamwa|ian_heathcote|pete_lawton
math8B += andrew_muyamwa|ian_heathcote|pete_lawton
math9 += [kevin_frederick, pete_lawton|andrew_muyamwa]
math10 += [andrew_muyamwa|pete_lawton, kevin_frederick]
#math9A += kevin_frederick|andrew_muyamwa|pete_lawton|gregg_cottrell
#math10A += kevin_frederick| andrew_muyamwa|pete_lawton
#math9B += kevin_frederick| andrew_muyamwa|pete_lawton|gregg_cottrell
#math10B += kevin_frederick| andrew_muyamwa|pete_lawton

mus6 += [melodie_haussman, chell_illingworth]
mus7 += [melodie_haussman, chell_illingworth]
mus8 += [melodie_haussman, chell_illingworth]
art9 += [chell_illingworth|melodie_haussman, jeff_Redman, laurey_nevers]
art10 += [chell_illingworth|melodie_haussman, jeff_Redman, laurey_nevers]

pe6 += [bupe_mulenga, carlos_gayete]
pe7 += [bupe_mulenga, carlos_gayete]
pe8 += [bupe_mulenga, carlos_gayete]
pe9 += [bupe_mulenga, carlos_gayete]
pe10 += [bupe_mulenga, carlos_gayete]

des_art_6 += [dana_Schwarzkopf, laurey_nevers, jeff_Redman]
des_art_7 += [dana_Schwarzkopf, laurey_nevers, jeff_Redman]
des_art_8 += [dana_Schwarzkopf, laurey_nevers, jeff_Redman]
design9A += dana_Schwarzkopf|kevin_frederick
design9B += dana_Schwarzkopf|kevin_frederick
design10A += dana_Schwarzkopf|kevin_frederick
design10B += dana_Schwarzkopf|kevin_frederick

group1_11 += [francesca_mulazzidevalle, becky_oliver, michael_ryan|julie_frederick]
group1_12 += [becky_oliver, michael_ryan, julie_frederick]
group2_11 += [florence_bouillot, lionel_honnorat, monica_carilles, mateo_osorio]
group2_12 += [florence_bouillot, lionel_honnorat, monica_carilles, mateo_osorio]
group3_11 += [ken_hoffman, chris_mcdonald, rod_oliver]
group3_12 += [ken_hoffman, chris_mcdonald, rod_oliver]
group4_11 += [bob_stewart, gregg_cottrell, ian_heathcote]
group4_12 += [bob_stewart, gregg_cottrell, ian_heathcote]
group5_11 += [kevin_frederick, andrew_muyamwa, pete_lawton]
group5_12 += [kevin_frederick, andrew_muyamwa, pete_lawton]
group6_11 += [jeff_Redman, karen_wallace, laurey_nevers, chris_mcdonald]
group6_12 += [jeff_Redman, karen_wallace, laurey_nevers, chris_mcdonald]
tok11A += ken_hoffman|lionel_honnorat|pete_lawton|becky_oliver|michael_ryan
tok11B += ken_hoffman|lionel_honnorat|pete_lawton|becky_oliver|michael_ryan
tok12A += ken_hoffman|lionel_honnorat|pete_lawton|becky_oliver|michael_ryan
tok12B += ken_hoffman|lionel_honnorat|pete_lawton|becky_oliver|michael_ryan

#dpt meeting
group1dpt += [julie_frederick, francesca_mulazzidevalle, ingrid_turner, michael_ryan]
group5dpt += [kevin_frederick, pete_lawton, andrew_muyamwa]
group2dpt += [oloia_ruiz, lionel_honnorat, florence_bouillot, mateo_osorio, tom_potter, monica_carilles]
group3dpt += [alta_conte, rod_oliver, ken_hoffman, chris_mcdonald]
group4dpt += [elna_vanrensburg, karen_wallace, bob_stewart, gregg_cottrell, ian_heathcote]
aisl += alta_conte['length'][0:4] <= 3
aisl += andrew_muyamwa['length'][0:4] <= 3
aisl += bob_stewart['length'][0:4] <= 3
aisl += bupe_mulenga['length'][0:4] <= 3
aisl += carlos_gayete['length'][0:4] <= 3
aisl += chell_illingworth['length'][0:4] <= 3
aisl += chris_mcdonald['length'][0:4] <= 3
aisl += dana_Schwarzkopf['length'][0:4] <= 3
aisl += elna_vanrensburg['length'][0:4] <= 3
aisl += florence_bouillot['length'][0:4] <= 3
aisl += gregg_cottrell['length'][0:4] <= 3
aisl += ian_heathcote['length'][0:4] <= 3
aisl += ingrid_turner['length'][0:4] <= 3
aisl += julie_frederick['length'][0:4] <= 3
aisl += karen_wallace['length'][0:4] <= 3
aisl += ken_hoffman['length'][0:4] <= 3
aisl += kevin_frederick['length'][0:4] <= 3
aisl += lionel_honnorat['length'][0:4] <= 3
aisl += mateo_osorio['length'][0:4] <= 3
aisl += melodie_haussman['length'][0:4] <= 3
aisl += michael_ryan['length'][0:4] <= 3
aisl += monica_carilles['length'][0:4] <= 3
aisl += pete_lawton['length'][0:4] <= 3
aisl += rod_oliver['length'][0:4] <= 3
aisl += tom_potter['length'][0:4] <= 3
aisl += alta_conte['length'][4:8] <= 3
aisl += andrew_muyamwa['length'][4:8] <= 3
aisl += bob_stewart['length'][4:8] <= 3
aisl += bupe_mulenga['length'][4:8] <= 3
aisl += carlos_gayete['length'][4:8] <= 3
aisl += chris_mcdonald['length'][4:8] <= 3
aisl += dana_Schwarzkopf['length'][4:8] <= 3
aisl += elna_vanrensburg['length'][4:8] <= 3
aisl += florence_bouillot['length'][4:8] <= 3
aisl += ian_heathcote['length'][4:8] <= 3
aisl += ingrid_turner['length'][4:8] <= 3
aisl += julie_frederick['length'][4:8] <= 3
aisl += karen_wallace['length'][4:8] <= 3
aisl += ken_hoffman['length'][4:8] <= 3
aisl += kevin_frederick['length'][4:8] <= 3
aisl += mateo_osorio['length'][4:8] <= 3
aisl += michael_ryan['length'][4:8] <= 3
aisl += monica_carilles['length'][4:8] <= 3
aisl += pete_lawton['length'][4:8] <= 3
aisl += rod_oliver['length'][4:8] <= 3
aisl += tom_potter['length'][4:8] <= 3
## putting constraints on the teacher schedule
aisl += alta_conte['length'] <= 6
aisl += andrew_muyamwa['length'] <= 6
aisl += becky_oliver['length'] <= 2
aisl += bob_stewart['length'] <= 6
aisl += bupe_mulenga['length'] <= 6
aisl += chell_illingworth['length'] <= 6
aisl += chris_mcdonald['length'] <= 6
aisl += carlos_gayete['length'] <= 6
aisl += dana_Schwarzkopf['length'] <= 6
aisl += elna_vanrensburg['length'] <= 6
aisl += florence_bouillot['length'] <= 6
aisl += francesca_mulazzidevalle['length'] <= 3
aisl += gregg_cottrell['length'] <= 6
aisl += ian_heathcote['length'] <= 6
aisl += ingrid_turner['length'] <= 6
aisl += jeff_Redman['length'] <= 7
aisl += julie_frederick['length'] <= 6
aisl += karen_wallace['length'] <= 6
aisl += ken_hoffman['length'] <= 5
aisl += kevin_frederick['length'] <= 6
aisl += laurey_nevers['length'] <= 7
aisl += lionel_honnorat['length'] <= 6
aisl += michael_ryan['length'] <= 6
aisl += monica_carilles['length'] <= 6
aisl += mateo_osorio['length'] <= 6
aisl += oloia_ruiz['length'] <= 6
aisl += pete_lawton['length'] <= 6
aisl += rod_oliver['length'] <= 6
aisl += tom_potter['length'] <= 6
solvers.mip.solve(aisl, msg=True)
%matplotlib inline
plotters.matplotlib.plot(aisl, fig_size=(25, 30))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1372739757381552, 'fraction_numerical': 0.06391622796978713, 'mean_word_length': 8.078961038961038, 'pattern_counts': {'":': 0, '<': 80, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '123055', 'license': 'Apache-2.0', 'n_tokens_mistral': 8005, 'n_tokens_neox': 7435, 'n_words': 1230, 'path': 'example-notebooks/school-timetable-aisl.ipynb', 'repo_name': 'rafaeldelrey/pyschedule', 'size': '17476'}