Skip to content

Commit d9b15db

Browse files
committed
Address jsiirola comments
1 parent 56e8df6 commit d9b15db

File tree

1 file changed

+4
-50
lines changed

1 file changed

+4
-50
lines changed

pyomo/contrib/solver/solvers/ipopt.py

Lines changed: 4 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -63,43 +63,6 @@
6363
# Acceptable chars for the end of the alpha_pr column
6464
# in ipopt's output, per https://coin-or.github.io/Ipopt/OUTPUT.html
6565
_ALPHA_PR_CHARS = set("fFhHkKnNRwSstTr")
66-
_DIAGNOSTIC_TAGS = set(
67-
{
68-
"!",
69-
"A",
70-
"a",
71-
"C",
72-
"Dh",
73-
"Dhj",
74-
"Dj",
75-
"dx",
76-
"e",
77-
"F-",
78-
"F+",
79-
"L",
80-
"l",
81-
"M",
82-
"Nh",
83-
"Nhj",
84-
"Nj",
85-
"NW",
86-
"q",
87-
"R",
88-
"S",
89-
"s",
90-
"Tmax",
91-
"W",
92-
"w",
93-
"Wb",
94-
"We",
95-
"Wp",
96-
"Wr",
97-
"Ws",
98-
"WS",
99-
"y",
100-
"z",
101-
}
102-
)
10366

10467

10568
class IpoptConfig(SolverConfig):
@@ -505,7 +468,6 @@ def solve(self, model, **kwds) -> Results:
505468
# This is the data we need to parse to get the iterations
506469
# and time
507470
parsed_output_data = self._parse_ipopt_output(ostreams[0])
508-
parsed_output_message = f"Parsed solver data: {parsed_output_data}"
509471

510472
if proven_infeasible:
511473
results = Results()
@@ -554,7 +516,7 @@ def solve(self, model, **kwds) -> Results:
554516
logging.WARNING,
555517
"The solver output data is empty or incomplete.\n"
556518
f"Full error message: {e}\n"
557-
f"{parsed_output_message}\n",
519+
f"Parsed solver data: {parsed_output_data}\n",
558520
)
559521
if (
560522
config.raise_exception_on_nonoptimal_result
@@ -648,8 +610,6 @@ def _parse_ipopt_output(self, output: Union[str, io.StringIO]) -> Dict[str, Any]
648610
"alpha_pr",
649611
"ls",
650612
]
651-
numerical_columns = set(columns)
652-
numerical_columns.remove('iter')
653613
iterations = []
654614
n_expected_columns = len(columns)
655615

@@ -694,17 +654,11 @@ def _parse_ipopt_output(self, output: Union[str, io.StringIO]) -> Dict[str, Any]
694654

695655
# Capture optional IPOPT diagnostic tags if present
696656
if extra_tokens:
697-
if all(tok in _DIAGNOSTIC_TAGS for tok in extra_tokens):
698-
iter_data['diagnostic_tags'] = "".join(extra_tokens)
699-
else:
700-
logger.warning(
701-
f"Unrecognized Ipopt diagnostic tags {extra_tokens} on line: {line}"
702-
)
657+
iter_data['diagnostic_tags'] = " ".join(extra_tokens)
703658

704659
# Attempt to cast all values to float where possible
705-
for key, val in iter_data.items():
706-
if key not in numerical_columns:
707-
continue
660+
for key in columns[1:]:
661+
val = iter_data[key]
708662
if val == '-':
709663
iter_data[key] = None
710664
else:

0 commit comments

Comments
 (0)