Open JoelPasvolsky opened 1 year ago
If you want to check whether the constraint is hard or soft you can use
try:
print(cqm1._soft["Soft constraint"])
except KeyError:
print("not a soft constraint")
and that will show the weight and penalty
We should make that a non-internal method though, right?
Application I want to be able to see whether I set a hard or soft constraint on my CQM and what value of weight & penalty fo rsoft constraints.
Proposed Solution Display as part of the
dimod.CQM.constraint
Alternatives Considered If that causes backward compatibility, maybe a new field. .
Additional Context
Output
Le(QuadraticModel({'a': 1.0}, {}, 0.0, {'a': 'INTEGER'}, dtype='float64'), 3)
gives no hint of the type of constraint.