Add ConstrainedQuadraticModel.add_linear_constraints() method#1307
Add ConstrainedQuadraticModel.add_linear_constraints() method#1307arcondello wants to merge 3 commits intodwavesystems:mainfrom
Conversation
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## main #1307 +/- ##
==========================================
- Coverage 91.70% 91.69% -0.01%
==========================================
Files 94 94
Lines 10135 10147 +12
==========================================
+ Hits 9294 9304 +10
- Misses 841 843 +2
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
JoelPasvolsky
left a comment
There was a problem hiding this comment.
Just looked at the docstring so far, I can get back to the code later if needed
| ): | ||
| r"""Add multiple linear constraints to the model. | ||
|
|
||
| Add linear constraints defined by |
There was a problem hiding this comment.
| Add linear constraints defined by | |
| Add linear constraints defined by the following upper-boundary and equality conditions |
to clarify ub and eq
| A_{ub}x \le b_{ub}, \\ | ||
| A_{eq}x = b_{eq} | ||
|
|
||
| where `x` is a vector of decision variables, |
There was a problem hiding this comment.
| where `x` is a vector of decision variables, | |
| where :math:`x` is a vector of decision variables, |
There was a problem hiding this comment.
It's the same formatting, you only need to use :math: when you want to use latex etc.
| variable_labels: The variable labels corresponding to the columns of `A`. | ||
| If ``None``, defaults to ``range(A.shape[1])``. | ||
| constraint_labels: The labels of the constraints. Labels of additional | ||
| constraints are generated. |
There was a problem hiding this comment.
Do you mean here something like, "Labels are generated for any unlabeled constraints"?
| Bounds | ||
| <BLANKLINE> | ||
|
|
||
| We can also use :class:`str`-labelled variables |
There was a problem hiding this comment.
| We can also use :class:`str`-labelled variables | |
| You can also label the variables: |
Is it helpful to point out that labels are strings? Would they be something else?
There was a problem hiding this comment.
I am distinguishing them from the int-labelled ones from before, but I can clarify the intent
Co-authored-by: Joel Pasvolsky <34041130+JoelPasvolsky@users.noreply.github.com>
mhramani
left a comment
There was a problem hiding this comment.
LGTM, maybe useful to add something like:
`cqm.add_linear_objective(c, variable_labels=...)'
Speeds up adding linear constraints to the CQM. We get about a 10x speedup.
Gives