Configuration Builder

The ConfigurationBuilder is the entry point for assembling a configuration. Use set_* methods to attach an algorithm, model configuration, schedule, and model property; use add_* methods to register data sources and report properties; call write_to_file() to emit model-configuration.json.

Related pages:

Top-level ConfigurationBuilder for assembling a Daitum model configuration.

A configuration ties an Algorithm and a ModelConfiguration to the data sources, schedule, and model/report properties that surround them. ConfigurationBuilder.write_to_file() serialises the result into model-configuration.json.

class ConfigurationBuilder[source]

Builder for a complete model configuration.

Use set_* methods to attach the algorithm, model configuration, schedule, and model property; use add_* methods to register data sources and report properties; call write_to_file() to emit model-configuration.json.

set_algorithm(algorithm)[source]

Set the top-level algorithm. Mutually exclusive with a schedule.

Return type:

ConfigurationBuilder

set_model_configuration(model_configuration)[source]

Set the ModelConfiguration (decision variables, objectives, constraints).

Return type:

ConfigurationBuilder

set_schedule_configuration(schedule_configuration)[source]

Set a multi-step schedule. Mutually exclusive with a single algorithm.

Return type:

ConfigurationBuilder

set_solution_view_allowed(solution_view_allowed)[source]

Set whether the solution-view feature is permitted for this model.

Return type:

ConfigurationBuilder

set_solution_view_enabled(solution_view_enabled)[source]

Set whether the solution view is enabled by default when allowed.

Return type:

ConfigurationBuilder

add_report_property(key, report_property)[source]

Register a ReportProperty under the given key.

Return type:

ConfigurationBuilder

set_model_property(calculate_on_load=True, calculation_enabled=True, ignore_formula=False, import_options=None, overlay_config=None)[source]

Construct and attach a ModelProperty from the given flags and configurations.

Return type:

ConfigurationBuilder

add_excel_transform(name, config)[source]

Register an Excel-transform data source and return its DataSource wrapper for further customisation (e.g. set_post_optimise).

Return type:

DataSource

add_model_transform(name, config)[source]

Register a model-transform data source. See add_excel_transform() for the return value.

Return type:

DataSource

add_data_store(name, config)[source]

Register a data-store data source. See add_excel_transform() for the return value.

Return type:

DataSource

add_batched_data_source(name, config)[source]

Register a batched data source bundling other data sources. See add_excel_transform() for the return value.

Return type:

DataSource

add_report_data_source(name, report_name)[source]

Register a data source that feeds rows from a previously-run report. See add_excel_transform() for the return value.

Return type:

DataSource

add_external_model_data_source(name)[source]

Register a data source that runs the model’s configured external evaluator. Input, parameter, and output mappings are declared on ExternalModelConfiguration. See add_excel_transform() for the return value.

Return type:

DataSource

add_distance_matrix(name, config)[source]

Register a distance-matrix data source. See add_excel_transform() for the return value.

Return type:

DataSource

add_set_features(name, config)[source]

Register a feature-flag data source. See add_excel_transform() for the return value.

Return type:

DataSource

add_geo_location(name, config)[source]

Register a geocoding data source. See add_excel_transform() for the return value.

Return type:

DataSource

write_to_file(model_directory)[source]

Serialise this configuration into model-configuration.json under model_directory, creating the directory if it does not exist.

Return type:

None