dwavesystems / dwavesystems/dimod
Display constraint weight and penalty in CQM
- Dominant language
- Python
- Stars
- 143
- Forks
- 91
- Avg merge
- 1h 24m
- Merged PRs (30d)
- 3
Description
**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**
```
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.
Contributor guide
Assessment
This issue has not been assessed yet.