Skip to content

Commit 68e9efc

Browse files
authored
solve! returns the problem (#658)
1 parent f8a56c4 commit 68e9efc

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/solution.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ end
6565
6666
Solves the problem, populating `problem.optval` with the optimal value, as well
6767
as the values of the variables (accessed by [`evaluate`](@ref)) and constraint
68-
duals (accessed by `cons.dual`), where applicable.
68+
duals (accessed by `cons.dual`), where applicable. Returns the input `problem`.
6969
7070
Optional keyword arguments:
7171
@@ -134,7 +134,7 @@ function solve!(
134134
populate_dual!(context.model, c, indices)
135135
end
136136
end
137-
return
137+
return p
138138
end
139139

140140
function populate_dual!(::MOI.ModelLike, c::Constraint, ::Nothing)

test/test_utilities.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function solve_and_return_output(problem, solver; kwargs...)
4242
return fetch(out_task)
4343
end
4444

45-
function test_solve!_does_not_return_anything()
45+
function test_solve!_returns_the_problem()
4646
x = Variable()
4747
p = satisfy(x >= 0)
4848
output = solve!(
@@ -53,7 +53,7 @@ function test_solve!_does_not_return_anything()
5353
"eps_abs" => 1e-6,
5454
),
5555
)
56-
@test output === nothing
56+
@test output === p
5757
return
5858
end
5959

@@ -85,7 +85,7 @@ function test_solve!_can_take_an_optimizer_directly()
8585
"eps_abs" => 1e-6,
8686
),
8787
)
88-
@test output === nothing
88+
@test output === p
8989
return
9090
end
9191

0 commit comments

Comments
 (0)