#%% [markdown] # Complex experiments in cognitive science require participants to perform multiple tasks and capture observations with different modalities. This notebook demonstrates some possible solutions for the problem of scheduling experimental tasks. # First, we model a study with 12 sessions. Sessions consist of several surveys before and after a set of experimental tasks. We then define constraints and solve for a schedule for the given scenario. This scenario only plans the experiment for a single subject. #%% #! pip install pyschedule from pyschedule import Scenario, solvers, plotters, alt # the planning horizon has s = Scenario('Prolific500', horizon=15) session = s.Resource('Session', num=1) mmi = s.Task('MMI', length=3, delay_cost=1) nb = s.Task('NB',length=5, delay_cost=1) ds = s.Task('DS',length=5, delay_cost=1) nasa_tlx = s.Task('NSA_TLX', length=1, delay_cost=1) # define the tasks that each subject must perform in first session mmi += alt(session) nb += alt(session) ds += alt(session) nasa_tlx += alt(session) # add precedences s += mmi < nb s += mmi < ds s += ds < nasa_tlx s += nb < nasa_tlx # compute and print session schedules solvers.mip.solve(s,msg=1) print(s.solution()) plotters.matplotlib.plot(s)