<s> import os <EOL> import orca <EOL> import pandas as pd <EOL> from activitysim import activitysim as asim <EOL> from . util . vectorize_tour_scheduling import vectorize_tour_scheduling <EOL> @ orca . table ( ) <EOL> def tdd_alts ( configs_dir ) : <EOL> f = os . path . join ( configs_dir , "<STR_LIT>" , <EOL> "<STR_LIT>" ) <EOL> return pd . read_csv ( f ) <EOL> @ orca . column ( "<STR_LIT>" ) <EOL> def duration ( tdd_alts ) : <EOL> return tdd_alts . end - tdd_alts . start <EOL> @ orca . table ( ) <EOL> def tdd_work_spec ( configs_dir ) : <EOL> f = os . path . join ( configs_dir , '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> return asim . read_model_spec ( f ) . fillna ( <NUM_LIT:0> ) <EOL> @ orca . table ( ) <EOL> def tdd_school_spec ( configs_dir ) : <EOL> f = os . path . join ( configs_dir , '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> return asim . read_model_spec ( f ) . fillna ( <NUM_LIT:0> ) <EOL> @ orca . step ( ) <EOL> def mandatory_scheduling ( set_random_seed , <EOL> mandatory_tours_merged , <EOL> tdd_alts , <EOL> tdd_school_spec , <EOL> tdd_work_spec ) : <EOL> """<STR_LIT>""" <EOL> tours = mandatory_tours_merged . to_frame ( ) <EOL> alts = tdd_alts . to_frame ( ) <EOL> school_spec = tdd_school_spec . to_frame ( ) <EOL> school_tours = tours [ tours . tour_type == "<STR_LIT>" ] <EOL> print "<STR_LIT>" % len ( school_tours ) <EOL> school_choices = vectorize_tour_scheduling ( school_tours , alts , school_spec ) <EOL> work_spec = tdd_work_spec . to_frame ( ) <EOL> work_tours = tours [ tours . tour_type == "<STR_LIT>" ] <EOL> print "<STR_LIT>" % len ( work_tours ) <EOL> work_choices = vectorize_tour_scheduling ( work_tours , alts , work_spec ) <EOL> choices = pd . concat ( [ school_choices , work_choices ] ) <EOL> print "<STR_LIT>" , choices . describe ( ) <EOL> orca . add_column ( <EOL> "<STR_LIT>" , "<STR_LIT>" , choices ) </s>
