Skip to content

[QRE] Dollar cost calculator - #3672

Closed
Dima Fedoriaka (fedimser) wants to merge 6 commits into
mainfrom
fedimser/cost-calc-2
Closed

[QRE] Dollar cost calculator#3672
Dima Fedoriaka (fedimser) wants to merge 6 commits into
mainfrom
fedimser/cost-calc-2

Conversation

@fedimser

@fedimser Dima Fedoriaka (fedimser) commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

This PR adds capability to Quantum Resource Estimator to compute monetary cost (in USD) of running an application.

User needs to specify how to compute USD cost for a specific Architecture, as a function of qubits and runtime. This can be done in multiple ways:

  • Setting field usd_cost_per_hour on Architecture object (see demo notebook). In this case it's assumed that the cost is proportional to runtime.
  • When using @qubit decorator, adding usd_cost_per_hour = ....
  • Overriding function cost_usd on subclass of Architecture.

In the resource estimator, if cost can be computed for at least one of estimates in the table, the table will have an additional column "USD cost", with estimated cost of running the application, rounded to 2 decimal digits.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the Python Quantum Resource Estimator (QRE) surface area to optionally compute and display an estimated monetary cost (USD) for each Pareto-optimal estimate, based on user-provided pricing logic on the target Architecture.

Changes:

  • Adds a cost_usd field to EstimationTableEntry and threads cost computation through result materialization.
  • Conditionally adds a "USD cost" column to the results table/DataFrame when at least one estimate has a computable cost.
  • Adds a unit test and a sample notebook demonstrating how to set usd_cost_per_hour to enable runtime-proportional costing.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
source/qdk_package/tests/qre/test_estimation.py Adds a test asserting that results include a "USD cost" column when pricing is configured.
source/qdk_package/qdk/qre/_results.py Adds cost_usd to EstimationTableEntry and computes it during from_result.
source/qdk_package/qdk/qre/_estimation.py Conditionally adds the "USD cost" column to the output table.
source/qdk_package/qdk/qre/_architecture.py Introduces usd_cost_per_hour, a default cost_usd hook, and exposes arch on ISAContext.
samples/qre/dollar_cost.ipynb Adds a demo notebook showing USD cost estimation in practice.
Suppressed comments (2)

source/qdk_package/qdk/qre/_architecture.py:76

  • The cost_usd docstring contains a typo/formatting issue (usd_cost_per_hour``) that makes the API guidance confusing.
        Subclasses need to define usd_`cost_per_hour` (if USD cost is proportional to 
        runtime) or override `cost_usd`.

source/qdk_package/qdk/qre/_architecture.py:85

  • Typo in docstring: "applicaiton" → "application".
            Otherwise, returns estimated cost of running an applicaiton, in dollars.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread source/qdk_package/qdk/qre/_architecture.py
Comment thread source/qdk_package/qdk/qre/_estimation.py
Comment thread source/qdk_package/qdk/qre/_architecture.py
Comment thread source/qdk_package/qdk/qre/_results.py

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Comment thread source/qdk_package/tests/qre/test_estimation.py Outdated
@fedimser

Copy link
Copy Markdown
Contributor Author

This is not correct domain model, because costs belong to Target, not to Architecture.

@fedimser
Dima Fedoriaka (fedimser) deleted the fedimser/cost-calc-2 branch September 8, 2026 15:55
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.

2 participants