MBM: optional GP-based M sampling on InfiniteGDP models - #139
Open
dnguyen227 wants to merge 14 commits into
Open
MBM: optional GP-based M sampling on InfiniteGDP models #139dnguyen227 wants to merge 14 commits into
dnguyen227 wants to merge 14 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #139 +/- ##
==========================================
+ Coverage 99.51% 99.53% +0.02%
==========================================
Files 17 19 +2
Lines 2061 2153 +92
==========================================
+ Hits 2051 2143 +92
Misses 10 10 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
Author
|
@pulsipher ready for review |
pulsipher
requested changes
Aug 25, 2026
pulsipher
left a comment
Collaborator
There was a problem hiding this comment.
This is better, but I think it can be made less complicated.
dnguyen227
commented
Aug 31, 2026
| julia> method = MBM(HiGHS.Optimizer, sampler = GPSampler(kappa = 4.0)) | ||
| ``` | ||
| """ | ||
| struct GPSampler{K} <: AbstractMBMSampler |
Contributor
Author
There was a problem hiding this comment.
Move to AbstractGPsDisjunctiveProgramming.jl
dnguyen227
commented
Sep 2, 2026
Comment on lines
+7
to
+46
| ################################################################################ | ||
| # SAMPLER CONFIG | ||
| ################################################################################ | ||
| # The concrete sampler behind DP.GPSampler; the base package only | ||
| # carries the function stub, so constructing one requires AbstractGPs. | ||
| struct _GPSampler{F} <: DP.AbstractMBMSampler | ||
| f::F | ||
| std_dev_margin::Float64 | ||
| frac_supports::Float64 | ||
| detect_uniform_M::Bool | ||
| initial_supports::Union{Int, Vector{Float64}} | ||
|
|
||
| function _GPSampler( | ||
| f::F; | ||
| std_dev_margin::Real = 2.5, | ||
| frac_supports::Real = 0.25, | ||
| detect_uniform_M::Bool = true, | ||
| initial_supports = 4 | ||
| ) where {F} | ||
| f isa Union{Nothing, AbstractGPs.GP} || error( | ||
| "`f` must be an `AbstractGPs.GP` prior, e.g. " * | ||
| "`GP(Matern52Kernel())`.") | ||
| std_dev_margin >= 0 || error("`std_dev_margin` must be nonnegative.") | ||
| 0 < frac_supports <= 1 || error("`frac_supports` must be in `(0, 1]`.") | ||
| if initial_supports isa Int | ||
| initial_supports >= 2 || | ||
| error("`initial_supports` must be at least 2.") | ||
| else | ||
| initial_supports = collect(Float64, initial_supports) | ||
| (!isempty(initial_supports) && | ||
| all(frac -> 0 <= frac <= 1, initial_supports)) || | ||
| error("`initial_supports` must be fractions in `[0, 1]`.") | ||
| end | ||
| new{F}(f, Float64(std_dev_margin), Float64(frac_supports), | ||
| detect_uniform_M, initial_supports) | ||
| end | ||
| end | ||
|
|
||
| DP.GPSampler(f = nothing; kwargs...) = _GPSampler(f; kwargs...) | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implementation of MBM
Not sure how to work around needing to make a new extension.