Skip to content

Commit 9b35dcf

Browse files
committed
add constraint API for projector
1 parent 0b5e45f commit 9b35dcf

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ version = "0.1.0"
77
CaNNOLeS = "5a1c9e79-9c58-5ec0-afc4-3298fdea2875"
88
FastClosures = "9aa1b823-49e4-5ca5-8b0f-3971ec8bab6a"
99
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
10+
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
1011
NLPModels = "a4795742-8479-5a88-8948-cc11e1c8c1a6"
1112

1213
[compat]

src/VariationalInequalitySolver.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module VariationalInequalitySolver
22

3-
using FastClosures, LinearAlgebra, NLPModels
3+
using FastClosures, LinearAlgebra, Logging, NLPModels
44

55
abstract type AbstractVIModel{T, S} end
66

@@ -42,7 +42,9 @@ using CaNNOLeS
4242
function project!(model::NLSVIModel, d::AbstractVector{T}, Px::AbstractVector{T}) where {T, S}
4343
# Here we need to solve the optimization problem
4444
proj = NLSProjector(model.nls, d)
45-
stats = cannoles(proj)
45+
stats = with_logger(NullLogger()) do
46+
cannoles(proj)
47+
end
4648
if stats.status != :first_order
4749
@warn "There was an error in the projection computation"
4850
end

src/projector/proj_nls.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,10 @@ end
8888
function NLPModels.hprod_residual!(::NLSProjector, x, i, v, Hiv)
8989
return Hiv
9090
end
91+
92+
for meth in [:cons!, :jth_congrad!, :jth_sparse_congrad, :jac_structure!, :jac_coord!, :jprod!, :jtprod!, :jth_hess_coord!, :jth_hprod!, :ghjvprod!, :hess_structure!, :hess_coord!, :hprod!]
93+
premeth = Symbol("NLPModels.", meth)
94+
@eval begin
95+
$meth(model::NLSProjector, args...; kwargs...) = $meth(model.model, args...; kwargs...)
96+
end
97+
end

test/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ CaNNOLeS = "5a1c9e79-9c58-5ec0-afc4-3298fdea2875"
44
FastClosures = "9aa1b823-49e4-5ca5-8b0f-3971ec8bab6a"
55
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
66
NLPModels = "a4795742-8479-5a88-8948-cc11e1c8c1a6"
7+
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
78
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
89
VariationalInequalitySolver = "ed570689-83cb-4447-bc21-43803b1f175a"

0 commit comments

Comments
 (0)