Skip to content

Commit

Permalink
Uncomment some code
Browse files Browse the repository at this point in the history
  • Loading branch information
amontoison committed Dec 20, 2024
1 parent 001fa0c commit 235bfe6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[deps]
ADNLPModels = "54578032-b7ea-4c30-94aa-7cbd1cce6c9a"
Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
ManualNLPModels = "30dfa513-9b2f-4fb3-9796-781eabac1617"
Expand Down
14 changes: 7 additions & 7 deletions test/nlp/basic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ function test_autodiff_model(name; kwargs...)
nlp = ADNLPModel(f, x0, c, [0.0], [0.0]; kwargs...)
@test obj(nlp, x0) == f(x0)

# x = range(-1, stop = 1, length = 100)
# y = 2x .+ 3 + randn(100) * 0.1
# regr = LinearRegression(x, y)
# nlp = ADNLPModel(regr, ones(2); kwargs...)
# β = [ones(100) x] \ y
# @test abs(obj(nlp, β) - norm(y .- β[1] - β[2] * x)^2 / 2) < 1e-12
# @test norm(grad(nlp, β)) < 1e-12
x = range(-1, stop = 1, length = 100)
y = 2x .+ 3 + randn(100) * 0.1
regr = LinearRegression(x, y)
nlp = ADNLPModel(regr, ones(2); kwargs...)
β = [ones(100) x] \ y
@test abs(obj(nlp, β) - norm(y .- β[1] - β[2] * x)^2 / 2) < 1e-12
@test norm(grad(nlp, β)) < 1e-12

test_getter_setter(nlp)

Expand Down

0 comments on commit 235bfe6

Please sign in to comment.