-
Notifications
You must be signed in to change notification settings - Fork 21
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
penaltymodel-maxgap energy levels #76
penaltymodel-maxgap energy levels #76
Conversation
ede66a4
to
f78a14e
Compare
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 good overall. I just had some small suggestions.
@@ -57,6 +70,9 @@ def generate_ising(graph, feasible_configurations, decision_variables, | |||
to a non-zero infeasible gap. | |||
|
|||
""" | |||
if len(graph) == 0: | |||
return dimod.BinaryQuadraticModel.empty(dimod.SPIN), float('inf') |
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.
When MIP finds that it is given a table with no feasible configurations, it returns a zero-ed out BQM and a gap of zero. Here, MaxGap is returning an empty model and a gap of infinity. Perhaps we should have a consistent default gap when bad argument is given?
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.
Good idea. What do you think makes more sense?
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 like a gap of infinity because I think it's unlikely that a user would choose that as a gap. Hence, when you see it's an infinity you know it's an error or a computer generated default.
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 think this is out-of-scope for this PR then. See #79
* remove six dependency * refactor Theta class to use dimod's BQM object for logic * change generate_ising to generate which now returns a BQM * refactor unittests * fix offset bug
BQMs in which every configuration have a specified energy should be treated as having infinite gap. Reasoning: * It tests against gap>0 which is a good shorthand for a valid penalty model * The intuition is that if one increased energy from ground and stops when the first infeasible state is reached is maintained. In that case the energy would increase -> inf
88130d9
to
446b9fa
Compare
Codecov Report
@@ Coverage Diff @@
## master #76 +/- ##
=========================================
- Coverage 96.04% 95.94% -0.1%
=========================================
Files 26 28 +2
Lines 1389 1358 -31
=========================================
- Hits 1334 1303 -31
Misses 55 55
Continue to review full report at Codecov.
|
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.
Looks good. Just noticed a small typo.
Provides the structure for Theta. | ||
|
||
linear_energy_ranges (dict): | ||
A dict of the form {v: (min, max, ...} where min and max are the |
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.
Missing closing parethesis. v: (min, max)
Closes #73