Skip to content

Assess "formulas" package to replace "cost_model_queries" for sampling the cost models #21

@Rosejoycrocker

Description

@Rosejoycrocker

In light of potential changes to future versions of the cost models, it might be helpful to consider moving to a Python-based package for precompiling and accessing the cost model workbooks which does not rely on the COM server (as cost_model_queries does).

For example "formulas" could be used https://formulas.readthedocs.io/en/stable/ , as it seems fairly easy to use and well-maintained.

Formula's uses the following syntax to calculate outputs from a model:
xl_model.calculate(
inputs={
"'[excel.xlsx]'!INPUT_A": 3, # To overwrite the default value.
"'[excel.xlsx]DATA'!B3": 1 # To impose a value to B3 cell.
},
outputs=[
"'[excel.xlsx]DATA'!C2", "'[excel.xlsx]DATA'!C4"
] # To define the outputs that you want to calculate.
)

So the replacement would require writing some bridging functions that identify where inputs need to be added for each sample of cost model inputs, recalculating and extracting the result and then repeating this for each sample.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions