diff --git a/README.md b/README.md index 1833b5f..8237cc3 100644 --- a/README.md +++ b/README.md @@ -85,12 +85,12 @@ Two types of logical constraints are supported: ## Disjunctions -Disjunctions are built by first defining the constraints associated with each disjunct. This is done via the `@constraint` JuMP macro with the extra `DisjunctConstraint` tag specifying the Logical variable associated with the constraint: +Disjunctions are built by first defining the constraints associated with each disjunct. This is done via the `@constraint` JuMP macro with the extra `Disjunct` tag specifying the Logical variable associated with the constraint: ```julia @variable(model, x) -@constraint(model, x ≤ 100, DisjunctConstraint(Y[1])) -@constraint(model, x ≥ 200, DisjunctConstraint(Y[2])) +@constraint(model, x ≤ 100, Disjunct(Y[1])) +@constraint(model, x ≥ 200, Disjunct(Y[2])) ``` After all disjunct constraints associated with a disjunction have been defined, the disjunction is created with the `@disjunction` macro, where the disjunction is defined as a `Vector` of Logical variables associated with each disjunct: @@ -99,10 +99,10 @@ After all disjunct constraints associated with a disjunction have been defined, @disjunction(model, [Y[1], Y[2]]) ``` -Disjunctions can be nested by passing an additional `DisjunctConstraint` tag. The Logical variable in the `DisjunctConstraint` tag specifies which disjunct, the nested disjunction belongs to: +Disjunctions can be nested by passing an additional `Disjunct` tag. The Logical variable in the `Disjunct` tag specifies which disjunct, the nested disjunction belongs to: ```julia -@disjunction(model, Y[1:2], DisjunctConstraint(Y[3])) +@disjunction(model, Y[1:2], Disjunct(Y[3])) ``` Empty disjuncts are supported in GDP models. When used, the only constraints enforced on the model when the empty disjunct is selected are the global constraints and any other disjunction constraints defined. @@ -139,8 +139,8 @@ using HiGHS m = GDPModel(HiGHS.Optimizer) @variable(m, 0 ≤ x[1:2] ≤ 20) @variable(m, Y[1:2], Logical) -@constraint(m, [i = 1:2], [2,5][i] ≤ x[i] ≤ [6,9][i], DisjunctConstraint(Y[1])) -@constraint(m, [i = 1:2], [8,10][i] ≤ x[i] ≤ [11,15][i], DisjunctConstraint(Y[2])) +@constraint(m, [i = 1:2], [2,5][i] ≤ x[i] ≤ [6,9][i], Disjunct(Y[1])) +@constraint(m, [i = 1:2], [8,10][i] ≤ x[i] ≤ [11,15][i], Disjunct(Y[2])) @disjunction(m, Y) @constraint(m, Y in Exactly(1)) #logical constraint @objective(m, Max, sum(x)) diff --git a/docs/src/index.md b/docs/src/index.md index 587725e..22d382e 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -85,12 +85,12 @@ Two types of logical constraints are supported: ## Disjunctions -Disjunctions are built by first defining the constraints associated with each disjunct. This is done via the `@constraint` JuMP macro with the extra `DisjunctConstraint` tag specifying the Logical variable associated with the constraint: +Disjunctions are built by first defining the constraints associated with each disjunct. This is done via the `@constraint` JuMP macro with the extra `Disjunct` tag specifying the Logical variable associated with the constraint: ```julia @variable(model, x) -@constraint(model, x ≤ 100, DisjunctConstraint(Y[1])) -@constraint(model, x ≥ 200, DisjunctConstraint(Y[2])) +@constraint(model, x ≤ 100, Disjunct(Y[1])) +@constraint(model, x ≥ 200, Disjunct(Y[2])) ``` After all disjunct constraints associated with a disjunction have been defined, the disjunction is created with the `@disjunction` macro, where the disjunction is defined as a `Vector` of Logical variables associated with each disjunct: @@ -99,10 +99,10 @@ After all disjunct constraints associated with a disjunction have been defined, @disjunction(model, [Y[1], Y[2]]) ``` -Disjunctions can be nested by passing an additional `DisjunctConstraint` tag. The Logical variable in the `DisjunctConstraint` tag specifies which disjunct, the nested disjunction belongs to: +Disjunctions can be nested by passing an additional `Disjunct` tag. The Logical variable in the `Disjunct` tag specifies which disjunct, the nested disjunction belongs to: ```julia -@disjunction(model, Y[1:2], DisjunctConstraint(Y[3])) +@disjunction(model, Y[1:2], Disjunct(Y[3])) ``` Empty disjuncts are supported in GDP models. When used, the only constraints enforced on the model when the empty disjunct is selected are the global constraints and any other disjunction constraints defined. @@ -139,8 +139,8 @@ using HiGHS m = GDPModel(HiGHS.Optimizer) @variable(m, 0 ≤ x[1:2] ≤ 20) @variable(m, Y[1:2], Logical) -@constraint(m, [i = 1:2], [2,5][i] ≤ x[i] ≤ [6,9][i], DisjunctConstraint(Y[1])) -@constraint(m, [i = 1:2], [8,10][i] ≤ x[i] ≤ [11,15][i], DisjunctConstraint(Y[2])) +@constraint(m, [i = 1:2], [2,5][i] ≤ x[i] ≤ [6,9][i], Disjunct(Y[1])) +@constraint(m, [i = 1:2], [8,10][i] ≤ x[i] ≤ [11,15][i], Disjunct(Y[2])) @disjunction(m, Y) @constraint(m, Y in Exactly(1)) #logical constraint @objective(m, Max, sum(x)) diff --git a/examples/ex1.jl b/examples/ex1.jl index df28508..938b739 100644 --- a/examples/ex1.jl +++ b/examples/ex1.jl @@ -7,9 +7,9 @@ using HiGHS m = GDPModel() @variable(m, -5 ≤ x ≤ 10) @variable(m, Y[1:2], Logical) -@constraint(m, 0 ≤ x ≤ 3, DisjunctConstraint(Y[1])) -@constraint(m, 5 ≤ x, DisjunctConstraint(Y[2])) -@constraint(m, x ≤ 9, DisjunctConstraint(Y[2])) +@constraint(m, 0 ≤ x ≤ 3, Disjunct(Y[1])) +@constraint(m, 5 ≤ x, Disjunct(Y[2])) +@constraint(m, x ≤ 9, Disjunct(Y[2])) @disjunction(m, [Y[1], Y[2]]) @constraint(m, Y in Exactly(1)) @objective(m, Max, x) diff --git a/examples/ex2.jl b/examples/ex2.jl index ba8fbf9..eb4876e 100644 --- a/examples/ex2.jl +++ b/examples/ex2.jl @@ -5,8 +5,8 @@ using HiGHS m = GDPModel(HiGHS.Optimizer) @variable(m, 0 ≤ x[1:2] ≤ 20) @variable(m, Y[1:2], Logical) -@constraint(m, [i = 1:2], [2,5][i] ≤ x[i] ≤ [6,9][i], DisjunctConstraint(Y[1])) -@constraint(m, [i = 1:2], [8,10][i] ≤ x[i] ≤ [11,15][i], DisjunctConstraint(Y[2])) +@constraint(m, [i = 1:2], [2,5][i] ≤ x[i] ≤ [6,9][i], Disjunct(Y[1])) +@constraint(m, [i = 1:2], [8,10][i] ≤ x[i] ≤ [11,15][i], Disjunct(Y[2])) @disjunction(m, Y) @constraint(m, Y in Exactly(1)) #logical constraint @objective(m, Max, sum(x)) diff --git a/examples/ex3.jl b/examples/ex3.jl index e01ab5b..6bf5d3f 100644 --- a/examples/ex3.jl +++ b/examples/ex3.jl @@ -3,10 +3,10 @@ using DisjunctiveProgramming m = GDPModel() @variable(m, -5 ≤ x ≤ 10) @variable(m, Y[1:2], Logical) -@constraint(m, exp(x) <= 2, DisjunctConstraint(Y[1])) -@constraint(m, x >= -3, DisjunctConstraint(Y[1])) -@constraint(m, exp(x) >= 3, DisjunctConstraint(Y[2])) -@constraint(m, x >= 5, DisjunctConstraint(Y[2])) +@constraint(m, exp(x) <= 2, Disjunct(Y[1])) +@constraint(m, x >= -3, Disjunct(Y[1])) +@constraint(m, exp(x) >= 3, Disjunct(Y[2])) +@constraint(m, x >= 5, Disjunct(Y[2])) @disjunction(m, Y) @constraint(m, Y in Exactly(1)) #logical constraint @objective(m, Max, x) diff --git a/examples/ex5.jl b/examples/ex5.jl index d81e938..2202f79 100644 --- a/examples/ex5.jl +++ b/examples/ex5.jl @@ -7,11 +7,11 @@ m = GDPModel() @variable(m, Y[1:2], Logical) @variable(m, W[1:2], Logical) @objective(m, Max, sum(x)) -@constraint(m, y1[i=1:2], [1,4][i] ≤ x[i] ≤ [3,6][i], DisjunctConstraint(Y[1])) -@constraint(m, w1[i=1:2], [1,5][i] ≤ x[i] ≤ [2,6][i], DisjunctConstraint(W[1])) -@constraint(m, w2[i=1:2], [2,4][i] ≤ x[i] ≤ [3,5][i], DisjunctConstraint(W[2])) -@constraint(m, y2[i=1:2], [8,1][i] ≤ x[i] ≤ [9,2][i], DisjunctConstraint(Y[2])) -@disjunction(m, inner, [W[1], W[2]], DisjunctConstraint(Y[1])) +@constraint(m, y1[i=1:2], [1,4][i] ≤ x[i] ≤ [3,6][i], Disjunct(Y[1])) +@constraint(m, w1[i=1:2], [1,5][i] ≤ x[i] ≤ [2,6][i], Disjunct(W[1])) +@constraint(m, w2[i=1:2], [2,4][i] ≤ x[i] ≤ [3,5][i], Disjunct(W[2])) +@constraint(m, y2[i=1:2], [8,1][i] ≤ x[i] ≤ [9,2][i], Disjunct(Y[2])) +@disjunction(m, inner, [W[1], W[2]], Disjunct(Y[1])) @disjunction(m, outer, [Y[1], Y[2]]) @constraint(m, Y in Exactly(1)) @constraint(m, W in Exactly(Y[1])) diff --git a/examples/ex6.jl b/examples/ex6.jl index 0e057cc..f86e73f 100644 --- a/examples/ex6.jl +++ b/examples/ex6.jl @@ -5,24 +5,24 @@ m = GDPModel() @variable(m, -5 <= x[1:3] <= 5) @variable(m, y[1:2], Logical) -@constraint(m, x[1] <= -2, DisjunctConstraint(y[1])) -@constraint(m, x[1] >= 2, DisjunctConstraint(y[2])) -@constraint(m, x[2] == -1, DisjunctConstraint(y[2])) -@constraint(m, x[3] == 1, DisjunctConstraint(y[2])) +@constraint(m, x[1] <= -2, Disjunct(y[1])) +@constraint(m, x[1] >= 2, Disjunct(y[2])) +@constraint(m, x[2] == -1, Disjunct(y[2])) +@constraint(m, x[3] == 1, Disjunct(y[2])) @disjunction(m, y) @constraint(m, y in Exactly(1)) @variable(m, w[1:2], Logical) -@constraint(m, x[2] <= -3, DisjunctConstraint(w[1])) -@constraint(m, x[2] >= 3, DisjunctConstraint(w[2])) -@constraint(m, x[3] == 0, DisjunctConstraint(w[2])) -@disjunction(m, w, DisjunctConstraint(y[1])) +@constraint(m, x[2] <= -3, Disjunct(w[1])) +@constraint(m, x[2] >= 3, Disjunct(w[2])) +@constraint(m, x[3] == 0, Disjunct(w[2])) +@disjunction(m, w, Disjunct(y[1])) @constraint(m, w in Exactly(y[1])) @variable(m, z[1:2], Logical) -@constraint(m, x[3] <= -4, DisjunctConstraint(z[1])) -@constraint(m, x[3] >= 4, DisjunctConstraint(z[2])) -@disjunction(m, z, DisjunctConstraint(w[1])) +@constraint(m, x[3] <= -4, Disjunct(z[1])) +@constraint(m, x[3] >= 4, Disjunct(z[2])) +@disjunction(m, z, Disjunct(w[1])) @constraint(m, z in Exactly(w[1])) ## diff --git a/src/constraints.jl b/src/constraints.jl index 1acdab1..7510baf 100644 --- a/src/constraints.jl +++ b/src/constraints.jl @@ -163,20 +163,20 @@ end _error::Function, func, set::_MOI.AbstractScalarSet, - tag::DisjunctConstraint + 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 -`DisjunctConstraint(::Type{LogicalVariableRef})`. The user must specify the +`Disjunct(::Type{LogicalVariableRef})`. The user must specify the `LogicalVariable` to use as the indicator for the `_DisjunctConstraint` being created. """ function JuMP.build_constraint( _error::Function, func, set::_MOI.AbstractScalarSet, - tag::DisjunctConstraint + tag::Disjunct ) _check_expression(func) constr = build_constraint(_error, func, set) @@ -194,7 +194,7 @@ for SetType in ( _error::Function, func, set::$($SetType), - tag::DisjunctConstraint + tag::Disjunct )::_DisjunctConstraint Extend `JuMP.build_constraint` to add `VectorConstraint`s to disjuncts. @@ -203,7 +203,7 @@ for SetType in ( _error::Function, func, set::$SetType, - tag::DisjunctConstraint + tag::Disjunct ) _check_expression(func) constr = build_constraint(_error, func, set) @@ -218,7 +218,7 @@ function JuMP.build_constraint( func::AbstractJuMPScalar, lb::Real, ub::Real, - tag::DisjunctConstraint + tag::Disjunct ) _check_expression(func) constr = build_constraint(_error, func, lb, ub) @@ -234,7 +234,7 @@ end name::String = "" )::DisjunctConstraintRef -Extend `JuMP.add_constraint` to add a [`DisjunctConstraint`](@ref) to a [`GDPModel`](@ref). +Extend `JuMP.add_constraint` to add a [`Disjunct`](@ref) to a [`GDPModel`](@ref). The constraint is added to the `GDPData` in the `.ext` dictionary of the `GDPModel`. """ function JuMP.add_constraint( @@ -329,7 +329,7 @@ function _disjunction( model::Model, # TODO: generalize to AbstractModel structure, name::String, - tag::DisjunctConstraint + tag::Disjunct ) dref = _create_disjunction(_error, model, structure, name, true) obj = constraint_object(dref) @@ -362,7 +362,7 @@ Function to add a [`Disjunction`](@ref) to a [`GDPModel`](@ref). disjunction( model::Model, disjunct_indicators::Vector{LogicalVariableRef}, - nested_tag::DisjunctConstraint, + nested_tag::Disjunct, name::String = "" ) @@ -378,7 +378,7 @@ end function disjunction( model::Model, disjunct_indicators, - nested_tag::DisjunctConstraint, + nested_tag::Disjunct, name::String = "" ) # TODO add kw argument to build exactly 1 constraint return _disjunction(error, model, disjunct_indicators, name, nested_tag) diff --git a/src/datatypes.jl b/src/datatypes.jl index 65292b0..674f625 100644 --- a/src/datatypes.jl +++ b/src/datatypes.jl @@ -176,20 +176,20 @@ end # DISJUNCT CONSTRAINTS ################################################################################ """ - DisjunctConstraint + Disjunct Used as a tag for constraints that will be used in disjunctions. This is done via the following syntax: ```julia-repl -julia> @constraint(model, [constr_expr], DisjunctConstraint) +julia> @constraint(model, [constr_expr], Disjunct) -julia> @constraint(model, [constr_expr], DisjunctConstraint(lvref)) +julia> @constraint(model, [constr_expr], Disjunct(lvref)) ``` where `lvref` is a [`LogicalVariableRef`](@ref) 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. """ -struct DisjunctConstraint +struct Disjunct indicator::LogicalVariableRef end @@ -202,7 +202,7 @@ end """ DisjunctConstraintIndex -A type for storing the index of a [`DisjunctConstraint`](@ref). +A type for storing the index of a [`Disjunct`](@ref). **Fields** - `value::Int64`: The index value. diff --git a/src/macros.jl b/src/macros.jl index f71eb8e..d2a7344 100644 --- a/src/macros.jl +++ b/src/macros.jl @@ -172,7 +172,7 @@ macro disjunction(model, args...) _error("Invalid syntax. Did you mean to use `@disjunctions`?") end - # TODO: three cases lead to problems when julia variables are used for DisjunctConstraint tags + # TODO: three cases lead to problems when julia variables are used for Disjunct tags # which violate the cases considered in the table further below. The three cases are # (i) @disjunction(m, Y[1, :], tag[1]) --> gets confused for @disjunction(m, name[...], Y[1, :]) (Case 2 below) # (ii) @disjunction(m, Y, tagref) --> gets confused for @disjunction(m, name, Y) (Case 1 below) @@ -281,8 +281,8 @@ model = GDPModel(); @variable(model, w); @variable(model, x); @variable(model, Y[1:4], LogicalVariable); -@constraint(model, [i=1:2], w == i, DisjunctConstraint(Y[i])); -@constraint(model, [i=3:4], x == i, DisjunctConstraint(Y[i])); +@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]] diff --git a/test/constraints/bigm.jl b/test/constraints/bigm.jl index eef1872..f097228 100644 --- a/test/constraints/bigm.jl +++ b/test/constraints/bigm.jl @@ -20,7 +20,7 @@ function test_get_M_1sided() model = GDPModel() @variable(model, x) @variable(model, y, Logical) - @constraint(model, con, 3*x <= 1, DisjunctConstraint(y)) + @constraint(model, con, 3*x <= 1, Disjunct(y)) cobj = constraint_object(con) M = DP._get_M(cobj.func, cobj.set, BigM(100, false)) @test M == 100 @@ -31,7 +31,7 @@ function test_get_tight_M_1sided() model = GDPModel() @variable(model, x) @variable(model, y, Logical) - @constraint(model, con, 3*x <= 1, DisjunctConstraint(y)) + @constraint(model, con, 3*x <= 1, Disjunct(y)) cobj = constraint_object(con) method = BigM(100) @@ -54,7 +54,7 @@ function test_get_M_2sided() model = GDPModel() @variable(model, x) @variable(model, y, Logical) - @constraint(model, con, 3*x == 1, DisjunctConstraint(y)) + @constraint(model, con, 3*x == 1, Disjunct(y)) cobj = constraint_object(con) method = BigM(100) @@ -70,7 +70,7 @@ function test_get_tight_M_2sided() model = GDPModel() @variable(model, x) @variable(model, y, Logical) - @constraint(model, con, 3*x == 1, DisjunctConstraint(y)) + @constraint(model, con, 3*x == 1, Disjunct(y)) cobj = constraint_object(con) method = BigM(100) @@ -177,7 +177,7 @@ function test_lessthan_bigm() model = GDPModel() @variable(model, x) @variable(model, y, Logical) - @constraint(model, con, x <= 5, DisjunctConstraint(y)) + @constraint(model, con, x <= 5, Disjunct(y)) DP._reformulate_logical_variables(model) bvref = DP._indicator_to_binary(model)[y] @@ -191,7 +191,7 @@ function test_nonpositives_bigm() model = GDPModel() @variable(model, x) @variable(model, y, Logical) - @constraint(model, con, [x; x] <= [5; 5], DisjunctConstraint(y)) + @constraint(model, con, [x; x] <= [5; 5], Disjunct(y)) DP._reformulate_logical_variables(model) bvref = DP._indicator_to_binary(model)[y] @@ -206,7 +206,7 @@ function test_greaterthan_bigm() model = GDPModel() @variable(model, x) @variable(model, y, Logical) - @constraint(model, con, x >= 5, DisjunctConstraint(y)) + @constraint(model, con, x >= 5, Disjunct(y)) DP._reformulate_logical_variables(model) bvref = DP._indicator_to_binary(model)[y] @@ -220,7 +220,7 @@ function test_nonnegatives_bigm() model = GDPModel() @variable(model, x) @variable(model, y, Logical) - @constraint(model, con, [x; x] >= [5; 5], DisjunctConstraint(y)) + @constraint(model, con, [x; x] >= [5; 5], Disjunct(y)) DP._reformulate_logical_variables(model) bvref = DP._indicator_to_binary(model)[y] @@ -235,7 +235,7 @@ function test_equalto_bigm() model = GDPModel() @variable(model, x) @variable(model, y, Logical) - @constraint(model, con, x == 5, DisjunctConstraint(y)) + @constraint(model, con, x == 5, Disjunct(y)) DP._reformulate_logical_variables(model) bvref = DP._indicator_to_binary(model)[y] @@ -251,7 +251,7 @@ function test_interval_bigm() model = GDPModel() @variable(model, x) @variable(model, y, Logical) - @constraint(model, con, 5 <= x <= 5, DisjunctConstraint(y)) + @constraint(model, con, 5 <= x <= 5, Disjunct(y)) DP._reformulate_logical_variables(model) bvref = DP._indicator_to_binary(model)[y] @@ -267,7 +267,7 @@ function test_zeros_bigm() model = GDPModel() @variable(model, x) @variable(model, y, Logical) - @constraint(model, con, [x; x] == [5; 5], DisjunctConstraint(y)) + @constraint(model, con, [x; x] == [5; 5], Disjunct(y)) DP._reformulate_logical_variables(model) bvref = DP._indicator_to_binary(model)[y] @@ -286,11 +286,11 @@ function test_nested_bigm() @variable(model, -100 <= x <= 100) @variable(model, y[1:2], Logical) @variable(model, z[1:2], Logical) - @constraint(model, x <= 5, DisjunctConstraint(y[1])) - @constraint(model, x >= 5, DisjunctConstraint(y[2])) - @disjunction(model, inner, y, DisjunctConstraint(z[1])) - @constraint(model, x <= 10, DisjunctConstraint(z[1])) - @constraint(model, x >= 10, DisjunctConstraint(z[2])) + @constraint(model, x <= 5, Disjunct(y[1])) + @constraint(model, x >= 5, Disjunct(y[2])) + @disjunction(model, inner, y, Disjunct(z[1])) + @constraint(model, x <= 10, Disjunct(z[1])) + @constraint(model, x >= 10, Disjunct(z[2])) @disjunction(model, outer, z) reformulate_model(model, BigM()) diff --git a/test/constraints/disjunct.jl b/test/constraints/disjunct.jl index 64f6377..91f79f6 100644 --- a/test/constraints/disjunct.jl +++ b/test/constraints/disjunct.jl @@ -2,20 +2,20 @@ function test_disjunct_add_fail() model = GDPModel() @variable(model, x) @variable(GDPModel(), y, Logical) - @test_macro_throws UndefVarError @constraint(model, x == 1, DisjunctConstraint(y)) # logical variable from another model + @test_macro_throws UndefVarError @constraint(model, x == 1, Disjunct(y)) # logical variable from another model @variable(model, w, Logical) @variable(model, z, Bin) - @test_macro_throws UndefVarError @constraint(model, z == 1, DisjunctConstraint(w)) # binary variable - @test_throws ErrorException build_constraint(error, 1z, MOI.EqualTo(1), DisjunctConstraint(w)) # binary variable + @test_macro_throws UndefVarError @constraint(model, z == 1, Disjunct(w)) # binary variable + @test_throws ErrorException build_constraint(error, 1z, MOI.EqualTo(1), Disjunct(w)) # binary variable end function test_disjunct_add_success() model = GDPModel() @variable(model, x) @variable(model, y, Logical) - c1 = @constraint(model, x == 1, DisjunctConstraint(y)) - @constraint(model, c2, x == 1, DisjunctConstraint(y)) + c1 = @constraint(model, x == 1, Disjunct(y)) + @constraint(model, c2, x == 1, Disjunct(y)) @test owner_model(c1) == model @test is_valid(model, c1) @test index(c1) == DisjunctConstraintIndex(1) @@ -36,7 +36,7 @@ function test_disjunct_add_array() model = GDPModel() @variable(model, x) @variable(model, y[1:2, 1:3], Logical) - @constraint(model, con[i=1:2, j=1:3], x == 1, DisjunctConstraint(y[i,j])) + @constraint(model, con[i=1:2, j=1:3], x == 1, Disjunct(y[i,j])) @test con isa Matrix{DisjunctConstraintRef} @test length(con) == 6 end @@ -47,7 +47,7 @@ function test_disjunct_add_dense_axis() I = ["a", "b", "c"] J = [1, 2] @variable(model, y[I, J], Logical) - @constraint(model, con[i=I, j=J], x == 1, DisjunctConstraint(y[i,j])) + @constraint(model, con[i=I, j=J], x == 1, Disjunct(y[i,j])) @test con isa Containers.DenseAxisArray @test con.axes[1] == ["a","b","c"] @@ -59,7 +59,7 @@ function test_disjunct_add_sparse_axis() model = GDPModel() @variable(model, x) @variable(model, y[1:3, 1:3], Logical) - @constraint(model, con[i=1:3, j=1:3; j > i], x==i+j, DisjunctConstraint(y[i,j])) + @constraint(model, con[i=1:3, j=1:3; j > i], x==i+j, Disjunct(y[i,j])) @test con isa Containers.SparseAxisArray @test length(con) == 3 @@ -71,7 +71,7 @@ function test_disjunct_set_name() model = GDPModel() @variable(model, x) @variable(model, y, Logical) - c1 = @constraint(model, x == 1, DisjunctConstraint(y)) + c1 = @constraint(model, x == 1, Disjunct(y)) set_name(c1, "new name") @test name(c1) == "new name" end @@ -80,7 +80,7 @@ function test_disjunct_delete() model = GDPModel() @variable(model, x) @variable(model, y, Logical) - @constraint(model, c1, x == 1, DisjunctConstraint(y)) + @constraint(model, c1, x == 1, Disjunct(y)) @test_throws AssertionError delete(GDPModel(), c1) delete(model, c1) diff --git a/test/constraints/disjunction.jl b/test/constraints/disjunction.jl index f0684d0..9804ba8 100644 --- a/test/constraints/disjunction.jl +++ b/test/constraints/disjunction.jl @@ -12,7 +12,7 @@ function test_disjunction_add_fail() model = GDPModel() @variable(model, x) @variable(model, y[1:2], Logical) - @constraint(model, x == 5, DisjunctConstraint(y[1])) + @constraint(model, x == 5, Disjunct(y[1])) @test_macro_throws ErrorException @disjunction(model) #not enough arguments @test_macro_throws UndefVarError @disjunction(model, y) #unassociated indicator @@ -28,7 +28,7 @@ function test_disjunction_add_fail() @test_macro_throws ErrorException @disjunction(model, begin y end) #@disjunctions (plural) @test_macro_throws UndefVarError @disjunction(model, x, y) #name x already exists - @constraint(model, x == 10, DisjunctConstraint(y[2])) + @constraint(model, x == 10, Disjunct(y[2])) @disjunction(model, disj, y) @test_macro_throws UndefVarError @disjunction(model, disj, y) #duplicate name @test_throws ErrorException DP._error_if_cannot_register(error, model, :disj) #duplicate name @@ -41,8 +41,8 @@ function test_disjunction_add_success() model = GDPModel() @variable(model, x) @variable(model, y[1:2], Logical) - @constraint(model, x == 5, DisjunctConstraint(y[1])) - @constraint(model, x == 10, DisjunctConstraint(y[2])) + @constraint(model, x == 5, Disjunct(y[1])) + @constraint(model, x == 10, Disjunct(y[2])) disj = @disjunction(model, y) @disjunction(model, disj2, y) @test owner_model(disj) == model @@ -63,11 +63,11 @@ function test_disjunction_add_nested() @variable(model, x) @variable(model, y[1:2], Logical) @variable(model, z[1:2], Logical) - @constraint(model, x <= 5, DisjunctConstraint(y[1])) - @constraint(model, x >= 5, DisjunctConstraint(y[2])) - @disjunction(model, inner, y, DisjunctConstraint(z[1])) - @constraint(model, x <= 10, DisjunctConstraint(z[1])) - @constraint(model, x >= 10, DisjunctConstraint(z[2])) + @constraint(model, x <= 5, Disjunct(y[1])) + @constraint(model, x >= 5, Disjunct(y[2])) + @disjunction(model, inner, y, Disjunct(z[1])) + @constraint(model, x <= 10, Disjunct(z[1])) + @constraint(model, x >= 10, Disjunct(z[2])) @disjunction(model, outer, z) @test is_valid(model, inner) @@ -84,7 +84,7 @@ function test_disjunction_add_array() model=GDPModel() @variable(model, x) @variable(model, y[1:2, 1:3, 1:4], Logical) - @constraint(model, con[i=1:2, j=1:3, k=1:4], x==i+j+k, DisjunctConstraint(y[i,j,k])) + @constraint(model, con[i=1:2, j=1:3, k=1:4], x==i+j+k, Disjunct(y[i,j,k])) @disjunction(model, disj[i=1:2, j=1:3], y[i,j,:]) @test disj isa Matrix{DisjunctionRef} @@ -98,7 +98,7 @@ function test_disjunciton_add_dense_axis() I = ["a", "b", "c"] J = [1, 2] @variable(model, y[I, J, 1:4], Logical) - @constraint(model, con[i=I, j=J, k=1:4], x==k, DisjunctConstraint(y[i,j,k])) + @constraint(model, con[i=I, j=J, k=1:4], x==k, Disjunct(y[i,j,k])) @disjunction(model, disj[i=I, j=J], y[i,j,:]) @test disj isa Containers.DenseAxisArray @@ -111,7 +111,7 @@ function test_disjunction_add_sparse_axis() model = GDPModel() @variable(model, x) @variable(model, y[1:3, 1:3, 1:4], Logical) - @constraint(model, con[i=1:3, j=1:3, k=1:4; j > i], x==i+j+k, DisjunctConstraint(y[i,j,k])) + @constraint(model, con[i=1:3, j=1:3, k=1:4; j > i], x==i+j+k, Disjunct(y[i,j,k])) @disjunction(model, disj[i=1:3, j=1:3; j > i], y[i,j,:]) @test disj isa Containers.SparseAxisArray @@ -125,8 +125,8 @@ function test_disjunctions_add_fail() @variable(model, x) @variable(model, y[1:2], Logical) @variable(model, z[1:2], Logical) - @constraint(model, x <= 5, DisjunctConstraint(y[1])) - @constraint(model, x >= 5, DisjunctConstraint(y[2])) + @constraint(model, x <= 5, Disjunct(y[1])) + @constraint(model, x >= 5, Disjunct(y[2])) @test_macro_throws ErrorException @disjunctions(model, y) end @@ -135,10 +135,10 @@ function test_disjunctions_add_success() @variable(model, x) @variable(model, y[1:2], Logical) @variable(model, z[1:2], Logical) - @constraint(model, x <= 5, DisjunctConstraint(y[1])) - @constraint(model, x >= 5, DisjunctConstraint(y[2])) - @constraint(model, x <= 10, DisjunctConstraint(z[1])) - @constraint(model, x >= 10, DisjunctConstraint(z[2])) + @constraint(model, x <= 5, Disjunct(y[1])) + @constraint(model, x >= 5, Disjunct(y[2])) + @constraint(model, x <= 10, Disjunct(z[1])) + @constraint(model, x >= 10, Disjunct(z[2])) @disjunctions(model, begin disj1, y disj2, z @@ -161,8 +161,8 @@ function test_disjunction_set_name() model = GDPModel() @variable(model, x) @variable(model, y[1:2], Logical) - @constraint(model, x == 5, DisjunctConstraint(y[1])) - @constraint(model, x == 10, DisjunctConstraint(y[2])) + @constraint(model, x == 5, Disjunct(y[1])) + @constraint(model, x == 10, Disjunct(y[2])) @disjunction(model, disj, y) set_name(disj, "new_name") @test name(disj) == "new_name" @@ -172,8 +172,8 @@ function test_disjunction_delete() model = GDPModel() @variable(model, x) @variable(model, y[1:2], Logical) - @constraint(model, x == 5, DisjunctConstraint(y[1])) - @constraint(model, x == 10, DisjunctConstraint(y[2])) + @constraint(model, x == 5, Disjunct(y[1])) + @constraint(model, x == 10, Disjunct(y[2])) @disjunction(model, disj, y) @test_throws AssertionError delete(GDPModel(), disj) @@ -186,8 +186,8 @@ function test_disjunction_function() model = GDPModel() @variable(model, x) @variable(model, y[1:2], Logical) - @constraint(model, x == 5, DisjunctConstraint(y[1])) - @constraint(model, x == 10, DisjunctConstraint(y[2])) + @constraint(model, x == 5, Disjunct(y[1])) + @constraint(model, x == 10, Disjunct(y[2])) disj = disjunction(model, y, "name") @test is_valid(model, disj) @@ -202,11 +202,11 @@ function test_disjunction_function_nested() @variable(model, x) @variable(model, y[1:2], Logical) @variable(model, z[1:2], Logical) - @constraint(model, x <= 5, DisjunctConstraint(y[1])) - @constraint(model, x >= 5, DisjunctConstraint(y[2])) - @constraint(model, x <= 10, DisjunctConstraint(z[1])) - @constraint(model, x >= 10, DisjunctConstraint(z[2])) - disj1 = disjunction(model, y, DisjunctConstraint(z[1]), "inner") + @constraint(model, x <= 5, Disjunct(y[1])) + @constraint(model, x >= 5, Disjunct(y[2])) + @constraint(model, x <= 10, Disjunct(z[1])) + @constraint(model, x >= 10, Disjunct(z[2])) + disj1 = disjunction(model, y, Disjunct(z[1]), "inner") disj2 = disjunction(model, z, "outer") @test is_valid(model, disj1) diff --git a/test/constraints/hull.jl b/test/constraints/hull.jl index 1e151ef..8eca869 100644 --- a/test/constraints/hull.jl +++ b/test/constraints/hull.jl @@ -325,7 +325,7 @@ function test_scalar_var_hull_1sided(moiset) model = GDPModel() @variable(model, 10 <= x <= 100) @variable(model, z, Logical) - @constraint(model, con, x in moiset(5), DisjunctConstraint(z)) + @constraint(model, con, x in moiset(5), Disjunct(z)) DP._reformulate_logical_variables(model) zbin = variable_by_name(model, "z") method = DP._Hull(Hull(1e-3, Dict(x => (0., 100.))), Set([x])) @@ -342,7 +342,7 @@ function test_scalar_affine_hull_1sided(moiset) model = GDPModel() @variable(model, 10 <= x <= 100) @variable(model, z, Logical) - @constraint(model, con, 1x in moiset(5), DisjunctConstraint(z)) + @constraint(model, con, 1x in moiset(5), Disjunct(z)) DP._reformulate_logical_variables(model) zbin = variable_by_name(model, "z") method = DP._Hull(Hull(1e-3, Dict(x => (0., 100.))), Set([x])) @@ -359,7 +359,7 @@ function test_vector_var_hull_1sided(moiset) model = GDPModel() @variable(model, 10 <= x <= 100) @variable(model, z, Logical) - @constraint(model, con, [x; x] in moiset(2), DisjunctConstraint(z)) + @constraint(model, con, [x; x] in moiset(2), Disjunct(z)) DP._reformulate_logical_variables(model) zbin = variable_by_name(model, "z") method = DP._Hull(Hull(1e-3, Dict(x => (0., 100.))), Set([x])) @@ -375,7 +375,7 @@ function test_vector_affine_hull_1sided(moiset) model = GDPModel() @variable(model, 10 <= x <= 100) @variable(model, z, Logical) - @constraint(model, con, [x - 5; x - 5] in moiset(2), DisjunctConstraint(z)) + @constraint(model, con, [x - 5; x - 5] in moiset(2), Disjunct(z)) DP._reformulate_logical_variables(model) zbin = variable_by_name(model, "z") method = DP._Hull(Hull(1e-3, Dict(x => (0., 100.))), Set([x])) @@ -391,7 +391,7 @@ function test_scalar_quadratic_hull_1sided(moiset) model = GDPModel() @variable(model, 10 <= x <= 100) @variable(model, z, Logical) - @constraint(model, con, x^2 in moiset(5), DisjunctConstraint(z)) + @constraint(model, con, x^2 in moiset(5), Disjunct(z)) DP._reformulate_logical_variables(model) zbin = variable_by_name(model, "z") ϵ = 1e-3 @@ -416,7 +416,7 @@ function test_vector_quadratic_hull_1sided(moiset) model = GDPModel() @variable(model, 10 <= x <= 100) @variable(model, z, Logical) - @constraint(model, con, [x^2 - 5; x^2 - 5] in moiset(2), DisjunctConstraint(z)) + @constraint(model, con, [x^2 - 5; x^2 - 5] in moiset(2), Disjunct(z)) DP._reformulate_logical_variables(model) zbin = variable_by_name(model, "z") ϵ = 1e-3 @@ -441,7 +441,7 @@ function test_scalar_nonlinear_hull_1sided_error() model = GDPModel() @variable(model, 10 <= x <= 100) @variable(model, z, Logical) - @constraint(model, con, log(x) <= 10, DisjunctConstraint(z)) + @constraint(model, con, log(x) <= 10, Disjunct(z)) DP._reformulate_logical_variables(model) zbin = variable_by_name(model, "z") ϵ = 1e-3 @@ -453,7 +453,7 @@ function test_scalar_nonlinear_hull_1sided(moiset) model = GDPModel() @variable(model, 10 <= x <= 100) @variable(model, z, Logical) - @constraint(model, con, x^3 in moiset(5), DisjunctConstraint(z)) + @constraint(model, con, x^3 in moiset(5), Disjunct(z)) DP._reformulate_logical_variables(model) zbin = variable_by_name(model, "z") ϵ = 1e-3 @@ -483,7 +483,7 @@ function test_vector_nonlinear_hull_1sided_error() model = GDPModel() @variable(model, 10 <= x <= 100) @variable(model, z, Logical) - @constraint(model, con, [log(x),log(x)] <= [10,10], DisjunctConstraint(z)) + @constraint(model, con, [log(x),log(x)] <= [10,10], Disjunct(z)) DP._reformulate_logical_variables(model) zbin = variable_by_name(model, "z") ϵ = 1e-3 @@ -495,7 +495,7 @@ function test_vector_nonlinear_hull_1sided(moiset) model = GDPModel() @variable(model, 10 <= x <= 100) @variable(model, z, Logical) - @constraint(model, con, [x^3 - 5; x^3 - 5] in moiset(2), DisjunctConstraint(z)) + @constraint(model, con, [x^3 - 5; x^3 - 5] in moiset(2), Disjunct(z)) DP._reformulate_logical_variables(model) zbin = variable_by_name(model, "z") ϵ = 1e-3 @@ -528,7 +528,7 @@ function test_scalar_var_hull_2sided() model = GDPModel() @variable(model, 10 <= x <= 100) @variable(model, z, Logical) - @constraint(model, con, x in MOI.Interval(5,5), DisjunctConstraint(z)) + @constraint(model, con, x in MOI.Interval(5,5), Disjunct(z)) DP._reformulate_logical_variables(model) zbin = variable_by_name(model, "z") ϵ = 1e-3 @@ -548,7 +548,7 @@ function test_scalar_affine_hull_2sided() model = GDPModel() @variable(model, 10 <= x <= 100) @variable(model, z, Logical) - @constraint(model, con, 5 <= x <= 5, DisjunctConstraint(z)) + @constraint(model, con, 5 <= x <= 5, Disjunct(z)) DP._reformulate_logical_variables(model) zbin = variable_by_name(model, "z") ϵ = 1e-3 @@ -568,7 +568,7 @@ function test_scalar_quadratic_hull_2sided() model = GDPModel() @variable(model, 10 <= x <= 100) @variable(model, z, Logical) - @constraint(model, con, 5 <= x^2 <= 5, DisjunctConstraint(z)) + @constraint(model, con, 5 <= x^2 <= 5, Disjunct(z)) DP._reformulate_logical_variables(model) zbin = variable_by_name(model, "z") ϵ = 1e-3 @@ -595,7 +595,7 @@ function test_scalar_nonlinear_hull_2sided_error() model = GDPModel() @variable(model, 10 <= x <= 100) @variable(model, z, Logical) - @constraint(model, con, 0 <= log(x) <= 10, DisjunctConstraint(z)) + @constraint(model, con, 0 <= log(x) <= 10, Disjunct(z)) DP._reformulate_logical_variables(model) zbin = variable_by_name(model, "z") ϵ = 1e-3 @@ -607,7 +607,7 @@ function test_scalar_nonlinear_hull_2sided() model = GDPModel() @variable(model, 10 <= x <= 100) @variable(model, z, Logical) - @constraint(model, con, 5 <= x^3 <= 5, DisjunctConstraint(z)) + @constraint(model, con, 5 <= x^3 <= 5, Disjunct(z)) DP._reformulate_logical_variables(model) zbin = variable_by_name(model, "z") ϵ = 1e-3 diff --git a/test/constraints/indicator.jl b/test/constraints/indicator.jl index f6697c5..14a29c9 100644 --- a/test/constraints/indicator.jl +++ b/test/constraints/indicator.jl @@ -2,12 +2,12 @@ function test_indicator_scalar_constraints() model = GDPModel() @variable(model, x) @variable(model, y[1:2], Logical) - @constraint(model, x == 5, DisjunctConstraint(y[1])) - @constraint(model, x <= 5, DisjunctConstraint(y[1])) - @constraint(model, x >= 5, DisjunctConstraint(y[1])) - @constraint(model, x == 10, DisjunctConstraint(y[2])) - @constraint(model, x <= 10, DisjunctConstraint(y[2])) - @constraint(model, x >= 10, DisjunctConstraint(y[2])) + @constraint(model, x == 5, Disjunct(y[1])) + @constraint(model, x <= 5, Disjunct(y[1])) + @constraint(model, x >= 5, Disjunct(y[1])) + @constraint(model, x == 10, Disjunct(y[2])) + @constraint(model, x <= 10, Disjunct(y[2])) + @constraint(model, x >= 10, Disjunct(y[2])) @disjunction(model, y) reformulate_model(model, Indicator()) @@ -24,9 +24,9 @@ function test_indicator_vector_constraints() A = [1 0; 0 1] @variable(model, x) @variable(model, y[1:3], Logical) - @constraint(model, A*[x,x] == [5,5], DisjunctConstraint(y[1])) - @constraint(model, A*[x,x] <= [0,0], DisjunctConstraint(y[2])) - @constraint(model, A*[x,x] >= [10,10], DisjunctConstraint(y[3])) + @constraint(model, A*[x,x] == [5,5], Disjunct(y[1])) + @constraint(model, A*[x,x] <= [0,0], Disjunct(y[2])) + @constraint(model, A*[x,x] >= [10,10], Disjunct(y[3])) @disjunction(model, y) reformulate_model(model, Indicator()) @@ -42,8 +42,8 @@ function test_indicator_array() model = GDPModel() @variable(model, x) @variable(model, y[1:2], Logical) - @constraint(model, [1:3, 1:2], x <= 6, DisjunctConstraint(y[1])) - @constraint(model, [1:3, 1:2], x >= 6, DisjunctConstraint(y[2])) + @constraint(model, [1:3, 1:2], x <= 6, Disjunct(y[1])) + @constraint(model, [1:3, 1:2], x >= 6, Disjunct(y[2])) @disjunction(model, y) reformulate_model(model, Indicator()) @@ -59,8 +59,8 @@ function test_indicator_dense_axis() model = GDPModel() @variable(model, x) @variable(model, y[1:2], Logical) - @constraint(model, [["a","b","c"],[1,2]], x <= 7, DisjunctConstraint(y[1])) - @constraint(model, [["a","b","c"],[1,2]], x >= 7, DisjunctConstraint(y[2])) + @constraint(model, [["a","b","c"],[1,2]], x <= 7, Disjunct(y[1])) + @constraint(model, [["a","b","c"],[1,2]], x >= 7, Disjunct(y[2])) @disjunction(model, y) reformulate_model(model, Indicator()) @@ -76,8 +76,8 @@ function test_indicator_sparse_axis() model = GDPModel() @variable(model, x) @variable(model, y[1:2], Logical) - @constraint(model, [i = 1:3, j = 1:3; j > i], x <= 7, DisjunctConstraint(y[1])) - @constraint(model, [i = 1:3, j = 1:3; j > i], x >= 7, DisjunctConstraint(y[2])) + @constraint(model, [i = 1:3, j = 1:3; j > i], x <= 7, Disjunct(y[1])) + @constraint(model, [i = 1:3, j = 1:3; j > i], x >= 7, Disjunct(y[2])) @disjunction(model, y) reformulate_model(model, Indicator()) @@ -94,11 +94,11 @@ function test_indicator_nested() @variable(model, x) @variable(model, y[1:2], Logical) @variable(model, z[1:2], Logical) - @constraint(model, x <= 5, DisjunctConstraint(y[1])) - @constraint(model, x >= 5, DisjunctConstraint(y[2])) - @disjunction(model, y, DisjunctConstraint(z[1])) - @constraint(model, x <= 10, DisjunctConstraint(z[1])) - @constraint(model, x >= 10, DisjunctConstraint(z[2])) + @constraint(model, x <= 5, Disjunct(y[1])) + @constraint(model, x >= 5, Disjunct(y[2])) + @disjunction(model, y, Disjunct(z[1])) + @constraint(model, x <= 10, Disjunct(z[1])) + @constraint(model, x >= 10, Disjunct(z[2])) @disjunction(model, z) reformulate_model(model, Indicator()) diff --git a/test/solve.jl b/test/solve.jl index 32a2c40..0cc2edb 100644 --- a/test/solve.jl +++ b/test/solve.jl @@ -7,11 +7,11 @@ function test_linear_gdp_example() @variable(m, Y[1:2], Logical) @variable(m, W[1:2], Logical) @objective(m, Max, sum(x)) - @constraint(m, y1[i=1:2], [1,4][i] ≤ x[i] ≤ [3,6][i], DisjunctConstraint(Y[1])) - @constraint(m, w1[i=1:2], [1,5][i] ≤ x[i] ≤ [2,6][i], DisjunctConstraint(W[1])) - @constraint(m, w2[i=1:2], [2,4][i] ≤ x[i] ≤ [3,5][i], DisjunctConstraint(W[2])) - @constraint(m, y2[i=1:2], [8,1][i] ≤ x[i] ≤ [9,2][i], DisjunctConstraint(Y[2])) - @disjunction(m, inner, [W[1], W[2]], DisjunctConstraint(Y[1])) + @constraint(m, y1[i=1:2], [1,4][i] ≤ x[i] ≤ [3,6][i], Disjunct(Y[1])) + @constraint(m, w1[i=1:2], [1,5][i] ≤ x[i] ≤ [2,6][i], Disjunct(W[1])) + @constraint(m, w2[i=1:2], [2,4][i] ≤ x[i] ≤ [3,5][i], Disjunct(W[2])) + @constraint(m, y2[i=1:2], [8,1][i] ≤ x[i] ≤ [9,2][i], Disjunct(Y[2])) + @disjunction(m, inner, [W[1], W[2]], Disjunct(Y[1])) @disjunction(m, outer, [Y[1], Y[2]]) @constraint(m, Y in Exactly(1)) @constraint(m, W in Exactly(Y[1])) diff --git a/test/variables/logical.jl b/test/variables/logical.jl index d187575..255c2ef 100644 --- a/test/variables/logical.jl +++ b/test/variables/logical.jl @@ -113,8 +113,8 @@ function test_lvar_delete() @variable(model, y, Logical) @variable(model, z, Logical) @variable(model, x) - @constraint(model, con, x <= 10, DisjunctConstraint(y)) - @constraint(model, con2, x >= 50, DisjunctConstraint(z)) + @constraint(model, con, x <= 10, Disjunct(y)) + @constraint(model, con2, x >= 50, Disjunct(z)) @disjunction(model, disj, [y, z]) @constraint(model, lcon, y ∨ z in IsTrue()) DP._reformulate_logical_variables(model) diff --git a/test/variables/query.jl b/test/variables/query.jl index d308a53..294ff74 100644 --- a/test/variables/query.jl +++ b/test/variables/query.jl @@ -122,8 +122,8 @@ function test_interrogate_disjunction() m = GDPModel() @variable(m, -5 ≤ x[1:2] ≤ 10) @variable(m, Y[1:2], Logical) - @constraint(m, [i = 1:2], 0 ≤ x[i] ≤ [3,4][i], DisjunctConstraint(Y[1])) - @constraint(m, [i = 1:2], [5,4][i] ≤ x[i] ≤ [9,6][i], DisjunctConstraint(Y[2])) + @constraint(m, [i = 1:2], 0 ≤ x[i] ≤ [3,4][i], Disjunct(Y[1])) + @constraint(m, [i = 1:2], [5,4][i] ≤ x[i] ≤ [9,6][i], Disjunct(Y[2])) @disjunction(m, Y) disj = DP._disjunctions(m)[DisjunctionIndex(1)].constraint vars = DP._get_disjunction_variables(m, disj) @@ -135,19 +135,19 @@ function test_interrogate_nested_disjunction() @variable(m, -5 <= x[1:3] <= 5) @variable(m, y[1:2], Logical) - @constraint(m, x[1] <= -2, DisjunctConstraint(y[1])) - @constraint(m, x[1] >= 2, DisjunctConstraint(y[2])) + @constraint(m, x[1] <= -2, Disjunct(y[1])) + @constraint(m, x[1] >= 2, Disjunct(y[2])) @disjunction(m, y) @variable(m, w[1:2], Logical) - @constraint(m, x[2] <= -3, DisjunctConstraint(w[1])) - @constraint(m, x[2] >= 3, DisjunctConstraint(w[2])) - @disjunction(m, w, DisjunctConstraint(y[1])) + @constraint(m, x[2] <= -3, Disjunct(w[1])) + @constraint(m, x[2] >= 3, Disjunct(w[2])) + @disjunction(m, w, Disjunct(y[1])) @variable(m, z[1:2], Logical) - @constraint(m, x[3] <= -4, DisjunctConstraint(z[1])) - @constraint(m, x[3] >= 4, DisjunctConstraint(z[2])) - @disjunction(m, z, DisjunctConstraint(w[1])) + @constraint(m, x[3] <= -4, Disjunct(z[1])) + @constraint(m, x[3] >= 4, Disjunct(z[2])) + @disjunction(m, z, Disjunct(w[1])) disj = DP._disjunctions(m)[DisjunctionIndex(1)].constraint vars = DP._get_disjunction_variables(m, disj)