Scenario Result

The ScenarioResult is the container for all data produced by an Algorithm’s run method. It acts as a detailed snapshot of a “solution” to a specific problem, capturing both metadata (like the time of completion) and domain-specific outputs.

For a more intuitive discussion of the concepts behind scenario results, see the Scenario Result.

Scenario result containers.

BaseScenarioResult mirrors algomancy_data.datasource.BaseDataSource: subclasses MUST implement to_json / from_json to participate in database persistence. Subclasses whose state decomposes into one or more DataFrames can additionally implement algomancy_scenario.persistence.protocols.SqlResultLayout to land each DataFrame in a real, externally queryable SQL table.

class algomancy_scenario.result.BaseScenarioResult(data_id)[source]

Bases: ABC

abstractmethod to_dict()[source]
abstractmethod to_json()[source]

Serialise the full result to a JSON string.

The output must round-trip through from_json(). Used as the JSON-blob fallback path by SqlScenarioRepository when the subclass does not implement SqlResultLayout.

abstractmethod classmethod from_json(json_string)[source]

Reconstruct an instance from the string produced by to_json().

class algomancy_scenario.result.ScenarioResult(data_id)[source]

Bases: BaseScenarioResult

Bundled minimal result: carries only data_id and completed_at.

to_dict()[source]
to_json()[source]

Serialise the full result to a JSON string.

The output must round-trip through from_json(). Used as the JSON-blob fallback path by SqlScenarioRepository when the subclass does not implement SqlResultLayout.

classmethod from_json(json_string)[source]

Reconstruct an instance from the string produced by to_json().