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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/algorithms/Chalmet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ function _solve_constrained_model(
sets = MOI.LessThan.(rhs .- 1)
c = MOI.Utilities.normalize_and_add_constraint.(model.inner, f, sets)
MOI.optimize!(model.inner)
MOI.delete.(model, c)
status = MOI.get(model.inner, MOI.TerminationStatus())
if !_is_scalar_status_optimal(status)
MOI.delete.(model, c)
return status, nothing
end
variables = MOI.get(model.inner, MOI.ListOfVariableIndices())
X, Y = _compute_point(model, variables, model.f)
MOI.delete.(model, c)
return status, SolutionPoint(X, Y)
end

Expand Down
6 changes: 4 additions & 2 deletions src/algorithms/KirlikSayin.jl
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@
MOI.EqualTo(zₖ),
)
MOI.optimize!(model.inner)
MOI.delete.(model, ε_constraints)
MOI.delete(model, zₖ_constraint)
if !_is_scalar_status_optimal(model)
MOI.delete.(model, ε_constraints)
MOI.delete(model, zₖ_constraint)

Check warning on line 166 in src/algorithms/KirlikSayin.jl

View check run for this annotation

Codecov / codecov/patch

src/algorithms/KirlikSayin.jl#L165-L166

Added lines #L165 - L166 were not covered by tests
_remove_rectangle(L, _Rectangle(_project(yI, k), uᵢ))
continue
end
Expand All @@ -175,6 +175,8 @@
L = _update_list(L, Y_proj)
end
_remove_rectangle(L, _Rectangle(Y_proj, uᵢ))
MOI.delete.(model, ε_constraints)
MOI.delete(model, zₖ_constraint)
end
return status, solutions
end
3 changes: 3 additions & 0 deletions src/algorithms/TambyVanderpooten.jl
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@
end
MOI.optimize!(model.inner)
if !_is_scalar_status_optimal(model)
MOI.delete.(model, ε_constraints)

Check warning on line 162 in src/algorithms/TambyVanderpooten.jl

View check run for this annotation

Codecov / codecov/patch

src/algorithms/TambyVanderpooten.jl#L162

Added line #L162 was not covered by tests
return status, nothing
end
y_k = MOI.get(model.inner, MOI.ObjectiveValue())
Expand All @@ -171,6 +172,8 @@
)
MOI.optimize!(model.inner)
if !_is_scalar_status_optimal(model)
MOI.delete.(model, ε_constraints)
MOI.delete(model, y_k_constraint)

Check warning on line 176 in src/algorithms/TambyVanderpooten.jl

View check run for this annotation

Codecov / codecov/patch

src/algorithms/TambyVanderpooten.jl#L175-L176

Added lines #L175 - L176 were not covered by tests
return status, nothing
end
X, Y = _compute_point(model, variables, model.f)
Expand Down
31 changes: 31 additions & 0 deletions test/problems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -441,4 +441,35 @@ function test_problem_issue_105(model)
return
end

function test_issue_122(model)
m, n = 3, 10
p1 = [5.0 1 10 8 3 5 3 3 7 2; 10 6 1 6 8 3 2 10 6 1; 2 3 1 6 9 7 1 5 4 8]
p2 = [4.0 6 4 3 1 6 8 2 9 7; 8 8 8 2 4 8 8 1 10 1; 8 7 8 5 9 2 2 7 10 10]
p3 = [4.0 3 6 4 7 5 9 5 8 4; 8 6 2 2 6 8 5 2 2 3; 2 8 10 3 5 7 5 9 5 5]
w = [5.0 9 3 5 10 5 7 10 7 8; 4 8 8 6 10 8 10 7 5 1; 10 7 5 8 8 2 8 1 10 3]
b = [34.0, 33.0, 31.0]
x_ = MOI.add_variables(model, m * n)
x = reshape(x_, m, n)
MOI.add_constraint.(model, x, MOI.ZeroOne())
f = MOI.Utilities.operate(
vcat,
Float64,
sum(p1 .* x),
sum(p2 .* x),
sum(p3 .* x),
)
MOI.set(model, MOI.ObjectiveSense(), MOI.MAX_SENSE)
MOI.set(model, MOI.ObjectiveFunction{typeof(f)}(), f)
for i in 1:m
f_i = sum(w[i, j] * x[i, j] for j in 1:n)
MOI.add_constraint(model, f_i, MOI.LessThan(b[i]))
end
for j in 1:n
MOI.add_constraint(model, sum(1.0 .* x[:, j]), MOI.EqualTo(1.0))
end
MOI.optimize!(model)
@test MOI.get(model, MOI.ResultCount()) == 42
return
end

end # module Problems
Loading