Skip to content

Commit

Permalink
[Test] make first variable ZeroOne in test_basic_VectorAffineFunction…
Browse files Browse the repository at this point in the history
…_Indicator (#2600)
  • Loading branch information
odow authored Jan 3, 2025
1 parent 5feb1c0 commit 461006f
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/Test/test_basic_constraint.jl
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,12 @@ function _basic_constraint_test_helper(
config::Config{T},
::Type{UntypedF},
::Type{UntypedS},
add_variables_fn::Function = MOI.add_variables,
) where {T,UntypedF,UntypedS}
set = _set(T, UntypedS)
N = MOI.dimension(set)
x = MOI.add_variables(model, N)
x = add_variables_fn(model, N)

constraint_function = _function(T, UntypedF, x)
@assert MOI.output_dimension(constraint_function) == N
F, S = typeof(constraint_function), typeof(set)
Expand Down Expand Up @@ -404,11 +406,17 @@ function test_basic_VectorAffineFunction_Indicator_LessThan(
model::MOI.ModelLike,
config::Config{T},
) where {T}
function add_variables_fn(model, N)
x = MOI.add_variables(model, N)
MOI.add_constraint(model, x[1], MOI.ZeroOne())
return x
end
_basic_constraint_test_helper(
model,
config,
MOI.VectorAffineFunction,
MOI.Indicator{MOI.ACTIVATE_ON_ONE,MOI.LessThan{T}},
add_variables_fn,
)
return
end
Expand All @@ -417,11 +425,17 @@ function test_basic_VectorAffineFunction_Indicator_GreaterThan(
model::MOI.ModelLike,
config::Config{T},
) where {T}
function add_variables_fn(model, N)
x = MOI.add_variables(model, N)
MOI.add_constraint(model, x[1], MOI.ZeroOne())
return x
end
_basic_constraint_test_helper(
model,
config,
MOI.VectorAffineFunction,
MOI.Indicator{MOI.ACTIVATE_ON_ONE,MOI.GreaterThan{T}},
add_variables_fn,
)
return
end

0 comments on commit 461006f

Please sign in to comment.