We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
dimod.CQM.constraint
Alternatives Considered If that causes backward compatibility, maybe a new field. .
Additional Context
cqm1 = dimod.ConstrainedQuadraticModel() a = dimod.Integer('a') cqm1.add_constraint(a <= 3, weight=55, penalty="linear", label="Soft constraint") cqm1.constraints["Soft constraint"]
Output Le(QuadraticModel({'a': 1.0}, {}, 0.0, {'a': 'INTEGER'}, dtype='float64'), 3) gives no hint of the type of constraint.
Le(QuadraticModel({'a': 1.0}, {}, 0.0, {'a': 'INTEGER'}, dtype='float64'), 3)
The text was updated successfully, but these errors were encountered:
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
Sorry, something went wrong.
We should make that a non-internal method though, right?
No branches or pull requests
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.The text was updated successfully, but these errors were encountered: