API
DisjunctiveProgramming.AbstractReformulationMethod
— TypeAbstractReformulationMethod <: AbstractSolutionMethod
An abstract type for reformulation approaches used to solve GDPModel
s.
DisjunctiveProgramming.AbstractSolutionMethod
— TypeAbstractSolutionMethod
An abstract type for solution methods used to solve GDPModel
s.
DisjunctiveProgramming.AtLeast
— TypeAtLeast{T<:Union{Int,LogicalVariableRef}} <: JuMP.AbstractVectorSet
Convenient alias for using _MOIAtLeast
.
DisjunctiveProgramming.AtMost
— TypeAtMost{T<:Union{Int,LogicalVariableRef}} <: JuMP.AbstractVectorSet
Convenient alias for using _MOIAtMost
.
DisjunctiveProgramming.BigM
— TypeBigM <: AbstractReformulationMethod
A type for using the big-M reformulation approach for disjunctive constraints.
Fields
value::Float64
: Big-M value (default =1e9
).tight::Bool
: Attempt to tighten the Big-M value (default =true
)?
DisjunctiveProgramming.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.
DisjunctiveProgramming.DisjunctConstraint
— TypeDisjunctConstraint
Used as a tag for constraints that will be used in disjunctions. This is done via the following syntax:
julia> @constraint(model, [constr_expr], DisjunctConstraint)
+
+julia> @constraint(model, [constr_expr], DisjunctConstraint(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.
DisjunctiveProgramming.DisjunctConstraintIndex
— TypeDisjunctConstraintIndex
A type for storing the index of a DisjunctConstraint
.
Fields
value::Int64
: The index value.
DisjunctiveProgramming.DisjunctConstraintRef
— TypeDisjunctConstraintRef
A type for looking up disjunctive constraints.
DisjunctiveProgramming.Disjunction
— TypeDisjunction <: JuMP.AbstractConstraint
A type for a disjunctive constraint that is comprised of a collection of disjuncts of indicated by a unique LogicalVariableRef
.
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?
DisjunctiveProgramming.DisjunctionIndex
— TypeDisjunctiveProgramming.DisjunctionRef
— TypeDisjunctionRef
A type for looking up disjunctive constraints.
DisjunctiveProgramming.Exactly
— TypeExactly <: JuMP.AbstractVectorSet
Convenient alias for using _MOIExactly
.
DisjunctiveProgramming.GDPData
— TypeGDPData
The core type for storing information in a GDPModel
.
DisjunctiveProgramming.Hull
— TypeHull <: AbstractReformulationMethod
A type for using the convex hull reformulation approach for disjunctive constraints.
Fields
value::Float64
: 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.LogicalConstraintIndex
— TypeLogicalConstraintIndex
A type for storing the index of a logical constraint.
Fields
value::Int64
: The index value.
DisjunctiveProgramming.LogicalConstraintRef
— TypeLogicalConstraintRef
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 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
A type for looking up logical variables.
DisjunctiveProgramming._MOIAtLeast
— Type_MOIAtLeast <: _MOI.AbstractVectorSet
MOI level set for AtLeast constraints, see AtLeast
for recommended syntax.
DisjunctiveProgramming._MOIAtMost
— Type_MOIAtMost <: _MOI.AbstractVectorSet
MOI level set for AtMost constraints, see AtMost
for recommended syntax.
DisjunctiveProgramming._MOIExactly
— Type_MOIExactly <: _MOI.AbstractVectorSet
MOI level set for Exactly constraints, see Exactly
for recommended syntax.
Base.getindex
— MethodBase.getindex(map::JuMP.GenericReferenceMap, cref::DisjunctConstraintRef)
...
Base.getindex
— MethodBase.getindex(map::JuMP.GenericReferenceMap, cref::DisjunctionRef)
...
Base.getindex
— MethodBase.getindex(map::JuMP.GenericReferenceMap, cref::LogicalConstraintRef)
...
DisjunctiveProgramming.GDPModel
— MethodGDPModel([optimizer]; [kwargs...])::JuMP.Model
The core model object for building general disjunction programming models.
DisjunctiveProgramming.disjunction
— Functiondisjunction(
+ model::JuMP.Model,
+ disjunct_indicators::Vector{LogicalVariableRef}
+ name::String = ""
+)
Function to add a Disjunction
to a GDPModel
.
disjunction(
+ model::JuMP.Model,
+ disjunct_indicators::Vector{LogicalVariableRef},
+ nested_tag::DisjunctConstraint,
+ name::String = ""
+)
Function to add a nested Disjunction
to a GDPModel
.
DisjunctiveProgramming.disjunction_indicators
— Methoddisjunction_indicators(disjunction::DisjunctionRef)
Return LogicalVariableRefs associated with a disjunction.
DisjunctiveProgramming.gdp_data
— Methodgdp_data(model::JuMP.Model)::GDPData
Extract the GDPData
from a GDPModel
.
DisjunctiveProgramming.is_gdp_model
— Methodis_gdp_model(model::JuMP.Model)::Bool
Return if model
was created via the GDPModel
constructor.
DisjunctiveProgramming.reformulate_model
— Methodreformulate_model(model::JuMP.Model, method::AbstractSolutionMethod)
Reformulate a GDPModel
using the specified method
. Prior to reformulation, all previous reformulation variables and constraints are deleted.
DisjunctiveProgramming.to_cnf!
— Methodto_cnf!(expr::Expr)
Convert an expression of symbolic Boolean variables and operators to CNF.
JuMP.add_constraint
— FunctionJuMP.add_constraint(
+ model::JuMP.Model,
+ con::_DisjunctConstraint,
+ name::String = ""
+)::DisjunctConstraintRef
Extend JuMP.add_constraint
to add a DisjunctConstraint
to a GDPModel
. The constraint is added to the GDPData
in the .ext
dictionary of the GDPModel
.
JuMP.add_constraint
— Methodfunction JuMP.add_constraint(
+ model::JuMP.Model,
+ c::JuMP.ScalarConstraint{<:F, S},
+ name::String = ""
+) where {F <: Union{LogicalVariableRef, _LogicalExpr}, S}
Extend JuMP.add_constraint
to allow creating logical proposition constraints for a GDPModel
with the @constraint
macro.
function JuMP.add_constraint(
+ model::JuMP.Model,
+ c::JuMP.VectorConstraint{<:F, S, Shape},
+ name::String = ""
+) where {F <: Union{Number, LogicalVariableRef, _LogicalExpr}, S, Shape}
Extend JuMP.add_constraint
to allow creating logical cardinality constraints for a GDPModel
with the @constraint
macro.
JuMP.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)
.
JuMP.build_constraint
— MethodJuMP.build_constraint(
+ _error::Function,
+ func,
+ set::_MOI.AbstractScalarSet,
+ tag::DisjunctConstraint
+)::_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 DisjunctConstraint(::Type{LogicalVariableRef})
. The user must specify the LogicalVariable
to use as the indicator for the _DisjunctConstraint
being created.
JuMP.build_constraint
— MethodJuMP.build_constraint(
+ _error::Function,
+ func,
+ set::MathOptInterface.Nonnegatives,
+ tag::DisjunctConstraint
+)::_DisjunctConstraint
Extend JuMP.build_constraint
to add VectorConstraint
s to disjuncts.
JuMP.build_constraint
— MethodJuMP.build_constraint(
+ _error::Function,
+ func,
+ set::MathOptInterface.Nonpositives,
+ tag::DisjunctConstraint
+)::_DisjunctConstraint
Extend JuMP.build_constraint
to add VectorConstraint
s to disjuncts.
JuMP.build_constraint
— MethodJuMP.build_constraint(
+ _error::Function,
+ func,
+ set::MathOptInterface.Zeros,
+ tag::DisjunctConstraint
+)::_DisjunctConstraint
Extend JuMP.build_constraint
to add VectorConstraint
s to disjuncts.
JuMP.build_constraint
— MethodJuMP.build_constraint(
+ _error::Function,
+ func,
+ set::Nonnegatives,
+ tag::DisjunctConstraint
+)::_DisjunctConstraint
Extend JuMP.build_constraint
to add VectorConstraint
s to disjuncts.
JuMP.build_constraint
— MethodJuMP.build_constraint(
+ _error::Function,
+ func,
+ set::Nonpositives,
+ tag::DisjunctConstraint
+)::_DisjunctConstraint
Extend JuMP.build_constraint
to add VectorConstraint
s to disjuncts.
JuMP.build_constraint
— MethodJuMP.build_constraint(
+ _error::Function,
+ func,
+ set::Zeros,
+ tag::DisjunctConstraint
+)::_DisjunctConstraint
Extend JuMP.build_constraint
to add VectorConstraint
s to disjuncts.
JuMP.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
+model = GDPModel();
+@variable(model, Y[i = 1:2], LogicalVariable);
+@constraint(model, [Y[1], Y[2]] in Exactly(1));
JuMP.build_constraint(
+ _error::Function,
+ func::_LogicalExpr,
+ set::IsTrue
+)
Extend JuMP.build_constraint
to add logical propositional constraints to a GDPModel
. This in combination with JuMP.add_constraint
enables the use of @constraint(model, [name], logical_expr in IsTrue())
to define a Boolean expression that must either be true or false.
JuMP.build_variable
— MethodJuMP.build_variable(_error::Function, info::JuMP.VariableInfo,
+ ::Type{LogicalVariable})::LogicalVariable
Extend JuMP.build_variable
to work with logical variables. This in combination with JuMP.add_variable
enables the use of @variable(model, [var_expr], LogicalVariable)
.
JuMP.constraint_object
— MethodJuMP.constraint_object(cref::DisjunctConstraintRef)
Return the underlying constraint data for the constraint referenced by cref
.
JuMP.constraint_object
— MethodJuMP.constraint_object(cref::DisjunctionRef)
Return the underlying constraint data for the constraint referenced by cref
.
JuMP.constraint_object
— MethodJuMP.constraint_object(cref::LogicalConstraintRef)
Return the underlying constraint data for the constraint referenced by cref
.
JuMP.delete
— MethodJuMP.delete(model::JuMP.Model, cref::DisjunctConstraintRef)
Delete a disjunct constraint from the GDP model
.
JuMP.delete
— MethodJuMP.delete(model::JuMP.Model, cref::DisjunctionRef)
Delete a disjunction constraint from the GDP model
.
JuMP.delete
— MethodJuMP.delete(model::JuMP.Model, cref::LogicalConstraintRef)
Delete a logical constraint from the GDP model
.
JuMP.delete
— MethodJuMP.delete(model::JuMP.Model, vref::LogicalVariableRef)
Delete the logical variable associated with vref
from the GDP model
.
JuMP.fix
— MethodJuMP.fix(vref::LogicalVariableRef, value::Bool)
Fix a logical variable to a value. Update the fixing constraint if one exists, otherwise create a new one.
JuMP.fix_value
— MethodJuMP.fix_value(vref::LogicalVariableRef)
Return the value to which a logical variable is fixed.
JuMP.index
— MethodJuMP.index(cref::DisjunctConstraintRef)
Return the index constraint associated with cref
.
JuMP.index
— MethodJuMP.index(cref::DisjunctionRef)
Return the index constraint associated with cref
.
JuMP.index
— MethodJuMP.index(cref::LogicalConstraintRef)
Return the index constraint associated with cref
.
JuMP.index
— MethodJuMP.index(vref::LogicalVariableRef)
Return the index of logical variable that associated with vref
.
JuMP.is_fixed
— MethodJuMP.is_fixed(vref::LogicalVariableRef)
Return true
if vref
is a fixed variable. If true
, the fixed value can be queried with fix_value.
JuMP.is_valid
— MethodJuMP.is_valid(model::JuMP.Model, cref::DisjunctConstraintRef)
Return true
if cref
refers to a valid constraint in the GDP model
.
JuMP.is_valid
— MethodJuMP.is_valid(model::JuMP.Model, cref::DisjunctionRef)
Return true
if cref
refers to a valid constraint in the GDP model
.
JuMP.is_valid
— MethodJuMP.is_valid(model::JuMP.Model, cref::LogicalConstraintRef)
Return true
if cref
refers to a valid constraint in the GDP model
.
JuMP.is_valid
— MethodJuMP.is_valid(model::JuMP.Model, vref::LogicalVariableRef)
Return true
if vref
refers to a valid logical variable in GDP model
.
JuMP.isequal_canonical
— MethodJuMP.isequal_canonical(v::LogicalVariableRef, w::LogicalVariableRef)
Return true
if v
and w
refer to the same logical variable in the same GDP model
.
JuMP.name
— MethodJuMP.name(cref::DisjunctConstraintRef)
Get a constraint's name attribute.
JuMP.name
— MethodJuMP.name(cref::DisjunctionRef)
Get a constraint's name attribute.
JuMP.name
— MethodJuMP.name(cref::LogicalConstraintRef)
Get a constraint's name attribute.
JuMP.name
— MethodJuMP.name(vref::LogicalVariableRef)
Get a logical variable's name attribute.
JuMP.owner_model
— MethodJuMP.owner_model(cref::DisjunctConstraintRef)
Return the model to which cref
belongs.
JuMP.owner_model
— MethodJuMP.owner_model(cref::DisjunctionRef)
Return the model to which cref
belongs.
JuMP.owner_model
— MethodJuMP.owner_model(cref::LogicalConstraintRef)
Return the model to which cref
belongs.
JuMP.owner_model
— MethodJuMP.owner_model(vref::LogicalVariableRef)
Return the GDP model
to which vref
belongs.
JuMP.set_name
— MethodJuMP.set_name(cref::DisjunctConstraintRef, name::String)
Set a constraint's name attribute.
JuMP.set_name
— MethodJuMP.set_name(cref::DisjunctionRef, name::String)
Set a constraint's name attribute.
JuMP.set_name
— MethodJuMP.set_name(cref::LogicalConstraintRef, name::String)
Set a constraint's name attribute.
JuMP.set_name
— MethodJuMP.set_name(vref::LogicalVariableRef, name::String)
Set a logical variable's name attribute.
JuMP.set_start_value
— MethodJuMP.set_start_value(vref::LogicalVariableRef, value::Union{Nothing, Bool})
Set the start value of the logical variable vref
.
Pass nothing
to unset the start value.
JuMP.start_value
— MethodJuMP.start_value(vref::LogicalVariableRef)
Return the start value of the logical variable vref
.
JuMP.unfix
— MethodJuMP.unfix(vref::LogicalVariableRef)
Delete the fixed value of a logical variable.