dwave-system icon indicating copy to clipboard operation
dwave-system copied to clipboard

Add caching to clique embedding functions

Open arcondello opened this issue 6 years ago • 1 comments

Because the find_clique_embedding functions take a size as input, we could fairly easily add caching. Something like

emb = chimera.find_clique_embedding(7, 16, 16, 4, use_cache=True)

We would also need to handle the

emb = chimera.find_clique_embedding(['a', 'b', 'c'], 16, 16, 4, use_cache=True)

case.

Additional Context functools.lru_cache gets us most of the way there. We might want to also expose the cache size; 128 would cover all 64 clique embeddings for a fully yielded C16 but not the 192 for a P16 but if the user is dealing with different lattice sizes and/or working graphs they might want to store more.

arcondello avatar Sep 24 '19 15:09 arcondello

Please note that the clique embedder is quite inefficient at the moment, and for large k, it's basically computing the entire cache every time. Also, I'm working on a total rewrite -- so I'd recommend holding off on this for now.

boothby avatar Jun 08 '20 19:06 boothby

This was done as part of https://github.com/dwavesystems/dwave-system/pull/370

arcondello avatar Jan 26 '23 18:01 arcondello