Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solve! returns the problem #658

Merged
merged 1 commit into from
May 14, 2024
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
4 changes: 2 additions & 2 deletions src/solution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ end

Solves the problem, populating `problem.optval` with the optimal value, as well
as the values of the variables (accessed by [`evaluate`](@ref)) and constraint
duals (accessed by `cons.dual`), where applicable.
duals (accessed by `cons.dual`), where applicable. Returns the input `problem`.

Optional keyword arguments:

Expand Down Expand Up @@ -134,7 +134,7 @@ function solve!(
populate_dual!(context.model, c, indices)
end
end
return
return p
end

function populate_dual!(::MOI.ModelLike, c::Constraint, ::Nothing)
Expand Down
6 changes: 3 additions & 3 deletions test/test_utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function solve_and_return_output(problem, solver; kwargs...)
return fetch(out_task)
end

function test_solve!_does_not_return_anything()
function test_solve!_returns_the_problem()
x = Variable()
p = satisfy(x >= 0)
output = solve!(
Expand All @@ -53,7 +53,7 @@ function test_solve!_does_not_return_anything()
"eps_abs" => 1e-6,
),
)
@test output === nothing
@test output === p
return
end

Expand Down Expand Up @@ -85,7 +85,7 @@ function test_solve!_can_take_an_optimizer_directly()
"eps_abs" => 1e-6,
),
)
@test output === nothing
@test output === p
return
end

Expand Down
Loading