"Simple Workflow Example" Error
I am following the example in the "Simple Workflow Example", also used as an example in the documentation for the `LeapHybridCQMSampler` in the documentation here. I followed the setup of the dwave sdk and the example code to the letter, but did not get the expected output when printing the solution:
>>> print(sampleset.first)
Expected Output:
Sample(sample={'i': 2.0, 'j': 2.0}, energy=-4.0, num_occurrences=1, ... is_feasible=True, is_satisfied=array([ True]))
Instead I got:
Sample(sample={'i': 4.0, 'j': 4.0}, energy=-16.0, num_occurrences=1, ... is_feasible=False, is_satisfied=array([ False]))
Can anyone offer any help?
Comments
well it works if I filter for samples that meet the constraints i.e.
Hello,
Thank you so much for reaching out to us.
That's correct, you will need to filter for feasible solutions first and then get the first entry.
This happens because infeasible solutions can have lower energies than feasible solutions and solutions are ordered by energy value by default.
We have passed your feedback along to our Documentation team, as it seems to be a bit confusing.
Please don't hesitate to reach out to us with more questions.
Please sign in to leave a comment.