Skip to content

Migrate dft and pars to experimental new generic handling - #445

Draft
linusheck wants to merge 2 commits into
masterfrom
generic-types
Draft

Migrate dft and pars to experimental new generic handling#445
linusheck wants to merge 2 commits into
masterfrom
generic-types

Conversation

@linusheck

Copy link
Copy Markdown
Contributor

Adds a new generic handling that automatically generates instantiations for the given types and then puts a wrapper (in _template.py) around it to allow for this functionality:

# Readable aliases:
assert stormpy.dft._dft._DFT_Double is stormpy.dft.DFT[float]
assert stormpy.dft._dft._DFT_RationalFunction is stormpy.dft.DFT[stormpy.RationalFunction]

path = stormpy.examples.files.dft_json_and
double_dft = stormpy.dft.load_dft_json_file(path)
assert type(double_dft) is stormpy.dft.DFT[float]

rational_function_dft = stormpy.dft.load_parametric_dft_json_file(path)
assert type(rational_function_dft) is stormpy.dft.DFT[stormpy.RationalFunction]

# Construct a specialization explicitly:
explicit_builder = stormpy.dft.ExplicitDFTModelBuilder[float](double_dft)
assert type(explicit_builder) is stormpy.dft.ExplicitDFTModelBuilder[float]

# Or deduce the specialization from the constructor argument:
inferred_builder = stormpy.dft.ExplicitDFTModelBuilder(rational_function_dft)
assert type(inferred_builder) is stormpy.dft.ExplicitDFTModelBuilder[stormpy.RationalFunction]

# Overloaded functions call the specialization:
concrete_model = stormpy.dft.build_model(double_dft)
assert not concrete_model.supports_parameters

parametric_model = stormpy.dft.build_model(rational_function_dft)
assert parametric_model.supports_parameters

This replaces the custom Python wrapper functions that currently check input types.

@linusheck
linusheck marked this pull request as draft August 25, 2026 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant