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
4 changes: 0 additions & 4 deletions src/problem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,6 @@ function _get_fides_results(obj::Float64, g::AbstractVector, py::Bool)
return py ? (obj, np_py.array(g)) : (obj, g)
end

function _get_xinput!(xinput::InputVector, x::PythonCall.Py)::Nothing
xinput .= PythonCall.pyconvert(Vector{Float64}, x)
return nothing
end
function _get_xinput!(xinput::InputVector, x)::Nothing
xinput .= x
return nothing
Expand Down
14 changes: 13 additions & 1 deletion test/problem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ function fides_obj2(x)
end

x0, lb, ub, = [2.0, 2.0], [-10.0, -10.0], [10.0, 10.0]

@testset "FidesProblem" begin
prob1 = FidesProblem(rosenbrock, rosenbrock_grad!, x0; lb = lb, ub = ub)
sol1 = solve(prob1, Fides.BFGS())
Expand All @@ -34,4 +33,17 @@ x0, lb, ub, = [2.0, 2.0], [-10.0, -10.0], [10.0, 10.0]
prob4 = FidesProblem(fides_obj2, x0, true; lb = lb, ub = ub)
sol4 = solve(prob4)
@test all(.≈(sol4.xmin, [1.0, 1.0]; atol = 1e-6))

# No bounds
prob5 = FidesProblem(fides_obj2, x0, true)
sol5 = solve(prob5)
@test all(.≈(sol5.xmin, [1.0, 1.0]; atol = 1e-6))

# Check correct Hessian input handling
@test_throws ArgumentError begin
solve(prob3)
end
@test_throws ArgumentError begin
solve(prob4, Fides.BFGS())
end
end