API
DisjunctiveProgramming.@disjunction
— Macro@disjunction(model, expr, kw_args...)
Add a disjunction described by the expression expr
, which must be a Vector
of LogicalVariableRef
s.
@disjunction(model, ref[i=..., j=..., ...], expr, kw_args...)
Add a group of disjunction described by the expression expr
parameterized by i
, j
, ..., which must be a Vector
of LogicalVariableRef
s.
In both of the above calls, a Disjunct
tag can be added to create nested disjunctions.
The recognized keyword arguments in kw_args
are the following:
base_name
: Sets the name prefix used to generate constraint names. It corresponds to the constraint name for scalar constraints, otherwise, the constraint names are set tobase_name[...]
for each index...
of the axesaxes
.container
: Specify the container type.exactly1
: Specify aBool
whether a constraint should be added to only allow selecting one disjunct in the disjunction.
To create disjunctions without macros, see disjunction
.
DisjunctiveProgramming.@disjunctions
— Macro@disjunctions(model, args...)
Adds groups of disjunctions at once, in the same fashion as the @disjunction
macro.
The model must be the first argument, and multiple disjunctions can be added on multiple lines wrapped in a begin ... end
block.
The macro returns a tuple containing the disjunctions that were defined.
Example
julia model = GDPModel(); @variable(model, w); @variable(model, x); @variable(model, Y[1:4], LogicalVariable); @constraint(model, [i=1:2], w == i, Disjunct(Y[i])); @constraint(model, [i=3:4], x == i, Disjunct(Y[i])); @disjunctions(model, begin [Y[1], Y[2]] [Y[3], Y[4]] end);
`
DisjunctiveProgramming.binary_variable
— Methodbinary_variable(vref::LogicalVariableRef)::JuMP.AbstractVariableRef
Returns the underlying binary variable for the logical variable vref
which is used in the reformulated model. This is helpful to embed logical variables in algebraic constraints.
DisjunctiveProgramming.disjunction
— Functiondisjunction(
+API · DisjunctiveProgramming.jl API
DisjunctiveProgramming.@disjunction
— Macro@disjunction(model, expr, kw_args...)
Add a disjunction described by the expression expr
, which must be a Vector
of LogicalVariableRef
s.
@disjunction(model, ref[i=..., j=..., ...], expr, kw_args...)
Add a group of disjunction described by the expression expr
parameterized by i
, j
, ..., which must be a Vector
of LogicalVariableRef
s.
In both of the above calls, a Disjunct
tag can be added to create nested disjunctions.
The recognized keyword arguments in kw_args
are the following:
base_name
: Sets the name prefix used to generate constraint names. It corresponds to the constraint name for scalar constraints, otherwise, the constraint names are set to base_name[...]
for each index ...
of the axes axes
.container
: Specify the container type.exactly1
: Specify a Bool
whether a constraint should be added to only allow selecting one disjunct in the disjunction.
To create disjunctions without macros, see disjunction
.
sourceDisjunctiveProgramming.@disjunctions
— Macro@disjunctions(model, args...)
Adds groups of disjunctions at once, in the same fashion as the @disjunction
macro.
The model must be the first argument, and multiple disjunctions can be added on multiple lines wrapped in a begin ... end
block.
The macro returns a tuple containing the disjunctions that were defined.
Example
julia model = GDPModel(); @variable(model, w); @variable(model, x); @variable(model, Y[1:4], LogicalVariable); @constraint(model, [i=1:2], w == i, Disjunct(Y[i])); @constraint(model, [i=3:4], x == i, Disjunct(Y[i])); @disjunctions(model, begin [Y[1], Y[2]] [Y[3], Y[4]] end);
`
sourceDisjunctiveProgramming.binary_variable
— Methodbinary_variable(vref::LogicalVariableRef)::JuMP.AbstractVariableRef
Returns the underlying binary variable for the logical variable vref
which is used in the reformulated model. This is helpful to embed logical variables in algebraic constraints.
sourceDisjunctiveProgramming.disjunction
— Functiondisjunction(
model::JuMP.AbstractModel,
disjunct_indicators::Vector{LogicalVariableRef},
[nested_tag::Disjunct],
[name::String = ""];
[exactly1::Bool = true]
-)
Create a disjunction comprised of disjuncts with indicator variables disjunct_indicators
and add it to model
. For nested disjunctions, the nested_tag
is required to indicate which disjunct it will be part of in the parent disjunction. By default, exactly1
adds a constraint of the form @constraint(model, disjunct_indicators in Exactly(1))
only allowing one of the disjuncts to be selected; this is required for certain reformulations like Hull
. For nested disjunctions, exactly1
creates a constraint of the form @constraint(model, disjunct_indicators in Exactly(nested_tag.indicator))
. To conveniently generate many disjunctions at once, see @disjunction
and @disjunctions
.
sourceDisjunctiveProgramming.gdp_data
— Methodgdp_data(model::JuMP.AbstractModel)::GDPData
Extract the GDPData
from a GDPModel
.
sourceDisjunctiveProgramming.is_gdp_model
— Methodis_gdp_model(model::JuMP.AbstractModel)::Bool
Return if model
was created via the GDPModel
constructor.
sourceDisjunctiveProgramming.make_disaggregated_variable
— Methodmake_disaggregated_variable(
+)
Create a disjunction comprised of disjuncts with indicator variables disjunct_indicators
and add it to model
. For nested disjunctions, the nested_tag
is required to indicate which disjunct it will be part of in the parent disjunction. By default, exactly1
adds a constraint of the form @constraint(model, disjunct_indicators in Exactly(1))
only allowing one of the disjuncts to be selected; this is required for certain reformulations like Hull
. For nested disjunctions, exactly1
creates a constraint of the form @constraint(model, disjunct_indicators in Exactly(nested_tag.indicator))
. To conveniently generate many disjunctions at once, see @disjunction
and @disjunctions
.
sourceDisjunctiveProgramming.gdp_data
— Methodgdp_data(model::JuMP.AbstractModel)::GDPData
Extract the GDPData
from a GDPModel
.
sourceDisjunctiveProgramming.is_gdp_model
— Methodis_gdp_model(model::JuMP.AbstractModel)::Bool
Return if model
was created via the GDPModel
constructor.
sourceDisjunctiveProgramming.make_disaggregated_variable
— Methodmake_disaggregated_variable(
model::JuMP.AbstractModel,
vref::JuMP.AbstractVariableRef,
name::String,
lower_bound::Number,
upper_bound::Number
- )::JuMP.AbstractVariableRef
Creates and adds a variable to model
with name name
and bounds lower_bound
and upper_bound
based on the original variable vref
. This is used to create dissagregated variables needed for the Hull
reformulation. This is implemented for model::JuMP.GenericModel
and vref::JuMP.GenericVariableRef
, but it serves as an extension point for interfaces with other model/variable reference types. This also requires the implementation of requires_disaggregation
.
sourceDisjunctiveProgramming.reformulate_disjunct_constraint
— Methodreformulate_disjunct_constraint(
+ )::JuMP.AbstractVariableRef
Creates and adds a variable to model
with name name
and bounds lower_bound
and upper_bound
based on the original variable vref
. This is used to create dissagregated variables needed for the Hull
reformulation. This is implemented for model::JuMP.GenericModel
and vref::JuMP.GenericVariableRef
, but it serves as an extension point for interfaces with other model/variable reference types. This also requires the implementation of requires_disaggregation
.
sourceDisjunctiveProgramming.reformulate_disjunct_constraint
— Methodreformulate_disjunct_constraint(
model::JuMP.AbstractModel,
con::JuMP.AbstractConstraint,
bvref::JuMP.AbstractVariableRef,
method::AbstractReformulationMethod
-)
Extension point for reformulation method method
to reformulate disjunction constraint con
over each constraint. If method
needs to specify how to reformulate the entire disjunction, see reformulate_disjunction
.
sourceDisjunctiveProgramming.reformulate_disjunction
— Methodreformulate_disjunction(
+)
Extension point for reformulation method method
to reformulate disjunction constraint con
over each constraint. If method
needs to specify how to reformulate the entire disjunction, see reformulate_disjunction
.
sourceDisjunctiveProgramming.reformulate_disjunction
— Methodreformulate_disjunction(
model::JuMP.AbstractModel,
disj::Disjunction,
method::AbstractReformulationMethod
-) where {T<:Disjunction}
Reformulate a disjunction using the specified method
. Current reformulation methods include BigM
, Hull
, and Indicator
. This method can be extended for other reformulation techniques.
The disj
field is the ConstraintData
object for the disjunction, stored in the disjunctions
field of the GDPData
object.
sourceDisjunctiveProgramming.reformulate_model
— Functionreformulate_model(model::JuMP.AbstractModel, method::AbstractSolutionMethod = BigM())
Reformulate a GDPModel
using the specified method
. Prior to reformulation, all previous reformulation variables and constraints are deleted.
sourceDisjunctiveProgramming.requires_disaggregation
— Methodrequires_disaggregation(vref::JuMP.AbstractVariableRef)::Bool
Return a Bool
whether vref
requires disaggregation for the Hull
reformulation. This is intended as an extension point for interfaces with DisjunctiveProgramming that use variable reference types that are not JuMP.GenericVariableRef
s. Errors if vref
is not a JuMP.GenericVariableRef
. See also make_disaggregated_variable
.
sourceDisjunctiveProgramming.requires_exactly1
— Methodrequires_exactly1(method::AbstractReformulationMethod)
Return a Bool
whether method
requires that Exactly 1
disjunct be selected as true for each disjunction. For new reformulation method types, this should be extended to return true
if such a constraint is required (defaults to false
otherwise).
sourceDisjunctiveProgramming.requires_variable_bound_info
— Methodrequires_variable_bound_info(method::AbstractReformulationMethod)::Bool
Return a Bool
whether method
requires variable bound information accessed via variable_bound_info
. This should be extended for new AbstractReformulationMethod
methods if needed (defaults to false
). If a new method does require variable bound information, then set_variable_bound_info
should also be extended.
sourceDisjunctiveProgramming.set_variable_bound_info
— Functionset_variable_bound_info(vref, method::AbstractReformulationMethod)::Tuple{<:Number, <:Number}
Returns a tuple of the form (lower_bound, upper_bound)
which are the bound information needed by method
to reformulate disjunctions. This only needs to be implemented for methods
where requires_variable_bound_info(method) = true
. These bounds can later be accessed via variable_bound_info
.
sourceDisjunctiveProgramming.variable_bound_info
— Methodvariable_bound_info(vref::JuMP.AbstractVariableRef)::Tuple{<:Number, <:Number}
Returns a tuple of the form (lower_bound, upper_bound)
needed to implement reformulation methods. Only works if requires_variable_bound_info
is implemented.
sourceJuMP.add_constraint
— FunctionJuMP.add_constraint(
+) where {T<:Disjunction}
Reformulate a disjunction using the specified method
. Current reformulation methods include BigM
, Hull
, and Indicator
. This method can be extended for other reformulation techniques.
The disj
field is the ConstraintData
object for the disjunction, stored in the disjunctions
field of the GDPData
object.
sourceDisjunctiveProgramming.reformulate_model
— Functionreformulate_model(model::JuMP.AbstractModel, method::AbstractSolutionMethod = BigM())
Reformulate a GDPModel
using the specified method
. Prior to reformulation, all previous reformulation variables and constraints are deleted.
sourceDisjunctiveProgramming.requires_disaggregation
— Methodrequires_disaggregation(vref::JuMP.AbstractVariableRef)::Bool
Return a Bool
whether vref
requires disaggregation for the Hull
reformulation. This is intended as an extension point for interfaces with DisjunctiveProgramming that use variable reference types that are not JuMP.GenericVariableRef
s. Errors if vref
is not a JuMP.GenericVariableRef
. See also make_disaggregated_variable
.
sourceDisjunctiveProgramming.requires_exactly1
— Methodrequires_exactly1(method::AbstractReformulationMethod)
Return a Bool
whether method
requires that Exactly 1
disjunct be selected as true for each disjunction. For new reformulation method types, this should be extended to return true
if such a constraint is required (defaults to false
otherwise).
sourceDisjunctiveProgramming.requires_variable_bound_info
— Methodrequires_variable_bound_info(method::AbstractReformulationMethod)::Bool
Return a Bool
whether method
requires variable bound information accessed via variable_bound_info
. This should be extended for new AbstractReformulationMethod
methods if needed (defaults to false
). If a new method does require variable bound information, then set_variable_bound_info
should also be extended.
sourceDisjunctiveProgramming.set_variable_bound_info
— Functionset_variable_bound_info(vref, method::AbstractReformulationMethod)::Tuple{<:Number, <:Number}
Returns a tuple of the form (lower_bound, upper_bound)
which are the bound information needed by method
to reformulate disjunctions. This only needs to be implemented for methods
where requires_variable_bound_info(method) = true
. These bounds can later be accessed via variable_bound_info
.
sourceDisjunctiveProgramming.variable_bound_info
— Methodvariable_bound_info(vref::JuMP.AbstractVariableRef)::Tuple{<:Number, <:Number}
Returns a tuple of the form (lower_bound, upper_bound)
needed to implement reformulation methods. Only works if requires_variable_bound_info
is implemented.
sourceJuMP.add_constraint
— FunctionJuMP.add_constraint(
model::JuMP.AbstractModel,
con::_DisjunctConstraint,
name::String = ""
-)::DisjunctConstraintRef
Extend JuMP.add_constraint
to add a Disjunct
to a GDPModel
. The constraint is added to the GDPData
in the .ext
dictionary of the GDPModel
.
sourceJuMP.add_constraint
— Methodfunction JuMP.add_constraint(
+)::DisjunctConstraintRef
Extend JuMP.add_constraint
to add a Disjunct
to a GDPModel
. The constraint is added to the GDPData
in the .ext
dictionary of the GDPModel
.
sourceJuMP.add_constraint
— Methodfunction JuMP.add_constraint(
model::JuMP.GenericModel,
c::JuMP.ScalarConstraint{_LogicalExpr, MOI.EqualTo{Bool}},
name::String = ""
-)
Extend JuMP.add_constraint
to allow creating logical proposition constraints for a GDPModel
with the @constraint
macro. Users should define logical constraints via the syntax @constraint(model, logical_expr := true)
.
sourceJuMP.add_constraint
— Methodfunction JuMP.add_constraint(
+)
Extend JuMP.add_constraint
to allow creating logical proposition constraints for a GDPModel
with the @constraint
macro. Users should define logical constraints via the syntax @constraint(model, logical_expr := true)
.
sourceJuMP.add_constraint
— Methodfunction JuMP.add_constraint(
model::JuMP.GenericModel,
c::VectorConstraint{<:F, S},
name::String = ""
-) where {F <: Vector{<:LogicalVariableRef}, S <: AbstractCardinalitySet}
Extend JuMP.add_constraint
to allow creating logical cardinality constraints for a GDPModel
with the @constraint
macro.
sourceJuMP.add_variable
— FunctionJuMP.add_variable(model::JuMP.Model, v::LogicalVariable,
- name::String = "")::LogicalVariableRef
Extend JuMP.add_variable
for LogicalVariable
s. This helps enable @variable(model, [var_expr], Logical)
.
sourceJuMP.build_constraint
— MethodJuMP.build_constraint(
+) where {F <: Vector{<:LogicalVariableRef}, S <: AbstractCardinalitySet}
Extend JuMP.add_constraint
to allow creating logical cardinality constraints for a GDPModel
with the @constraint
macro.
sourceJuMP.add_variable
— FunctionJuMP.add_variable(model::JuMP.Model, v::LogicalVariable,
+ name::String = "")::LogicalVariableRef
Extend JuMP.add_variable
for LogicalVariable
s. This helps enable @variable(model, [var_expr], Logical)
.
sourceJuMP.build_constraint
— MethodJuMP.build_constraint(
_error::Function,
func,
set::_MOI.AbstractScalarSet,
tag::Disjunct
-)::_DisjunctConstraint
Extend JuMP.build_constraint
to add constraints to disjuncts. This in combination with JuMP.add_constraint
enables the use of @constraint(model, [name], constr_expr, tag)
, where tag is a Disjunct(::Type{LogicalVariableRef})
. The user must specify the LogicalVariable
to use as the indicator for the _DisjunctConstraint
being created.
sourceJuMP.build_constraint
— MethodJuMP.build_constraint(
+)::_DisjunctConstraint
Extend JuMP.build_constraint
to add constraints to disjuncts. This in combination with JuMP.add_constraint
enables the use of @constraint(model, [name], constr_expr, tag)
, where tag is a Disjunct(::Type{LogicalVariableRef})
. The user must specify the LogicalVariable
to use as the indicator for the _DisjunctConstraint
being created.
sourceJuMP.build_constraint
— MethodJuMP.build_constraint(
_error::Function,
func,
set::MathOptInterface.Nonnegatives,
tag::Disjunct
-)::_DisjunctConstraint
Extend JuMP.build_constraint
to add VectorConstraint
s to disjuncts.
sourceJuMP.build_constraint
— MethodJuMP.build_constraint(
+)::_DisjunctConstraint
Extend JuMP.build_constraint
to add VectorConstraint
s to disjuncts.
sourceJuMP.build_constraint
— MethodJuMP.build_constraint(
_error::Function,
func,
set::MathOptInterface.Nonpositives,
tag::Disjunct
-)::_DisjunctConstraint
Extend JuMP.build_constraint
to add VectorConstraint
s to disjuncts.
sourceJuMP.build_constraint
— MethodJuMP.build_constraint(
+)::_DisjunctConstraint
Extend JuMP.build_constraint
to add VectorConstraint
s to disjuncts.
sourceJuMP.build_constraint
— MethodJuMP.build_constraint(
_error::Function,
func,
set::MathOptInterface.Zeros,
tag::Disjunct
-)::_DisjunctConstraint
Extend JuMP.build_constraint
to add VectorConstraint
s to disjuncts.
sourceJuMP.build_constraint
— MethodJuMP.build_constraint(
+)::_DisjunctConstraint
Extend JuMP.build_constraint
to add VectorConstraint
s to disjuncts.
sourceJuMP.build_constraint
— MethodJuMP.build_constraint(
_error::Function,
func,
set::Nonnegatives,
tag::Disjunct
-)::_DisjunctConstraint
Extend JuMP.build_constraint
to add VectorConstraint
s to disjuncts.
sourceJuMP.build_constraint
— MethodJuMP.build_constraint(
+)::_DisjunctConstraint
Extend JuMP.build_constraint
to add VectorConstraint
s to disjuncts.
sourceJuMP.build_constraint
— MethodJuMP.build_constraint(
_error::Function,
func,
set::Nonpositives,
tag::Disjunct
-)::_DisjunctConstraint
Extend JuMP.build_constraint
to add VectorConstraint
s to disjuncts.
sourceJuMP.build_constraint
— MethodJuMP.build_constraint(
+)::_DisjunctConstraint
Extend JuMP.build_constraint
to add VectorConstraint
s to disjuncts.
sourceJuMP.build_constraint
— MethodJuMP.build_constraint(
_error::Function,
func,
set::Zeros,
tag::Disjunct
-)::_DisjunctConstraint
Extend JuMP.build_constraint
to add VectorConstraint
s to disjuncts.
sourceJuMP.build_constraint
— Methodfunction JuMP.build_constraint(
+)::_DisjunctConstraint
Extend JuMP.build_constraint
to add VectorConstraint
s to disjuncts.
sourceJuMP.build_constraint
— Methodfunction JuMP.build_constraint(
_error::Function,
func::AbstractVector{T},
set::S
-) where {T <: Union{LogicalVariableRef, _LogicalExpr}, S <: Union{Exactly, AtLeast, AtMost}}
Extend JuMP.build_constraint
to add logical cardinality constraints to a GDPModel
. This in combination with JuMP.add_constraint
enables the use of @constraint(model, [name], logical_expr in set)
, where set can be either of the following cardinality sets: AtLeast(n)
, AtMost(n)
, or Exactly(n)
.
Example
To select exactly 1 logical variable Y
to be true
, do (the same can be done with AtLeast(n)
and AtMost(n)
):
using DisjunctiveProgramming
+) where {T <: LogicalVariableRef, S <: Union{Exactly, AtLeast, AtMost}}
Extend JuMP.build_constraint
to add logical cardinality constraints to a GDPModel
. This in combination with JuMP.add_constraint
enables the use of @constraint(model, [name], logical_expr in set)
, where set can be either of the following cardinality sets: AtLeast(n)
, AtMost(n)
, or Exactly(n)
.
Example
To select exactly 1 logical variable Y
to be true
, do (the same can be done with AtLeast(n)
and AtMost(n)
):
using DisjunctiveProgramming
model = GDPModel();
@variable(model, Y[i = 1:2], LogicalVariable);
-@constraint(model, [Y[1], Y[2]] in Exactly(1));
sourceJuMP.build_variable
— MethodJuMP.build_variable(_error::Function, info::JuMP.VariableInfo,
- ::Union{Type{Logical}, Logical})
Extend JuMP.build_variable
to work with logical variables. This in combination with JuMP.add_variable
enables the use of @variable(model, [var_expr], Logical)
.
sourceJuMP.constraint_object
— MethodJuMP.constraint_object(cref::DisjunctConstraintRef)
Return the underlying constraint data for the constraint referenced by cref
.
sourceJuMP.constraint_object
— MethodJuMP.constraint_object(cref::DisjunctionRef)
Return the underlying constraint data for the constraint referenced by cref
.
sourceJuMP.constraint_object
— MethodJuMP.constraint_object(cref::LogicalConstraintRef)
Return the underlying constraint data for the constraint referenced by cref
.
sourceJuMP.delete
— MethodJuMP.delete(model::JuMP.AbstractModel, cref::DisjunctConstraintRef)
Delete a disjunct constraint from the GDP model
.
sourceJuMP.delete
— MethodJuMP.delete(model::JuMP.AbstractModel, cref::DisjunctionRef)
Delete a disjunction constraint from the GDP model
.
sourceJuMP.delete
— MethodJuMP.delete(model::JuMP.AbstractModel, cref::LogicalConstraintRef)
Delete a logical constraint from the GDP model
.
sourceJuMP.delete
— MethodJuMP.delete(model::JuMP.AbstractModel, vref::LogicalVariableRef)::Nothing
Delete the logical variable associated with vref
from the GDP model
.
sourceJuMP.fix
— MethodJuMP.fix(vref::LogicalVariableRef, value::Bool)::Nothing
Fix a logical variable to a value. Update the fixing constraint if one exists, otherwise create a new one.
sourceJuMP.fix_value
— MethodJuMP.fix_value(vref::LogicalVariableRef)::Bool
Return the value to which a logical variable is fixed.
sourceJuMP.index
— MethodJuMP.index(cref::DisjunctConstraintRef)
Return the index constraint associated with cref
.
sourceJuMP.index
— MethodJuMP.index(cref::DisjunctionRef)
Return the index constraint associated with cref
.
sourceJuMP.index
— MethodJuMP.index(cref::LogicalConstraintRef)
Return the index constraint associated with cref
.
sourceJuMP.index
— MethodJuMP.index(vref::LogicalVariableRef)::LogicalVariableIndex
Return the index of logical variable that associated with vref
.
sourceJuMP.is_fixed
— MethodJuMP.is_fixed(vref::LogicalVariableRef)::Bool
Return true
if vref
is a fixed variable. If true
, the fixed value can be queried with fix_value.
sourceJuMP.is_valid
— MethodJuMP.is_valid(model::JuMP.AbstractModel, cref::DisjunctConstraintRef)
Return true
if cref
refers to a valid constraint in the GDP model
.
sourceJuMP.is_valid
— MethodJuMP.is_valid(model::JuMP.AbstractModel, cref::DisjunctionRef)
Return true
if cref
refers to a valid constraint in the GDP model
.
sourceJuMP.is_valid
— MethodJuMP.is_valid(model::JuMP.AbstractModel, cref::LogicalConstraintRef)
Return true
if cref
refers to a valid constraint in the GDP model
.
sourceJuMP.is_valid
— MethodJuMP.is_valid(model::JuMP.AbstractModel, vref::LogicalVariableRef)::Bool
Return true
if vref
refers to a valid logical variable in GDP model
.
sourceJuMP.isequal_canonical
— MethodJuMP.isequal_canonical(v::LogicalVariableRef, w::LogicalVariableRef)::Bool
Return true
if v
and w
refer to the same logical variable in the same GDP model
.
sourceJuMP.name
— MethodJuMP.name(cref::DisjunctConstraintRef)
Get a constraint's name attribute.
sourceJuMP.name
— MethodJuMP.name(cref::DisjunctionRef)
Get a constraint's name attribute.
sourceJuMP.name
— MethodJuMP.name(cref::LogicalConstraintRef)
Get a constraint's name attribute.
sourceJuMP.name
— MethodJuMP.name(vref::LogicalVariableRef)::String
Get a logical variable's name attribute.
sourceJuMP.owner_model
— MethodJuMP.owner_model(cref::DisjunctConstraintRef)
Return the model to which cref
belongs.
sourceJuMP.owner_model
— MethodJuMP.owner_model(cref::DisjunctionRef)
Return the model to which cref
belongs.
sourceJuMP.owner_model
— MethodJuMP.owner_model(cref::LogicalConstraintRef)
Return the model to which cref
belongs.
sourceJuMP.owner_model
— MethodJuMP.owner_model(vref::LogicalVariableRef)::JuMP.AbstractModel
Return the GDP model
to which vref
belongs.
sourceJuMP.set_name
— MethodJuMP.set_name(cref::DisjunctConstraintRef, name::String)
Set a constraint's name attribute.
sourceJuMP.set_name
— MethodJuMP.set_name(cref::DisjunctionRef, name::String)
Set a constraint's name attribute.
sourceJuMP.set_name
— MethodJuMP.set_name(cref::LogicalConstraintRef, name::String)
Set a constraint's name attribute.
sourceJuMP.set_name
— MethodJuMP.set_name(vref::LogicalVariableRef, name::String)::Nothing
Set a logical variable's name attribute.
sourceJuMP.set_start_value
— MethodJuMP.set_start_value(vref::LogicalVariableRef, value::Union{Nothing, Bool})::Nothing
Set the start value of the logical variable vref
.
Pass nothing
to unset the start value.
sourceJuMP.start_value
— MethodJuMP.start_value(vref::LogicalVariableRef)::Bool
Return the start value of the logical variable vref
.
sourceJuMP.unfix
— MethodJuMP.unfix(vref::LogicalVariableRef)::Nothing
Delete the fixed value of a logical variable.
sourceJuMP.value
— MethodJuMP.value(vref::LogicalVariableRef)::Bool
Returns the optimized value of vref
. This dispatches on value(binary_variable(vref))
and then rounds to the closest Bool
value.
sourceDisjunctiveProgramming.AbstractCardinalitySet
— TypeAbstractCardinalitySet <: MOI.AbstractVectorSet
An abstract type for cardinality sets _MOIAtLeast
, _MOIExactly
, and _MOIAtMost
.
sourceDisjunctiveProgramming.AbstractReformulationMethod
— TypeAbstractReformulationMethod <: AbstractSolutionMethod
An abstract type for reformulation approaches used to solve GDPModel
s.
sourceDisjunctiveProgramming.AbstractSolutionMethod
— TypeAbstractSolutionMethod
An abstract type for solution methods used to solve GDPModel
s.
sourceDisjunctiveProgramming.AtLeast
— TypeAtLeast{T<:Union{Int,LogicalVariableRef}} <: JuMP.AbstractVectorSet
Convenient alias for using _MOIAtLeast
.
sourceDisjunctiveProgramming.AtMost
— TypeAtMost{T<:Union{Int,LogicalVariableRef}} <: JuMP.AbstractVectorSet
Convenient alias for using _MOIAtMost
.
sourceDisjunctiveProgramming.BigM
— TypeBigM{T} <: AbstractReformulationMethod
A type for using the big-M reformulation approach for disjunctive constraints.
Fields
value::T
: Big-M value (default = 1e9
).tight::Bool
: Attempt to tighten the Big-M value (default = true
)?
sourceDisjunctiveProgramming.ConstraintData
— TypeConstraintData{C <: JuMP.AbstractConstraint}
A type for storing constraint objects in GDPData
and any meta-data they possess.
Fields
constraint::C
: The constraint.name::String
: The name of the proposition.
sourceDisjunctiveProgramming.Disjunct
— TypeDisjunct
Used as a tag for constraints that will be used in disjunctions. This is done via the following syntax:
julia> @constraint(model, [constr_expr], Disjunct)
+@constraint(model, [Y[1], Y[2]] in Exactly(1));
sourceJuMP.build_variable
— MethodJuMP.build_variable(_error::Function, info::JuMP.VariableInfo,
+ ::Union{Type{Logical}, Logical})
Extend JuMP.build_variable
to work with logical variables. This in combination with JuMP.add_variable
enables the use of @variable(model, [var_expr], Logical)
.
sourceJuMP.constraint_object
— MethodJuMP.constraint_object(cref::DisjunctConstraintRef)
Return the underlying constraint data for the constraint referenced by cref
.
sourceJuMP.constraint_object
— MethodJuMP.constraint_object(cref::DisjunctionRef)
Return the underlying constraint data for the constraint referenced by cref
.
sourceJuMP.constraint_object
— MethodJuMP.constraint_object(cref::LogicalConstraintRef)
Return the underlying constraint data for the constraint referenced by cref
.
sourceJuMP.delete
— MethodJuMP.delete(model::JuMP.AbstractModel, cref::DisjunctConstraintRef)
Delete a disjunct constraint from the GDP model
.
sourceJuMP.delete
— MethodJuMP.delete(model::JuMP.AbstractModel, cref::DisjunctionRef)
Delete a disjunction constraint from the GDP model
.
sourceJuMP.delete
— MethodJuMP.delete(model::JuMP.AbstractModel, cref::LogicalConstraintRef)
Delete a logical constraint from the GDP model
.
sourceJuMP.delete
— MethodJuMP.delete(model::JuMP.AbstractModel, vref::LogicalVariableRef)::Nothing
Delete the logical variable associated with vref
from the GDP model
.
sourceJuMP.fix
— MethodJuMP.fix(vref::LogicalVariableRef, value::Bool)::Nothing
Fix a logical variable to a value. Update the fixing constraint if one exists, otherwise create a new one.
sourceJuMP.fix_value
— MethodJuMP.fix_value(vref::LogicalVariableRef)::Bool
Return the value to which a logical variable is fixed.
sourceJuMP.index
— MethodJuMP.index(cref::DisjunctConstraintRef)
Return the index constraint associated with cref
.
sourceJuMP.index
— MethodJuMP.index(cref::DisjunctionRef)
Return the index constraint associated with cref
.
sourceJuMP.index
— MethodJuMP.index(cref::LogicalConstraintRef)
Return the index constraint associated with cref
.
sourceJuMP.index
— MethodJuMP.index(vref::LogicalVariableRef)::LogicalVariableIndex
Return the index of logical variable that associated with vref
.
sourceJuMP.is_fixed
— MethodJuMP.is_fixed(vref::LogicalVariableRef)::Bool
Return true
if vref
is a fixed variable. If true
, the fixed value can be queried with fix_value.
sourceJuMP.is_valid
— MethodJuMP.is_valid(model::JuMP.AbstractModel, cref::DisjunctConstraintRef)
Return true
if cref
refers to a valid constraint in the GDP model
.
sourceJuMP.is_valid
— MethodJuMP.is_valid(model::JuMP.AbstractModel, cref::DisjunctionRef)
Return true
if cref
refers to a valid constraint in the GDP model
.
sourceJuMP.is_valid
— MethodJuMP.is_valid(model::JuMP.AbstractModel, cref::LogicalConstraintRef)
Return true
if cref
refers to a valid constraint in the GDP model
.
sourceJuMP.is_valid
— MethodJuMP.is_valid(model::JuMP.AbstractModel, vref::LogicalVariableRef)::Bool
Return true
if vref
refers to a valid logical variable in GDP model
.
sourceJuMP.isequal_canonical
— MethodJuMP.isequal_canonical(v::LogicalVariableRef, w::LogicalVariableRef)::Bool
Return true
if v
and w
refer to the same logical variable in the same GDP model
.
sourceJuMP.name
— MethodJuMP.name(cref::DisjunctConstraintRef)
Get a constraint's name attribute.
sourceJuMP.name
— MethodJuMP.name(cref::DisjunctionRef)
Get a constraint's name attribute.
sourceJuMP.name
— MethodJuMP.name(cref::LogicalConstraintRef)
Get a constraint's name attribute.
sourceJuMP.name
— MethodJuMP.name(vref::LogicalVariableRef)::String
Get a logical variable's name attribute.
sourceJuMP.owner_model
— MethodJuMP.owner_model(cref::DisjunctConstraintRef)
Return the model to which cref
belongs.
sourceJuMP.owner_model
— MethodJuMP.owner_model(cref::DisjunctionRef)
Return the model to which cref
belongs.
sourceJuMP.owner_model
— MethodJuMP.owner_model(cref::LogicalConstraintRef)
Return the model to which cref
belongs.
sourceJuMP.owner_model
— MethodJuMP.owner_model(vref::LogicalVariableRef)::JuMP.AbstractModel
Return the GDP model
to which vref
belongs.
sourceJuMP.set_name
— MethodJuMP.set_name(cref::DisjunctConstraintRef, name::String)
Set a constraint's name attribute.
sourceJuMP.set_name
— MethodJuMP.set_name(cref::DisjunctionRef, name::String)
Set a constraint's name attribute.
sourceJuMP.set_name
— MethodJuMP.set_name(cref::LogicalConstraintRef, name::String)
Set a constraint's name attribute.
sourceJuMP.set_name
— MethodJuMP.set_name(vref::LogicalVariableRef, name::String)::Nothing
Set a logical variable's name attribute.
sourceJuMP.set_start_value
— MethodJuMP.set_start_value(vref::LogicalVariableRef, value::Union{Nothing, Bool})::Nothing
Set the start value of the logical variable vref
.
Pass nothing
to unset the start value.
sourceJuMP.start_value
— MethodJuMP.start_value(vref::LogicalVariableRef)::Bool
Return the start value of the logical variable vref
.
sourceJuMP.unfix
— MethodJuMP.unfix(vref::LogicalVariableRef)::Nothing
Delete the fixed value of a logical variable.
sourceJuMP.value
— MethodJuMP.value(vref::LogicalVariableRef)::Bool
Returns the optimized value of vref
. This dispatches on value(binary_variable(vref))
and then rounds to the closest Bool
value.
sourceDisjunctiveProgramming.AbstractCardinalitySet
— TypeAbstractCardinalitySet <: MOI.AbstractVectorSet
An abstract type for cardinality sets _MOIAtLeast
, _MOIExactly
, and _MOIAtMost
.
sourceDisjunctiveProgramming.AbstractReformulationMethod
— TypeAbstractReformulationMethod <: AbstractSolutionMethod
An abstract type for reformulation approaches used to solve GDPModel
s.
sourceDisjunctiveProgramming.AbstractSolutionMethod
— TypeAbstractSolutionMethod
An abstract type for solution methods used to solve GDPModel
s.
sourceDisjunctiveProgramming.AtLeast
— TypeAtLeast{T<:Union{Int,LogicalVariableRef}} <: JuMP.AbstractVectorSet
Convenient alias for using _MOIAtLeast
.
sourceDisjunctiveProgramming.AtMost
— TypeAtMost{T<:Union{Int,LogicalVariableRef}} <: JuMP.AbstractVectorSet
Convenient alias for using _MOIAtMost
.
sourceDisjunctiveProgramming.BigM
— TypeBigM{T} <: AbstractReformulationMethod
A type for using the big-M reformulation approach for disjunctive constraints.
Fields
value::T
: Big-M value (default = 1e9
).tight::Bool
: Attempt to tighten the Big-M value (default = true
)?
sourceDisjunctiveProgramming.ConstraintData
— TypeConstraintData{C <: JuMP.AbstractConstraint}
A type for storing constraint objects in GDPData
and any meta-data they possess.
Fields
constraint::C
: The constraint.name::String
: The name of the proposition.
sourceDisjunctiveProgramming.Disjunct
— TypeDisjunct
Used as a tag for constraints that will be used in disjunctions. This is done via the following syntax:
julia> @constraint(model, [constr_expr], Disjunct)
-julia> @constraint(model, [constr_expr], Disjunct(lvref))
where lvref
is a LogicalVariableRef
that will ultimately be associated with the disjunct the constraint is added to. If no lvref
is given, then one is generated when the disjunction is created.
sourceDisjunctiveProgramming.DisjunctConstraintIndex
— TypeDisjunctConstraintIndex
A type for storing the index of a Disjunct
.
Fields
value::Int64
: The index value.
sourceDisjunctiveProgramming.DisjunctConstraintRef
— TypeDisjunctConstraintRef{M <: JuMP.AbstractModel}
A type for looking up disjunctive constraints.
sourceDisjunctiveProgramming.Disjunction
— TypeDisjunction{M <: JuMP.AbstractModel} <: JuMP.AbstractConstraint
A type for a disjunctive constraint that is comprised of a collection of disjuncts of indicated by a unique LogicalVariableIndex
.
Fields
indicators::Vector{LogicalVariableref}
: The references to the logical variables
(indicators) that uniquely identify each disjunct in the disjunction.
nested::Bool
: Is this disjunction nested within another disjunction?
sourceDisjunctiveProgramming.DisjunctionIndex
— Typesource DisjunctiveProgramming.DisjunctionRef
— TypeDisjunctionRef{M <: JuMP.AbstractModel}
A type for looking up disjunctive constraints.
sourceDisjunctiveProgramming.Exactly
— TypeExactly <: JuMP.AbstractVectorSet
Convenient alias for using _MOIExactly
.
sourceDisjunctiveProgramming.GDPData
— TypeGDPData{M <: JuMP.AbstractModel, V <: JuMP.AbstractVariableRef, CrefType, ValueType}
The core type for storing information in a GDPModel
.
sourceDisjunctiveProgramming.GDPModel
— MethodGDPModel([optimizer]; [kwargs...])::JuMP.Model
+julia> @constraint(model, [constr_expr], Disjunct(lvref))
where lvref
is a LogicalVariableRef
that will ultimately be associated with the disjunct the constraint is added to. If no lvref
is given, then one is generated when the disjunction is created.
sourceDisjunctiveProgramming.DisjunctConstraintIndex
— TypeDisjunctConstraintIndex
A type for storing the index of a Disjunct
.
Fields
value::Int64
: The index value.
sourceDisjunctiveProgramming.DisjunctConstraintRef
— TypeDisjunctConstraintRef{M <: JuMP.AbstractModel}
A type for looking up disjunctive constraints.
sourceDisjunctiveProgramming.Disjunction
— TypeDisjunction{M <: JuMP.AbstractModel} <: JuMP.AbstractConstraint
A type for a disjunctive constraint that is comprised of a collection of disjuncts of indicated by a unique LogicalVariableIndex
.
Fields
indicators::Vector{LogicalVariableref}
: The references to the logical variables
(indicators) that uniquely identify each disjunct in the disjunction.
nested::Bool
: Is this disjunction nested within another disjunction?
sourceDisjunctiveProgramming.DisjunctionIndex
— Typesource DisjunctiveProgramming.DisjunctionRef
— TypeDisjunctionRef{M <: JuMP.AbstractModel}
A type for looking up disjunctive constraints.
sourceDisjunctiveProgramming.Exactly
— TypeExactly <: JuMP.AbstractVectorSet
Convenient alias for using _MOIExactly
.
sourceDisjunctiveProgramming.GDPData
— TypeGDPData{M <: JuMP.AbstractModel, V <: JuMP.AbstractVariableRef, CrefType, ValueType}
The core type for storing information in a GDPModel
.
sourceDisjunctiveProgramming.GDPModel
— MethodGDPModel([optimizer]; [kwargs...])::JuMP.Model
GDPModel{T}([optimizer]; [kwargs...])::JuMP.GenericModel{T}
-GDPModel{M <: JuMP.AbstractModel, VrefType, CrefType}([optimizer], [args...]; [kwargs...])::M
The core model object for building general disjunction programming models.
sourceDisjunctiveProgramming.Hull
— TypeHull{T} <: AbstractReformulationMethod
A type for using the convex hull reformulation approach for disjunctive constraints.
Fields
value::T
: epsilon value for nonlinear hull reformulations (default = 1e-6
).
sourceDisjunctiveProgramming.Indicator
— TypeIndicator <: AbstractReformulationMethod
A type for using indicator constraint approach for linear disjunctive constraints.
sourceDisjunctiveProgramming.Logical
— TypeLogical{T}
Tag for creating logical variables using @variable
. Most often this will be used to enable the syntax:
@variable(model, var_expr, Logical, [kwargs...])
which creates a LogicalVariable
that will ultimately be reformulated into a binary variable of the form:
@variable(model, var_expr, Bin, [kwargs...])
To include a tag that is used to create the reformulated variables, the syntax becomes:
@variable(model, var_expr, Logical(MyTag()), [kwargs...])
which creates a LogicalVariable
that is associated with MyTag()
such that the reformulation binary variables are of the form:
@variable(model, var_expr, Bin, MyTag(), [kwargs...])
sourceDisjunctiveProgramming.LogicalConstraintIndex
— TypeLogicalConstraintIndex
A type for storing the index of a logical constraint.
Fields
value::Int64
: The index value.
sourceDisjunctiveProgramming.LogicalConstraintRef
— TypeLogicalConstraintRef{M <: JuMP.AbstractModel}
A type for looking up logical constraints.
sourceDisjunctiveProgramming.LogicalVariable
— TypeLogicalVariable <: JuMP.AbstractVariable
A variable type the logical variables associated with disjuncts in a Disjunction
.
Fields
fix_value::Union{Nothing, Bool}
: A fixed boolean value if there is one.start_value::Union{Nothing, Bool}
: An initial guess if there is one.
sourceDisjunctiveProgramming.LogicalVariableData
— TypeLogicalVariableData
A type for storing LogicalVariable
s and any meta-data they possess.
Fields
variable::LogicalVariable
: The logical variable object.name::String
: The name of the variable.
sourceDisjunctiveProgramming.LogicalVariableIndex
— TypeLogicalVariableIndex
A type for storing the index of a LogicalVariable
.
Fields
value::Int64
: The index value.
sourceDisjunctiveProgramming.LogicalVariableRef
— TypeLogicalVariableRef{M <: JuMP.AbstractModel}
A type for looking up logical variables.
sourceDisjunctiveProgramming._MOIAtLeast
— Type_MOIAtLeast <: AbstractCardinalitySet
MOI level set for AtLeast constraints, see AtLeast
for recommended syntax.
sourceDisjunctiveProgramming._MOIAtMost
— Type_MOIAtMost <: AbstractCardinalitySet
MOI level set for AtMost constraints, see AtMost
for recommended syntax.
sourceDisjunctiveProgramming._MOIExactly
— Type_MOIExactly <: AbstractCardinalitySet
MOI level set for Exactly constraints, see Exactly
for recommended syntax.
sourceSettings
This document was generated with Documenter.jl version 1.2.1 on Thursday 7 December 2023. Using Julia version 1.9.4.
+GDPModel{M <: JuMP.AbstractModel, VrefType, CrefType}([optimizer], [args...]; [kwargs...])::M
The core model object for building general disjunction programming models.
DisjunctiveProgramming.Hull
— TypeHull{T} <: AbstractReformulationMethod
A type for using the convex hull reformulation approach for disjunctive constraints.
Fields
value::T
: epsilon value for nonlinear hull reformulations (default =1e-6
).
DisjunctiveProgramming.Indicator
— TypeIndicator <: AbstractReformulationMethod
A type for using indicator constraint approach for linear disjunctive constraints.
DisjunctiveProgramming.Logical
— TypeLogical{T}
Tag for creating logical variables using @variable
. Most often this will be used to enable the syntax:
@variable(model, var_expr, Logical, [kwargs...])
which creates a LogicalVariable
that will ultimately be reformulated into a binary variable of the form:
@variable(model, var_expr, Bin, [kwargs...])
To include a tag that is used to create the reformulated variables, the syntax becomes:
@variable(model, var_expr, Logical(MyTag()), [kwargs...])
which creates a LogicalVariable
that is associated with MyTag()
such that the reformulation binary variables are of the form:
@variable(model, var_expr, Bin, MyTag(), [kwargs...])
DisjunctiveProgramming.LogicalConstraintIndex
— TypeLogicalConstraintIndex
A type for storing the index of a logical constraint.
Fields
value::Int64
: The index value.
DisjunctiveProgramming.LogicalConstraintRef
— TypeLogicalConstraintRef{M <: JuMP.AbstractModel}
A type for looking up logical constraints.
DisjunctiveProgramming.LogicalVariable
— TypeLogicalVariable <: JuMP.AbstractVariable
A variable type the logical variables associated with disjuncts in a Disjunction
.
Fields
fix_value::Union{Nothing, Bool}
: A fixed boolean value if there is one.start_value::Union{Nothing, Bool}
: An initial guess if there is one.
DisjunctiveProgramming.LogicalVariableData
— TypeLogicalVariableData
A type for storing LogicalVariable
s and any meta-data they possess.
Fields
variable::LogicalVariable
: The logical variable object.name::String
: The name of the variable.
DisjunctiveProgramming.LogicalVariableIndex
— TypeLogicalVariableIndex
A type for storing the index of a LogicalVariable
.
Fields
value::Int64
: The index value.
DisjunctiveProgramming.LogicalVariableRef
— TypeLogicalVariableRef{M <: JuMP.AbstractModel}
A type for looking up logical variables.
DisjunctiveProgramming._MOIAtLeast
— Type_MOIAtLeast <: AbstractCardinalitySet
MOI level set for AtLeast constraints, see AtLeast
for recommended syntax.
DisjunctiveProgramming._MOIAtMost
— Type_MOIAtMost <: AbstractCardinalitySet
MOI level set for AtMost constraints, see AtMost
for recommended syntax.
DisjunctiveProgramming._MOIExactly
— Type_MOIExactly <: AbstractCardinalitySet
MOI level set for Exactly constraints, see Exactly
for recommended syntax.