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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ NLPModels = "a4795742-8479-5a88-8948-cc11e1c8c1a6"
SolverCore = "ff4d7338-4cf1-434d-91df-b86cb86fb843"

[compat]
Ipopt = "0.9, 1"
Ipopt = "1"
NLPModels = "0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.20, 0.21"
SolverCore = "0.3"
julia = "^1.6"
Expand Down
27 changes: 25 additions & 2 deletions src/NLPModelsIpopt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,29 @@ const ipopt_statuses = Dict(
-199 => :exception, # Internal error
)

const ipopt_internal_statuses = Dict(
0 => :Solve_Succeeded,
1 => :Solved_To_Acceptable_Level,
2 => :Infeasible_Problem_Detected,
3 => :Search_Direction_Becomes_Too_Small,
4 => :Diverging_Iterates,
5 => :User_Requested_Stop,
6 => :Feasible_Point_Found,
-1 => :Maximum_Iterations_Exceeded,
-2 => :Restoration_Failed,
-3 => :Error_In_Step_Computation,
-4 => :Maximum_CpuTime_Exceeded,
-5 => :Maximum_WallTime_Exceeded,
-10 => :Not_Enough_Degrees_Of_Freedom,
-11 => :Invalid_Problem_Definition,
-12 => :Invalid_Option,
-13 => :Invalid_Number_Detected,
-100 => :Unrecoverable_Exception,
-101 => :NonIpopt_Exception_Thrown,
-102 => :Insufficient_Memory,
-199 => :Internal_Error,
)

"""
IpoptSolver(nlp; kwargs...,)

Expand Down Expand Up @@ -132,7 +155,7 @@ For advanced usage, first define a `IpoptSolver` to preallocate the memory used
* `zL`: a vector of size `nlp.meta.nvar` to specify initial multipliers for the lower bound constraints
* `zU`: a vector of size `nlp.meta.nvar` to specify initial multipliers for the upper bound constraints

All other keyword arguments will be passed to IpOpt as an option.
All other keyword arguments will be passed to Ipopt as an option.
See [https://coin-or.github.io/Ipopt/OPTIONS.html](https://coin-or.github.io/Ipopt/OPTIONS.html) for the list of options accepted.

# Output
Expand Down Expand Up @@ -247,7 +270,7 @@ function SolverCore.solve!(
if has_bounds(nlp)
set_bounds_multipliers!(stats, problem.mult_x_L, problem.mult_x_U)
end
set_solver_specific!(stats, :internal_msg, Ipopt._STATUS_CODES[status])
set_solver_specific!(stats, :internal_msg, ipopt_internal_statuses[status])
set_solver_specific!(stats, :real_time, real_time)

try
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ end
nlp = ADNLPModel(x -> (x[1] - 1)^2 + 100 * (x[2] - x[1]^2)^2, [-1.2; 1.0])
stats = ipopt(nlp, tol = 1e-12, callback = callback, print_level = 0)
@test stats.status == :user
@test first(stats.solver_specific[:internal_msg]) == :User_Requested_Stop
@test stats.solver_specific[:internal_msg] == :User_Requested_Stop
@test stats.iter == 1
@test stats.elapsed_time > 0
@test stats.primal_feas ≈ 0.0
Expand Down
Loading