Open arcondello opened 4 years ago
I see why using a flag would be annoying, but can you say something about the advantages of setting this at invocation versus some attribute you can set later?
@JoelPasvolsky , I am not sure I understand, can you make a quick pseudo code snippet like above?
Something like this:
>>> sampler = DWaveSampler()
>>> sampler.default_coordinates = "coordinates"
>>> (0, 0, 0, 0) in sampler.nodelist
True
>>> sampler.default_coordinates = "nice_coordinates"
>>> (0, 0, 0, 0) in sampler.nodelist
False
Part of the reason is that we generally consider the attributes of the dimod Samplers to be 'static', because otherwise you might get things like
>>> qpu = DWaveSampler()
>>> sampler = FixedEmbeddingComposite(DWaveSampler(), embedding_using_index)
>>> qpu.default_coordinates = "nice" # this breaks the sampler
(the exception is the failover flag, which we explicitly warn about)
That said, a method like DWaveSampler.change_coordinates
could definitely also exist, if it came with appropriate documentation.
Okay, thanks, I saw that as the user needing to be responsible for being consistent in using a coordinate scheme rather than breaking the sampler, but it is safer to use separate ones like sampler = FixedEmbeddingComposite(DWaveSampler(coordinates=True), embedding)
and sampler_nice = FixedEmbeddingComposite(DWaveSampler(nice_coordinates=True), nice_embedding)
Something like
There are a few problems with this though:
chimera_graph
's coordinates kwarg andpegasus_graph
's coordinates and nice_coordinates kwargs. One approach,coordinates
could switch depending on the topology whilenice_coordaintes
could be consistent from chimera-to-pegasus. This might create issues for future topologies.