Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 57 additions & 22 deletions src/datatypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -388,15 +388,22 @@ end

mutable struct _MBM{O, T, M <: JuMP.AbstractModel} <: AbstractReformulationMethod
optimizer::O
M::Dict{LogicalVariableRef{M}, T}
default_M::T
conlvref::Vector{LogicalVariableRef{M}}
M::Dict{LogicalVariableRef{M}, Any}
default_M::T
conlvref::Vector{LogicalVariableRef{M}}
Comment thread
dnguyen227 marked this conversation as resolved.
Outdated
deactivated::Set{LogicalVariableRef{M}}
# Stored submodels: indicator => GDPSubmodel.
# Typed Any so extensions can store different types.
store::Dict{LogicalVariableRef{M}, Any}
Comment thread
dnguyen227 marked this conversation as resolved.
Outdated

function _MBM(method::MBM{O, T}, model::M) where {O, T, M <: JuMP.AbstractModel}
new{O, T, M}(method.optimizer,
Dict{LogicalVariableRef{M}, T}(),
new{O, T, M}(
method.optimizer,
Dict{LogicalVariableRef{M}, Any}(),
method.default_M,
Vector{LogicalVariableRef{M}}()
Vector{LogicalVariableRef{M}}(),
Set{LogicalVariableRef{M}}(),
Dict{LogicalVariableRef{M}, Any}()
)
end
end
Expand Down Expand Up @@ -432,35 +439,63 @@ mutable struct _Hull{V <: JuMP.AbstractVariableRef, T} <: AbstractReformulationM
end

"""
cutting_planes{O} <: AbstractReformulationMethod
cutting_planes{O,T} <: AbstractReformulationMethod

A type for using the cutting planes approach for disjunctive constraints.

**Fields**
- `optimizer::O`: Optimizer to use when solving mini-models (required).
- `max_iter::Int`: Number of iterations (default = `3`).
- `seperation_tolerance::Float64`: Tolerance for the separation problem (default = `1e-6`).
- `seperation_tolerance::T`: Tolerance for the separation problem (default = `1e-6`).
- `final_reform_method::AbstractReformulationMethod`: Final reformulation
method to use after cutting planes (default = `BigM()`).
- `M_value::Float64`: Big-M value to use in the final reformulation (default = `1e9`).
- `M_value::T`: Big-M value to use in the final reformulation (default = `1e9`).
"""
struct cutting_planes{O} <: AbstractReformulationMethod
struct cutting_planes{O, T} <: AbstractReformulationMethod
Comment thread
dnguyen227 marked this conversation as resolved.
Outdated
optimizer::O;
max_iter::Int
seperation_tolerance::Float64
seperation_tolerance::T
final_reform_method::AbstractReformulationMethod
M_value::Float64
M_value::T
function cutting_planes(
optimizer::O;
max_iter::Int = 3,
seperation_tolerance::Float64 = 1e-6,
final_reform_method = BigM(),
M_value::Float64 = 1e9
) where {O}
new{O}(optimizer, max_iter, seperation_tolerance, final_reform_method, M_value)
optimizer::O;
max_iter::Int = 3,
seperation_tolerance::T = 1e-6,
final_reform_method = BigM(),
M_value::T = 1e9
) where {O, T}
new{O, T}(optimizer, max_iter, seperation_tolerance, final_reform_method, M_value)
end
end

################################################################################
# GDP SUBMODEL
################################################################################

"""
GDPSubmodel{M, V, W}

A unified submodel wrapper used by MBM and cutting plane
reformulations. It encapsulates a flat JuMP optimization
submodel built from a single disjunct's feasible region,
along with mappings back to the original model's variables.

## Fields
- `model::M`: The JuMP submodel representing a disjunct's
feasible region (constraints and variable bounds).
- `dec_vars::Vector{V}`: Ordered decision variables in
the submodel, matching the original model's ordering.
- `fwd::Dict{V, Vector{W}}`: Forward map from original
model variables to their submodel counterparts.
"""
struct GDPSubmodel{M <: JuMP.AbstractModel,
V <: JuMP.AbstractVariableRef,
W <: JuMP.AbstractVariableRef}
model::M
dec_vars::Vector{V}
fwd::Dict{V, Vector{W}}
Comment thread
dnguyen227 marked this conversation as resolved.
Outdated
end

"""
PSplit <: AbstractReformulationMethod

Expand Down Expand Up @@ -635,9 +670,9 @@ end
"""
VariableProperties(expr)::VariableProperties

Creates a `VariableProperties` object with blank variable info (no bounds, not fixed,
not binary/integer) from an expression. The `expr` argument is provided for
extensions to infer additional properties (e.g., parameter dependencies in InfiniteOpt).
Creates a `VariableProperties` object with blank variable info (no bounds, not fixed,
not binary/integer) from an expression. The `expr` argument is provided for
extensions to infer additional properties.

## Arguments
- `expr`: Expression for extensions to extract metadata from
Expand Down
Loading
Loading