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

connect NLP and revive HS tests #1223

Merged
merged 1 commit into from
Apr 8, 2018
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
21 changes: 15 additions & 6 deletions src/nlp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ mutable struct NLPData
evaluator
end

function create_nlp_block_data(m::Model)
@assert m.nlpdata !== nothing
bounds = MOI.NLPBoundsPair[]
for constr in m.nlpdata.nlconstr
push!(bounds, MOI.NLPBoundsPair(constr.lb, constr.ub))
end
return MOI.NLPBlockData(bounds, NLPEvaluator(m), isa(m.nlpdata.nlobj, NonlinearExprData))
end

function NonlinearExpression(m::Model,ex::NonlinearExprData)
initNLP(m)
nldata::NLPData = m.nlpdata
Expand Down Expand Up @@ -555,11 +564,11 @@ end

function MOI.eval_hessian_lagrangian_product(
d::NLPEvaluator,
h::Vector{Float64}, # output vector
h::AbstractVector{Float64}, # output vector
x::Vector{Float64}, # current solution
v::Vector{Float64}, # rhs vector
σ::Float64, # multiplier for objective
μ::Vector{Float64}) # multipliers for each constraint
μ::AbstractVector{Float64}) # multipliers for each constraint

nldata = d.m.nlpdata::NLPData

Expand Down Expand Up @@ -624,10 +633,10 @@ end

function MOI.eval_hessian_lagrangian(
d::NLPEvaluator,
H::Vector{Float64}, # Sparse hessian entry vector
x::Vector{Float64}, # Current solution
obj_factor::Float64, # Lagrangian multiplier for objective
lambda::Vector{Float64}) # Multipliers for each constraint
H::AbstractVector{Float64}, # Sparse hessian entry vector
x::Vector{Float64}, # Current solution
obj_factor::Float64, # Lagrangian multiplier for objective
lambda::AbstractVector{Float64}) # Multipliers for each constraint

nldata = d.m.nlpdata::NLPData

Expand Down
6 changes: 6 additions & 0 deletions src/optimizerinterface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ end

function optimize(m::Model;
ignore_optimize_hook=(m.optimizehook===nothing))
# The NLPData is not kept in sync, so re-set it here.
# TODO: Consider how to handle incremental solves.
if m.nlpdata !== nothing
MOI.set!(m, MOI.NLPBlock(), create_nlp_block_data(m))
end

# If the user or an extension has provided an optimize hook, call
# that instead of solving the model ourselves
if !ignore_optimize_hook
Expand Down
67 changes: 0 additions & 67 deletions test/hockschittkowski/hs109.jl

This file was deleted.

36 changes: 0 additions & 36 deletions test/hockschittkowski/hs110.jl

This file was deleted.

40 changes: 0 additions & 40 deletions test/hockschittkowski/hs111.jl

This file was deleted.

39 changes: 0 additions & 39 deletions test/hockschittkowski/hs112.jl

This file was deleted.

53 changes: 0 additions & 53 deletions test/hockschittkowski/hs114.jl

This file was deleted.

62 changes: 0 additions & 62 deletions test/hockschittkowski/hs116.jl

This file was deleted.

Loading