-
Notifications
You must be signed in to change notification settings - Fork 81
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
Adding the unbalanced penalization method #1347
Adding the unbalanced penalization method #1347
Conversation
Following recent thread about the unbalanced penalization equation to encode inequality constraints. dwavesystems#1339
Structure looks good! As you say, needs some tests and a release note, but I like the direction. |
Codecov Report
@@ Coverage Diff @@
## main #1347 +/- ##
==========================================
- Coverage 95.08% 95.06% -0.02%
==========================================
Files 95 95
Lines 9902 9912 +10
==========================================
+ Hits 9415 9423 +8
- Misses 487 489 +2
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
…lejomonbar/dimod into Adding_unbalanced_penalization
@arcondello please let me know what you think of how it is now. |
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 a few aesthetic comments
cross_zero: bool = False, | ||
penalization_method: str = "slack", | ||
) -> Iterable[Tuple[Variable, int]]: | ||
"""Add a linear inequality constraint as a quadratic objective. |
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 looks like everything got indented by an additional tab?
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 fixed it! @arcondello
lb: int = np.iinfo(np.int64).min, | ||
ub: int = 0, | ||
cross_zero: bool = False, | ||
penalization_method: str = "slack", |
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.
penalization_method: str = "slack", | |
penalization_method: typing.Literal["slack", "unbalanced"] = "slack", |
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.
Added @arcondello
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! I took the liberty of making some minor edits to the release note to fit some esoteric formatting rules. I'll merge once the CI tests pass
@arcondello I'm thinking I can also add a tutorial for this new feature. Do you know where can I put that tutorial? |
How big of a tutorial did you have in mind? If it's something short and simple, then the docstring of modified method is definitely the easiest. |
Following a recent thread about the unbalanced penalization method to encode inequality constraints. #1339.
Still is left to implement the test, but I want to know if the structure is ok @arcondello?