Skip to content

Commit dcccea0

Browse files
authored
update solution statuses thanks to odow (#8)
* update solution statuses thanks to odow * removes unusued solver information --------- Co-authored-by: William Zijie Zhang <william@gridmatic.com>
1 parent 35ea33e commit dcccea0

1 file changed

Lines changed: 31 additions & 17 deletions

File tree

cvxpy/reductions/solvers/nlp_solvers/ipopt_nlpif.py

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,39 @@ class IPOPT(NLPsolver):
3838
"""
3939
NLP interface for the IPOPT solver
4040
"""
41-
# Solve capabilities
42-
MIP_CAPABLE = True
43-
44-
# Keyword arguments for the CVXPY interface.
45-
INTERFACE_ARGS = ["save_file", "reoptimize"]
46-
4741
# Map between IPOPT status and CVXPY status
42+
# taken from https://github.com/jump-dev/Ipopt.jl/blob/master/src/C_wrapper.jl#L485-L511
4843
STATUS_MAP = {
49-
0: s.OPTIMAL, # optimal
50-
2: s.INFEASIBLE, # infeasible
51-
3: s.UNBOUNDED, # unbounded
52-
4: s.INF_OR_UNB, # infeasible or unbounded
53-
5: s.SOLVER_ERROR, # numerical
54-
6: s.USER_LIMIT, # node limit
55-
7: s.OPTIMAL_INACCURATE, # imprecise
56-
8: s.USER_LIMIT, # time out
57-
9: s.SOLVER_ERROR, # unfinished
58-
10: s.USER_LIMIT # interrupted
59-
}
44+
# Success cases
45+
0: s.OPTIMAL, # Solve_Succeeded
46+
1: s.OPTIMAL_INACCURATE, # Solved_To_Acceptable_Level
47+
6: s.OPTIMAL, # Feasible_Point_Found
48+
49+
# Infeasibility/Unboundedness
50+
2: s.INFEASIBLE, # Infeasible_Problem_Detected
51+
4: s.UNBOUNDED, # Diverging_Iterates
52+
53+
# Numerical/Algorithm issues
54+
3: s.SOLVER_ERROR, # Search_Direction_Becomes_Too_Small
55+
-2: s.SOLVER_ERROR, # Restoration_Failed
56+
-3: s.SOLVER_ERROR, # Error_In_Step_Computation
57+
-13: s.SOLVER_ERROR, # Invalid_Number_Detected
58+
-100: s.SOLVER_ERROR, # Unrecoverable_Exception
59+
-101: s.SOLVER_ERROR, # NonIpopt_Exception_Thrown
60+
-199: s.SOLVER_ERROR, # Internal_Error
61+
62+
# User/Resource limits
63+
5: s.USER_LIMIT, # User_Requested_Stop
64+
-1: s.USER_LIMIT, # Maximum_Iterations_Exceeded
65+
-4: s.USER_LIMIT, # Maximum_CpuTime_Exceeded
66+
-5: s.USER_LIMIT, # Maximum_WallTime_Exceeded
67+
-102: s.USER_LIMIT, # Insufficient_Memory
68+
69+
# Problem definition issues
70+
-10: s.SOLVER_ERROR, # Not_Enough_Degrees_Of_Freedom
71+
-11: s.SOLVER_ERROR, # Invalid_Problem_Definition
72+
-12: s.SOLVER_ERROR, # Invalid_Option
73+
}
6074

6175
def name(self):
6276
"""

0 commit comments

Comments
 (0)