Skip to content

Basiav/sampleset info extraction#55

Open
basiav wants to merge 22 commits intomainfrom
basiav/sampleset_info_extraction
Open

Basiav/sampleset info extraction#55
basiav wants to merge 22 commits intomainfrom
basiav/sampleset_info_extraction

Conversation

@basiav
Copy link
Copy Markdown
Collaborator

@basiav basiav commented Jul 6, 2025

Added optional DWave sampleset metadata extraction (https://docs.dwavequantum.com/en/latest/quantum_research/operation_timing.html).

Added optional time measurements to Advantage with units:

  • find_embedding(),
  • find_clique_embeding(),
  • .sample(),
  • creating FixedEmbeddingComposite object (not necessary for the future but just to make sure for now).

@basiav basiav requested a review from kacper3615 July 6, 2025 15:15
chain_strength: float | None = None,
use_clique_embedding: bool = False,
token: str | None = None,
elapse_times: bool = False,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Didn't we consider that the flag that refers to measuring time should be in the method, not in the whole class?

Copy link
Copy Markdown
Collaborator Author

@basiav basiav Jul 16, 2025

Choose a reason for hiding this comment

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

I opened up an issue related to this: #57 (comment) (and your kacper3615/penalty_weights btw).

Please take a look at the Advantage.init function:
obraz

As we put the find_clique_embedding func. call in the .init (and rightly, follows later on why) and the timing measurements are optional, some flag needs to determine it.

Please note that a similar issue occurs with penalty_weights due to the same reason of find_clique_embedding in the .init.


return SolverResult(result, {"penalty_weights": penalty_weights}, [])
return SolverResult(
result, {"penalty_weights": penalty_weights}, [], sampleset_info
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It should be changed based on the changes suggested in the comment above

Copy link
Copy Markdown
Collaborator Author

@basiav basiav Jul 16, 2025

Choose a reason for hiding this comment

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

Not sure I understand this one, could you take a look at it if it's ok now or describe it once again?



def execute_timed(
func: Callable, measure_time: bool, times_dict: Dict, key: str
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Here there should be no mesure_time flag. Unless we want to measure time we should not perform this method, so I would remove this flag

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Please take a look of how this method is called in the code.

The idea of this function is to wrap a function with the start = time.perf_counter() and end = time.perf_counter() clauses to facultatively measure function's execution time.
It is to avoid explicit "ifs" in the .solve code in many places (4 function calls to measure) (boilerplate).

Please let me know if you'd like to:

  • stay with the execute_timed function - minimal overhead, quickest.
  • a decorator function - esthetic reasons, minimally slower.

Unless we want to always measure time - the execution overhead is nothing - just time.perf_counter call). But I wouldn't do it, it's unclean.

Copy link
Copy Markdown
Collaborator

@kacper3615 kacper3615 left a comment

Choose a reason for hiding this comment

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

I wrote comments next to the proposed changes

@basiav
Copy link
Copy Markdown
Collaborator Author

basiav commented Jul 16, 2025

  1. I have corrected the obvious changes and commented on the non-obvious ones - what I haven't changed and why not.
  2. I've opened up an issue, common to my changes and your penalty_weights

#57 (comment)

which is software engineering problem.

obraz

It also regards kacper3615/bug_fixes.

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