Skip to content

Logsums

smart-fm edited this page Nov 9, 2018 · 9 revisions

Definition: The logsum of a choice model is given by the equation,
logsumi = log(sum(exp(vij)))
where,

  • i represents ith individual,
  • j is the index of a choice-alternative of the model; the sum in the above equation is taken over all alternatives of the model.

Preday has a chain of choice models. These choice models are executed one after the other in a sequence for every individual in the population. The choices made by each model cumulatively help to build a complete activity schedule for an individual.

Some of these choice models use logsums from models that are executed later along the chain of models. For example, the day-pattern binary model, which decides whether a person must stay at home or do activities, requires logsums from the day-pattern tour and day-pattern stops models. Both of these models are executed after the day-pattern binary model.

To avoid redundant computations we pre-compute logsums for all individuals and store them before proceeding to the generation of activity schedules. Given a population for which activity schedules are to be generated, we pre-compute all necessary logsums for each individual in the population from pertinent models and store these values in a separate table in the demand schema of simmobility database. This process is performed by the logsum computation mode of preday. These pre-computed logsums are then loaded as input for the generating activity schedules in the simulation mode of preday. Any choice model which needs a logsum easily look-up this table of pre-computed logsums.

logsum table

The logsum table is kept in the demand schema of simmobility database. As explained above, this table is populated by the logsum computation mode of preday and it is one of the inputs for the simulation mode. The columns of the table are explained below.

column description
person_id id of a person in the population. This column is the primary key of the table. It is used to lookup logsum values for the person.
work logsum value from mode or mode-destination models for work tours
education logsum value from tour mode model for education tours
shop logsum value from mode-destination model for shopping tours
other logsum value from mode-destination model for other tours
dp_tour logsum value from day-pattern tour model
dp_stop logsum value from day-pattern stops model

MT-LT integration

The logsum values computed from the preday models are also part of the feedback that is provided to the SimMobility long-term models. Specifically, all logsums computed from the models mentioned in the table description along with the logsum from day-pattern binary model is sent to the long-term model through a simple function interface callable directly from LT code.

Configuration

<system>
    <network_database database="fm_remote" credentials="fm_remote" proc_map="simmobcity"/>
    <population_database  database="fm_remote_lt" credentials="lt_cred" proc_map=""/>
    ...
    ...
</system>
...
...
<preday>
    ...
    ...
    <!-- table containing logsums for each individual in the population -->
    <logsum_table name="demand.preday_logsum"/>
    ...
    ...
</preday>

The data source of the logsum table is specified in the above elements of simrun_MidTerm.xml file.

  • The connection information and credentials for the database that contains the logsum table is specified in the network_database element. Note that this must be the same database where other preday inputs like skim matrices and zonal data are kept.
  • population_database element specifies the data source for loading population data.
  • logsum_table element is used to specify the table for holding logsum values. Logsums are written to this table in logsum mode and are fetched from this table in simulation mode.
Clone this wiki locally