polaris.runs.calibrate.calibration_config.CalibrationConfig#

pydantic model polaris.runs.calibrate.calibration_config.CalibrationConfig#

Bases: BaseModel

Configuration class for the POLARIS calibration procedure.

Calibration in POLARIS occurs by determining a delta from observed counts for key models (activity generation, mode choice, destination choice, timing choice) and using this to adjust the Alternative Specific Constants (ASC) of that model. This is done by modifying the JSON files in the root of the project at specified ‘calibration’ iterations and then allowing the model to stabilise before re-evaluating.

Show JSON schema
{
   "title": "CalibrationConfig",
   "description": "Configuration class for the POLARIS calibration procedure.\n\nCalibration in POLARIS occurs by determining a delta from observed counts for key models (activity generation,\nmode choice, destination choice, timing choice) and using this to adjust the Alternative Specific Constants\n(ASC) of that model. This is done by modifying the JSON files in the root of the project at specified\n'calibration' iterations and then allowing the model to stabilise before re-evaluating.",
   "type": "object",
   "properties": {
      "enabled": {
         "default": false,
         "title": "Enabled",
         "type": "boolean"
      },
      "target_csv_dir": {
         "default": "calibration_targets",
         "format": "path",
         "title": "Target Csv Dir",
         "type": "string"
      },
      "calibration_schedule": {
         "$ref": "#/$defs/CalibrationSchedule",
         "default": {
            "destination": {
               "every_x_iter": 5,
               "first_iteration": 1,
               "last_iteration": 21,
               "on_abm_init": false,
               "pattern": [
                  true,
                  false,
                  false,
                  false,
                  false,
                  true,
                  false,
                  false,
                  false,
                  false,
                  true,
                  false,
                  false,
                  false,
                  false,
                  true,
                  false,
                  false,
                  false,
                  false,
                  true
               ]
            },
            "mode": {
               "every_x_iter": 5,
               "first_iteration": 1,
               "last_iteration": 21,
               "on_abm_init": false,
               "pattern": [
                  true,
                  false,
                  false,
                  false,
                  false,
                  true,
                  false,
                  false,
                  false,
                  false,
                  true,
                  false,
                  false,
                  false,
                  false,
                  true,
                  false,
                  false,
                  false,
                  false,
                  true
               ]
            },
            "activity": {
               "every_x_iter": 5,
               "first_iteration": 1,
               "last_iteration": 21,
               "on_abm_init": false,
               "pattern": [
                  true,
                  false,
                  false,
                  false,
                  false,
                  true,
                  false,
                  false,
                  false,
                  false,
                  true,
                  false,
                  false,
                  false,
                  false,
                  true,
                  false,
                  false,
                  false,
                  false,
                  true
               ]
            },
            "timing": {
               "every_x_iter": 5,
               "first_iteration": 1,
               "last_iteration": 21,
               "on_abm_init": false,
               "pattern": [
                  true,
                  false,
                  false,
                  false,
                  false,
                  true,
                  false,
                  false,
                  false,
                  false,
                  true,
                  false,
                  false,
                  false,
                  false,
                  true,
                  false,
                  false,
                  false,
                  false,
                  true
               ]
            }
         }
      },
      "destination_vot_max_adj": {
         "default": 0.2,
         "title": "Destination Vot Max Adj",
         "type": "number"
      },
      "num_planned_activity_iterations": {
         "default": 0,
         "title": "Num Planned Activity Iterations",
         "type": "integer"
      },
      "step_size": {
         "default": 2.0,
         "title": "Step Size",
         "type": "number"
      }
   },
   "$defs": {
      "CalibrationSchedule": {
         "properties": {
            "destination": {
               "$ref": "#/$defs/IterationSchedule"
            },
            "mode": {
               "$ref": "#/$defs/IterationSchedule"
            },
            "activity": {
               "$ref": "#/$defs/IterationSchedule"
            },
            "timing": {
               "$ref": "#/$defs/IterationSchedule"
            }
         },
         "required": [
            "destination",
            "mode",
            "activity",
            "timing"
         ],
         "title": "CalibrationSchedule",
         "type": "object"
      },
      "IterationSchedule": {
         "properties": {
            "first_iteration": {
               "default": 1,
               "title": "First Iteration",
               "type": "integer"
            },
            "last_iteration": {
               "title": "Last Iteration",
               "type": "integer"
            },
            "every_x_iter": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "title": "Every X Iter"
            },
            "pattern": {
               "items": {
                  "type": "boolean"
               },
               "title": "Pattern",
               "type": "array"
            },
            "on_abm_init": {
               "default": false,
               "title": "On Abm Init",
               "type": "boolean"
            }
         },
         "required": [
            "last_iteration",
            "every_x_iter",
            "pattern"
         ],
         "title": "IterationSchedule",
         "type": "object"
      }
   }
}

Fields:
field enabled: bool = False#

Flag that defines whether the calibation is used or not in a model run

field target_csv_dir: Path = 'calibration_targets'#

Directory where the calibration target files are located (mode_choice_targets.csv, destination_choice_targets.csv, timing_choice_targets.csv, activity_generation_targets.csv)

field calibration_schedule: CalibrationSchedule = CalibrationSchedule(destination=IterationSchedule(first_iteration=1, last_iteration=21, every_x_iter=5, pattern=[True, False, False, False, False, True, False, False, False, False, True, False, False, False, False, True, False, False, False, False, True], on_abm_init=False), mode=IterationSchedule(first_iteration=1, last_iteration=21, every_x_iter=5, pattern=[True, False, False, False, False, True, False, False, False, False, True, False, False, False, False, True, False, False, False, False, True], on_abm_init=False), activity=IterationSchedule(first_iteration=1, last_iteration=21, every_x_iter=5, pattern=[True, False, False, False, False, True, False, False, False, False, True, False, False, False, False, True, False, False, False, False, True], on_abm_init=False), timing=IterationSchedule(first_iteration=1, last_iteration=21, every_x_iter=5, pattern=[True, False, False, False, False, True, False, False, False, False, True, False, False, False, False, True, False, False, False, False, True], on_abm_init=False))#

A schedule for when to do each type of calibration {activity, destination, mode, timing}

field destination_vot_max_adj: float = 0.2#

The maximum percentage change to adjust destination choice distance multiplier in a single step.

field num_planned_activity_iterations: int = 0#

Number of activity-generation only iterations that should be run for warm-starting the ASCs in the abm_init iteration

field step_size: float = 2.0#

The rate at which the calibrated ASCs are changed during each calibration iteration (e.g., 2 means calibrated values are increased/decreased by 2x the value they should be based on the gap in model outputs and targets)

normalise_paths()#