Skip to content

Support JuMP.value for Logical Variables#96

Merged
pulsipher merged 2 commits intomasterfrom
logical_value
Dec 6, 2023
Merged

Support JuMP.value for Logical Variables#96
pulsipher merged 2 commits intomasterfrom
logical_value

Conversation

@pulsipher
Copy link
Collaborator

Closes #94. It also alphabetizes the Project file to fix an Aqua test failure.

@pulsipher pulsipher requested a review from hdavid16 December 5, 2023 20:57
@codecov
Copy link

codecov bot commented Dec 5, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (3879754) 99.90% compared to head (97de4cd) 99.90%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master      #96   +/-   ##
=======================================
  Coverage   99.90%   99.90%           
=======================================
  Files          10       10           
  Lines        1001     1003    +2     
=======================================
+ Hits         1000     1002    +2     
  Misses          1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hdavid16
Copy link
Collaborator

hdavid16 commented Dec 6, 2023

Thanks for putting this together. What are your thoughts on returning the corresponding Bool instead of 0 or 1? Should be a simple update: value(binary) == 1 (or use isone).

@pulsipher
Copy link
Collaborator Author

Thanks for putting this together. What are your thoughts on returning the corresponding Bool instead of 0 or 1? Should be a simple update: value(binary) == 1 (or use isone).

I thought about this, but the problem is MIP solvers return binary variable solutions as Float64 not 0 or 1. So, we would need to use some sort of tolerance to round to the appropriate integer solution and then convert to Bool. I would prefer to not hard-code some tolerance or add more complexity to value by adding a keyword that would only work on logical variables.

@hdavid16
Copy link
Collaborator

hdavid16 commented Dec 6, 2023

That is a good point. Since the value is binary, what about comparing it to 0.5 (value > 0.5)?

@pulsipher
Copy link
Collaborator Author

Ok, I have changed it to round based on 0.5.

@pulsipher pulsipher merged commit d1e6cf4 into master Dec 6, 2023
@pulsipher pulsipher deleted the logical_value branch December 6, 2023 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support JuMP.value for LogicalVariableRef

2 participants