Skip to content

Commit

Permalink
move coefficient processing up
Browse files Browse the repository at this point in the history
  • Loading branch information
Clint Daniels committed Aug 27, 2020
1 parent 37a8dc5 commit 53d03f8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions activitysim/abm/models/util/vectorize_tour_scheduling.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ def _compute_logsums(alt_tdd, tours_merged, tour_purpose, model_settings, trace_
locals_dict.update(constants)
locals_dict.update(skims)

# constrained coefficients can appear in expressions
coefficients = simulate.get_segment_coefficients(logsum_settings, tour_purpose)
locals_dict.update(coefficients)

# - run preprocessor to annotate choosers
# allow specification of alternate preprocessor for nontour choosers
preprocessor = model_settings.get('LOGSUM_PREPROCESSOR', 'preprocessor')
Expand All @@ -92,17 +96,12 @@ def _compute_logsums(alt_tdd, tours_merged, tour_purpose, model_settings, trace_
trace_label=trace_label)

# - compute logsums

coefficients = simulate.get_segment_coefficients(logsum_settings, tour_purpose)
logsum_spec = simulate.read_model_spec(file_name=logsum_settings['SPEC'])
logsum_spec = simulate.eval_coefficients(logsum_spec, coefficients, estimator=None)

nest_spec = config.get_logit_model_settings(logsum_settings)
nest_spec = simulate.eval_nest_coefficients(nest_spec, coefficients)

# constrained coefficients can appear in expressions
locals_dict.update(coefficients)

logsums = simulate.simple_simulate_logsums(
choosers,
logsum_spec,
Expand Down

0 comments on commit 53d03f8

Please sign in to comment.