-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
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
Add ConstrainedQuadraticModel.add_linear_constraints() method #1307
base: main
Are you sure you want to change the base?
Add ConstrainedQuadraticModel.add_linear_constraints() method #1307
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where `x` is a vector of decision variables, | |
where :math:`x` is a vector of decision variables, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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