polaris.runs.convergence.convergence_config.ConvergenceConfig

Contents

polaris.runs.convergence.convergence_config.ConvergenceConfig#

pydantic model polaris.runs.convergence.convergence_config.ConvergenceConfig#

Bases: BaseModel

Configuration class for the POLARIS iterative convergence process

Show JSON schema
{
   "title": "ConvergenceConfig",
   "description": "Configuration class for the POLARIS iterative convergence process",
   "type": "object",
   "properties": {
      "uuid": {
         "default": null,
         "title": "Uuid",
         "type": "string"
      },
      "data_dir": {
         "default": ".",
         "format": "path",
         "title": "Data Dir",
         "type": "string"
      },
      "backup_dir": {
         "anyOf": [
            {
               "format": "path",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Backup Dir"
      },
      "archive_dir": {
         "default": "archive",
         "format": "path",
         "title": "Archive Dir",
         "type": "string"
      },
      "results_dir": {
         "default": null,
         "format": "path",
         "title": "Results Dir",
         "type": "string"
      },
      "db_name": {
         "default": null,
         "title": "Db Name",
         "type": "string"
      },
      "polaris_exe": {
         "anyOf": [
            {
               "format": "path",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Polaris Exe"
      },
      "cristal_exe": {
         "anyOf": [
            {
               "format": "path",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Cristal Exe"
      },
      "scenario_skim_file": {
         "default": "scenario_abm.json",
         "format": "path",
         "title": "Scenario Skim File",
         "type": "string"
      },
      "scenario_main_init": {
         "default": "scenario_abm.json",
         "format": "path",
         "title": "Scenario Main Init",
         "type": "string"
      },
      "scenario_main": {
         "default": "scenario_abm.json",
         "format": "path",
         "title": "Scenario Main",
         "type": "string"
      },
      "async_inline": {
         "default": false,
         "title": "Async Inline",
         "type": "boolean"
      },
      "num_threads": {
         "default": 48,
         "title": "Num Threads",
         "type": "integer"
      },
      "num_abm_runs": {
         "default": 2,
         "title": "Num Abm Runs",
         "type": "integer"
      },
      "num_dta_runs": {
         "default": 0,
         "title": "Num Dta Runs",
         "type": "integer"
      },
      "num_outer_loops": {
         "default": 1,
         "title": "Num Outer Loops",
         "type": "integer"
      },
      "start_iteration_from": {
         "anyOf": [
            {
               "type": "integer"
            },
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Start Iteration From"
      },
      "num_retries": {
         "default": 1,
         "title": "Num Retries",
         "type": "integer"
      },
      "use_numa": {
         "default": true,
         "title": "Use Numa",
         "type": "boolean"
      },
      "do_skim": {
         "default": false,
         "title": "Do Skim",
         "type": "boolean"
      },
      "do_cristal": {
         "default": false,
         "title": "Do Cristal",
         "type": "boolean"
      },
      "do_abm_init": {
         "default": false,
         "title": "Do Abm Init",
         "type": "boolean"
      },
      "do_pop_synth": {
         "default": false,
         "title": "Do Pop Synth",
         "type": "boolean"
      },
      "workplace_stabilization": {
         "$ref": "#/$defs/WorkplaceStabilizationConfig",
         "default": {
            "enabled": false,
            "schedule": {
               "every_x_iter": 5,
               "first_iteration": 1,
               "last_iteration": 31,
               "on_abm_init": false,
               "pattern": null
            }
         }
      },
      "calibration": {
         "$ref": "#/$defs/CalibrationConfig",
         "default": {
            "enabled": false,
            "target_csv_dir": "calibration_targets",
            "calibration_schedule": {
               "activity": {
                  "every_x_iter": 5,
                  "first_iteration": 1,
                  "last_iteration": 21,
                  "on_abm_init": false,
                  "pattern": null
               },
               "destination": {
                  "every_x_iter": 5,
                  "first_iteration": 1,
                  "last_iteration": 21,
                  "on_abm_init": false,
                  "pattern": null
               },
               "mode": {
                  "every_x_iter": 5,
                  "first_iteration": 1,
                  "last_iteration": 21,
                  "on_abm_init": false,
                  "pattern": null
               },
               "timing": {
                  "every_x_iter": 5,
                  "first_iteration": 1,
                  "last_iteration": 21,
                  "on_abm_init": false,
                  "pattern": null
               }
            },
            "destination_vot_max_adj": 0.2,
            "num_planned_activity_iterations": 0,
            "step_size": 2.0
         }
      },
      "do_routing_MSA": {
         "default": false,
         "title": "Do Routing Msa",
         "type": "boolean"
      },
      "realtime_informed_vehicle_market_share": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Realtime Informed Vehicle Market Share"
      },
      "skim_averaging_factor": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Skim Averaging Factor"
      },
      "capacity_expressway": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Capacity Expressway"
      },
      "capacity_arterial": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Capacity Arterial"
      },
      "capacity_local": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Capacity Local"
      },
      "population_scale_factor": {
         "default": 1.0,
         "title": "Population Scale Factor",
         "type": "number"
      },
      "trajectory_sampling": {
         "default": 0.01,
         "title": "Trajectory Sampling",
         "type": "number"
      },
      "add_rsus": {
         "default": false,
         "title": "Add Rsus",
         "type": "boolean"
      },
      "rsu_highway_pr": {
         "default": 0.0,
         "title": "Rsu Highway Pr",
         "type": "number"
      },
      "rsu_major_pr": {
         "default": 0.0,
         "title": "Rsu Major Pr",
         "type": "number"
      },
      "rsu_minor_pr": {
         "default": 0.0,
         "title": "Rsu Minor Pr",
         "type": "number"
      },
      "rsu_local_pr": {
         "default": 0.0,
         "title": "Rsu Local Pr",
         "type": "number"
      },
      "rsu_enabled_switching": {
         "default": false,
         "title": "Rsu Enabled Switching",
         "type": "boolean"
      },
      "fixed_connectivity_penetration_rates_for_cv": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Fixed Connectivity Penetration Rates For Cv"
      },
      "highway_skim_file_name": {
         "default": "highway_skim_file.omx",
         "title": "Highway Skim File Name",
         "type": "string"
      },
      "transit_skim_file_name": {
         "default": "transit_skim_file.omx",
         "title": "Transit Skim File Name",
         "type": "string"
      },
      "skim_interval_endpoints": {
         "default": [
            240,
            360,
            420,
            480,
            540,
            600,
            720,
            840,
            900,
            960,
            1020,
            1080,
            1140,
            1200,
            1320,
            1440
         ],
         "items": {
            "type": "integer"
         },
         "title": "Skim Interval Endpoints",
         "type": "array"
      },
      "seed": {
         "anyOf": [
            {
               "type": "integer"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Seed"
      },
      "skim_seed": {
         "anyOf": [
            {
               "type": "integer"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Skim Seed"
      },
      "skip_spatial_on_windows": {
         "default": false,
         "title": "Skip Spatial On Windows",
         "type": "boolean"
      },
      "user_data": {
         "anyOf": [
            {},
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "User Data"
      }
   },
   "$defs": {
      "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.",
         "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": null
                  },
                  "mode": {
                     "every_x_iter": 5,
                     "first_iteration": 1,
                     "last_iteration": 21,
                     "on_abm_init": false,
                     "pattern": null
                  },
                  "activity": {
                     "every_x_iter": 5,
                     "first_iteration": 1,
                     "last_iteration": 21,
                     "on_abm_init": false,
                     "pattern": null
                  },
                  "timing": {
                     "every_x_iter": 5,
                     "first_iteration": 1,
                     "last_iteration": 21,
                     "on_abm_init": false,
                     "pattern": null
                  }
               }
            },
            "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"
            }
         },
         "title": "CalibrationConfig",
         "type": "object"
      },
      "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": {
               "anyOf": [
                  {
                     "items": {
                        "type": "boolean"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "title": "Pattern"
            },
            "on_abm_init": {
               "default": false,
               "title": "On Abm Init",
               "type": "boolean"
            }
         },
         "required": [
            "last_iteration",
            "every_x_iter",
            "pattern"
         ],
         "title": "IterationSchedule",
         "type": "object"
      },
      "WorkplaceStabilizationConfig": {
         "description": "Configuration class for the POLARIS workplace stabilization process.\n\nWorkplace stabilization in POLARIS is the process by which long-term decisions regarding work location\nare introduced to an overall iterative process. Work places are allowed to be updated based on current\ncongestion conditions on specified iterations, a number of iterations are then run using those updated\nchoices to allow the congestion to stabilize before repeating the process.",
         "properties": {
            "enabled": {
               "default": false,
               "title": "Enabled",
               "type": "boolean"
            },
            "schedule": {
               "$ref": "#/$defs/IterationSchedule",
               "default": {
                  "first_iteration": 1,
                  "last_iteration": 31,
                  "every_x_iter": 5,
                  "pattern": null,
                  "on_abm_init": false
               }
            }
         },
         "title": "WorkplaceStabilizationConfig",
         "type": "object"
      }
   }
}

Config:
  • ignored_types: tuple = (<class ‘function’>,)

  • validate_assignment: bool = True

Fields:
Validators:
field data_dir: Path = PosixPath('.')#

The root directory of the model, defaults to the directory in which the convergence_control.yaml is located

field backup_dir: Path | None = None#

Deprecated: Folder where backup of the model data is created before running the model

field archive_dir: Path = PosixPath('archive')#

Deprecated: Folder from where to retrive archived data

field results_dir: Path = None#

Deprecated: Folder to where the results of the model are saved

Validated by:
field db_name: str = None#

The filename prefix used in each of the database filenames (i.e. Chicago => Chicago-Supply.sqlite, etc)

field polaris_exe: Path | None = None#

Path to the POLARIS executable to use. Three special values are supported for this: “model” - the binary that is located at ${data_dir}/bin/Integrated_Model, “polaris-studio” - the binary that ships with polaris-studio and “ci” - the latest CI executable (if available from your machine). If not specified will default to “model” if such exists, or to “polaris-studio” otherwise.

Validated by:
field cristal_exe: Path | None = None#

Deprecated: Funcitonality combined with the polaris_exe

field scenario_skim_file: Path = 'scenario_abm.json'#

Deprecated: File with scenario configuration for skimming

field scenario_main_init: Path = 'scenario_abm.json'#

Deprecated: File with scenario configuration for model initialization

field scenario_main: Path = 'scenario_abm.json'#

File containing the template scenario configuration which will be adapted based on the current iteration

Validated by:
field async_inline: bool = False#

Flag which controls if normally asynchronous post-processing steps (which aren’t needed for subsequent iterations) should be processed “in-line” to minimize the memory footprint. Set to True if you are having “Out of Memory” issues

field num_threads: int = 48#

Number of CPU threads to use during simulation

field num_abm_runs: int = 2#

Number of normal runs (ABM + DTA) to perform

field num_dta_runs: int = 0#

Number of DTA-only runs to perform for a fixed demand from a previous normal iteration

field num_outer_loops: int = 1#

Number of times a sequence of ABM+DTA and DTA-only runs will take place. For each num_outer_loop, num_abm_runs of ABM+DTA runs and num_dta_runs of DTA-only runs are simulated

field start_iteration_from: int | str | None = None#

If a model run was interrupted, start_iteration_from can be set to restart a particular iteration (i.e. 5, iteration_5, 00_skim_iteration)

field num_retries: int = 1#

Number of simulation crashes that are allowed before aborting the convergence process

field use_numa: bool = True#

Flag that controls whether we apply numa options to the POLARIS executable when it is run

field do_skim: bool = False#

Flag which controls whether a freeflow skimming iteration is undertaken at the beginning of the process. Note that this is rarely a good idea (compared to starting from existing skims) as POLARIS can take a considerable number of iterations to converge from a freeflow state

Validated by:
field do_cristal: bool = False#

Flag which controls whether a CRISTAL model run is undertaken at the beginning of the set of ABM runs. Cristal runs include abm_init so there are some internal flags to check that only one of the two can run at a time.

field do_abm_init: bool = False#

Flag which controls whether a model initialization iteration is run at the beginning of the process. This iteration will synthesize population, generates demand, and assigns demand to the network

field do_pop_synth: bool = False#

Flag which controls whether a separate population synthesis iteration is run at the beginning of the process

Validated by:
field workplace_stabilization: WorkplaceStabilizationConfig = WorkplaceStabilizationConfig(enabled=False, schedule=IterationSchedule(first_iteration=1, last_iteration=31, every_x_iter=5, pattern=None, on_abm_init=False))#

Configuration related to the workplace stabilization process

field calibration: CalibrationConfig = CalibrationConfig(enabled=False, target_csv_dir='calibration_targets', calibration_schedule=CalibrationSchedule(destination=IterationSchedule(first_iteration=1, last_iteration=21, every_x_iter=5, pattern=None, on_abm_init=False), mode=IterationSchedule(first_iteration=1, last_iteration=21, every_x_iter=5, pattern=None, on_abm_init=False), activity=IterationSchedule(first_iteration=1, last_iteration=21, every_x_iter=5, pattern=None, on_abm_init=False), timing=IterationSchedule(first_iteration=1, last_iteration=21, every_x_iter=5, pattern=None, on_abm_init=False)), destination_vot_max_adj=0.2, num_planned_activity_iterations=0, step_size=2.0)#

Configuration related to the calibration process

field do_routing_MSA: bool = False#

Deprecated: Flag controlling the use of MSA averaging across routing iterations

field realtime_informed_vehicle_market_share: float | None = None#

Share of vehicles that have connectivity and receive realtime information about network (pass-through to scenario file)

field skim_averaging_factor: float | None = None#

The proportional weight given to skims observed in the current iteration as they are mixed with previous iteration skims to produce the output skims for this iteration. Output = (1-w) * previous + w * current.

field capacity_expressway: float | None = None#

Capacity of the expressway functional class to be used for the convergence run (pass-through to scenario file)

field capacity_arterial: float | None = None#

Capacity of the arterial functional class to be used for the convergence run (pass-through to scenario file)

field capacity_local: float | None = None#

Capacity of the local functional class to be used for the convergence run (pass-through to scenario file)

field population_scale_factor: float = 1.0#

Population scaling factor

field trajectory_sampling: float = 0.01#

Proportion of trajectories that are written to the database in each simulation iteration (pass-through to scenario file)

classmethod construct(_fields_set: set[str] | None = None, **values: Any) Self#
copy(*, include: AbstractSetIntStr | MappingIntStrAny | None = None, exclude: AbstractSetIntStr | MappingIntStrAny | None = None, update: Dict[str, Any] | None = None, deep: bool = False) Self#

Returns a copy of the model.

!!! warning “Deprecated”

This method is now deprecated; use model_copy instead.

If you need include or exclude, use:

`python {test="skip" lint="skip"} data = self.model_dump(include=include, exclude=exclude, round_trip=True) data = {**data, **(update or {})} copied = self.model_validate(data) `

Args:

include: Optional set or mapping specifying which fields to include in the copied model. exclude: Optional set or mapping specifying which fields to exclude in the copied model. update: Optional dictionary of field-value pairs to override field values in the copied model. deep: If True, the values of fields that are Pydantic models will be deep-copied.

Returns:

A copy of the model with included, excluded and updated fields as specified.

dict(*, include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, by_alias: bool = False, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) Dict[str, Any]#
classmethod from_orm(obj: Any) Self#
json(*, include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, by_alias: bool = False, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Callable[[Any], Any] | None = PydanticUndefined, models_as_dict: bool = PydanticUndefined, **dumps_kwargs: Any) str#
classmethod model_construct(_fields_set: set[str] | None = None, **values: Any) Self#

Creates a new instance of the Model class with validated data.

Creates a new model setting __dict__ and __pydantic_fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed.

!!! note

model_construct() generally respects the model_config.extra setting on the provided model. That is, if model_config.extra == ‘allow’, then all extra passed values are added to the model instance’s __dict__ and __pydantic_extra__ fields. If model_config.extra == ‘ignore’ (the default), then all extra passed values are ignored. Because no validation is performed with a call to model_construct(), having model_config.extra == ‘forbid’ does not result in an error if extra values are passed, but they will be ignored.

Args:
_fields_set: A set of field names that were originally explicitly set during instantiation. If provided,

this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from the values argument will be used.

values: Trusted or pre-validated data dictionary.

Returns:

A new instance of the Model class with validated data.

model_copy(*, update: Mapping[str, Any] | None = None, deep: bool = False) Self#
!!! abstract “Usage Documentation”

[model_copy](../concepts/serialization.md#model_copy)

Returns a copy of the model.

!!! note

The underlying instance’s [__dict__][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).

Args:
update: Values to change/add in the new model. Note: the data is not validated

before creating the new model. You should trust this data.

deep: Set to True to make a deep copy of the model.

Returns:

New model instance.

model_dump(*, mode: Literal['json', 'python'] | str = 'python', include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) dict[str, Any]#
!!! abstract “Usage Documentation”

[model_dump](../concepts/serialization.md#modelmodel_dump)

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

Args:
mode: The mode in which to_python should run.

If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.

include: A set of fields to include in the output. exclude: A set of fields to exclude from the output. context: Additional context to pass to the serializer. by_alias: Whether to use the field’s alias in the dictionary key if defined. exclude_unset: Whether to exclude fields that have not been explicitly set. exclude_defaults: Whether to exclude fields that are set to their default value. exclude_none: Whether to exclude fields that have a value of None. round_trip: If True, dumped values should be valid as input for non-idempotent types such as Json[T]. warnings: How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors,

“error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].

fallback: A function to call when an unknown value is encountered. If not provided,

a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.

serialize_as_any: Whether to serialize fields with duck-typing serialization behavior.

Returns:

A dictionary representation of the model.

model_dump_json(*, indent: int | None = None, include: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, exclude: set[int] | set[str] | Mapping[int, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | Mapping[str, set[int] | set[str] | Mapping[int, IncEx | bool] | Mapping[str, IncEx | bool] | bool] | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal['none', 'warn', 'error'] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False) str#
!!! abstract “Usage Documentation”

[model_dump_json](../concepts/serialization.md#modelmodel_dump_json)

Generates a JSON representation of the model using Pydantic’s to_json method.

Args:

indent: Indentation to use in the JSON output. If None is passed, the output will be compact. include: Field(s) to include in the JSON output. exclude: Field(s) to exclude from the JSON output. context: Additional context to pass to the serializer. by_alias: Whether to serialize using field aliases. exclude_unset: Whether to exclude fields that have not been explicitly set. exclude_defaults: Whether to exclude fields that are set to their default value. exclude_none: Whether to exclude fields that have a value of None. round_trip: If True, dumped values should be valid as input for non-idempotent types such as Json[T]. warnings: How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors,

“error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].

fallback: A function to call when an unknown value is encountered. If not provided,

a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.

serialize_as_any: Whether to serialize fields with duck-typing serialization behavior.

Returns:

A JSON string representation of the model.

property model_extra: dict[str, Any] | None#

Get extra fields set during validation.

Returns:

A dictionary of extra fields, or None if config.extra is not set to “allow”.

property model_fields_set: set[str]#

Returns the set of fields that have been explicitly set on this model instance.

Returns:
A set of strings representing the fields that have been set,

i.e. that were not filled from defaults.

classmethod model_json_schema(by_alias: bool = True, ref_template: str = '#/$defs/{model}', schema_generator: type[~pydantic.json_schema.GenerateJsonSchema] = <class 'pydantic.json_schema.GenerateJsonSchema'>, mode: ~typing.Literal['validation', 'serialization'] = 'validation') dict[str, Any]#

Generates a JSON schema for a model class.

Args:

by_alias: Whether to use attribute aliases or not. ref_template: The reference template. schema_generator: To override the logic used to generate the JSON schema, as a subclass of

GenerateJsonSchema with your desired modifications

mode: The mode in which to generate the schema.

Returns:

The JSON schema for the given model class.

classmethod model_parametrized_name(params: tuple[type[Any], ...]) str#

Compute the class name for parametrizations of generic classes.

This method can be overridden to achieve a custom naming scheme for generic BaseModels.

Args:
params: Tuple of types of the class. Given a generic class

Model with 2 type variables and a concrete model Model[str, int], the value (str, int) would be passed to params.

Returns:

String representing the new class where params are passed to cls as type variables.

Raises:

TypeError: Raised when trying to generate concrete names for non-generic models.

model_post_init(context: Any, /) None#

Override this method to perform additional initialization after __init__ and model_construct. This is useful if you want to do some validation that requires the entire model to be initialized.

classmethod model_rebuild(*, force: bool = False, raise_errors: bool = True, _parent_namespace_depth: int = 2, _types_namespace: MappingNamespace | None = None) bool | None#

Try to rebuild the pydantic-core schema for the model.

This may be necessary when one of the annotations is a ForwardRef which could not be resolved during the initial attempt to build the schema, and automatic rebuilding fails.

Args:

force: Whether to force the rebuilding of the model schema, defaults to False. raise_errors: Whether to raise errors, defaults to True. _parent_namespace_depth: The depth level of the parent namespace, defaults to 2. _types_namespace: The types namespace, defaults to None.

Returns:

Returns None if the schema is already “complete” and rebuilding was not required. If rebuilding _was_ required, returns True if rebuilding was successful, otherwise False.

classmethod model_validate(obj: Any, *, strict: bool | None = None, from_attributes: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) Self#

Validate a pydantic model instance.

Args:

obj: The object to validate. strict: Whether to enforce types strictly. from_attributes: Whether to extract data from object attributes. context: Additional context to pass to the validator. by_alias: Whether to use the field’s alias when validating against the provided input data. by_name: Whether to use the field’s name when validating against the provided input data.

Raises:

ValidationError: If the object could not be validated.

Returns:

The validated model instance.

classmethod model_validate_json(json_data: str | bytes | bytearray, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) Self#
!!! abstract “Usage Documentation”

[JSON Parsing](../concepts/json.md#json-parsing)

Validate the given JSON data against the Pydantic model.

Args:

json_data: The JSON data to validate. strict: Whether to enforce types strictly. context: Extra variables to pass to the validator. by_alias: Whether to use the field’s alias when validating against the provided input data. by_name: Whether to use the field’s name when validating against the provided input data.

Returns:

The validated Pydantic model.

Raises:

ValidationError: If json_data is not a JSON string or the object could not be validated.

classmethod model_validate_strings(obj: Any, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) Self#

Validate the given object with string data against the Pydantic model.

Args:

obj: The object containing string data to validate. strict: Whether to enforce types strictly. context: Extra variables to pass to the validator. by_alias: Whether to use the field’s alias when validating against the provided input data. by_name: Whether to use the field’s name when validating against the provided input data.

Returns:

The validated Pydantic model.

classmethod parse_file(path: str | Path, *, content_type: str | None = None, encoding: str = 'utf8', proto: DeprecatedParseProtocol | None = None, allow_pickle: bool = False) Self#
classmethod parse_obj(obj: Any) Self#
classmethod parse_raw(b: str | bytes, *, content_type: str | None = None, encoding: str = 'utf8', proto: DeprecatedParseProtocol | None = None, allow_pickle: bool = False) Self#
classmethod schema(by_alias: bool = True, ref_template: str = '#/$defs/{model}') Dict[str, Any]#
classmethod schema_json(*, by_alias: bool = True, ref_template: str = '#/$defs/{model}', **dumps_kwargs: Any) str#
classmethod update_forward_refs(**localns: Any) None#
classmethod validate(value: Any) Self#
field add_rsus: bool = False#

Deprecated

field rsu_highway_pr: float = 0.0#

Deprecated

field rsu_major_pr: float = 0.0#

Deprecated

field rsu_minor_pr: float = 0.0#

Deprecated

field rsu_local_pr: float = 0.0#

Deprecated

field rsu_enabled_switching: bool = False#

Deprecated

field fixed_connectivity_penetration_rates_for_cv: float | None = None#
field highway_skim_file_name: str = 'highway_skim_file.omx'#

Name of the highway skim file

field transit_skim_file_name: str = 'transit_skim_file.omx'#

Name of the transit skim file

field skim_interval_endpoints: List[int] = [240, 360, 420, 480, 540, 600, 720, 840, 900, 960, 1020, 1080, 1140, 1200, 1320, 1440]#

An array of skimming intervals in minutes (since midnight) where each value denotes the end of the bin starting from the previous value or time 0

field seed: int | None = None#

Simulation seed for reproducible random number generator seeding. Note 0 evaluates to a random number.

field skim_seed: int | None = None#

Simulation skim seed for reproducible selection of skim locations and times. Note 0 evaluates to a random number.

field skip_spatial_on_windows: bool = False#

Setting to true will skip all spatial KPI operations when running on Windows to avoid user reported crashes

field user_data: Any | None = None#

user_data is a general purpose storage location that can used to carry study-specific parameters which need to be accessible inside callback methods across multiple iterations

field uuid: str = None#

Unique identifier of the model run. Not normally specified and will be populated with a random UUID if not provided

classmethod from_file(file: str | Path)#
classmethod from_dir(dir: str | Path)#
pretty_print(indent='')#
normalise_paths(relative_to)#
load_scenario_json()#
set_from_dict(_dict)#

Set underlying properties using an input dictionary of values. This is very useful when applying a batch of overrides programatically (i.e. via EQ/SQL). The given dictionary should have keys that correspond to named members (i.e. { “num_abm_runs”: 7 }) along with the desired state of that property. Nested members can be configured with nested dictionaries or using a.b syntax (i.e. {“workplace_stabilization.enabled”: False} or {“workplace_stabilization”: {“enabled”: True}} ).

supply_file(**kwargs)#
demand_file(**kwargs)#
result_file(**kwargs)#
iterations()#
filter_based_on_start_iter(iterations, start_from=None)#
check_exe()#
validator val_results_dir  »  results_dir#
validator default_polaris_exe  »  polaris_exe#
validator default_scenario_main  »  scenario_main#
validator default_do_pop_synth  »  do_pop_synth#
validator default_do_skim  »  do_skim#