|
63 | 63 | # Acceptable chars for the end of the alpha_pr column |
64 | 64 | # in ipopt's output, per https://coin-or.github.io/Ipopt/OUTPUT.html |
65 | 65 | _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 | | -) |
103 | 66 |
|
104 | 67 |
|
105 | 68 | class IpoptConfig(SolverConfig): |
@@ -505,7 +468,6 @@ def solve(self, model, **kwds) -> Results: |
505 | 468 | # This is the data we need to parse to get the iterations |
506 | 469 | # and time |
507 | 470 | parsed_output_data = self._parse_ipopt_output(ostreams[0]) |
508 | | - parsed_output_message = f"Parsed solver data: {parsed_output_data}" |
509 | 471 |
|
510 | 472 | if proven_infeasible: |
511 | 473 | results = Results() |
@@ -554,7 +516,7 @@ def solve(self, model, **kwds) -> Results: |
554 | 516 | logging.WARNING, |
555 | 517 | "The solver output data is empty or incomplete.\n" |
556 | 518 | f"Full error message: {e}\n" |
557 | | - f"{parsed_output_message}\n", |
| 519 | + f"Parsed solver data: {parsed_output_data}\n", |
558 | 520 | ) |
559 | 521 | if ( |
560 | 522 | config.raise_exception_on_nonoptimal_result |
@@ -648,8 +610,6 @@ def _parse_ipopt_output(self, output: Union[str, io.StringIO]) -> Dict[str, Any] |
648 | 610 | "alpha_pr", |
649 | 611 | "ls", |
650 | 612 | ] |
651 | | - numerical_columns = set(columns) |
652 | | - numerical_columns.remove('iter') |
653 | 613 | iterations = [] |
654 | 614 | n_expected_columns = len(columns) |
655 | 615 |
|
@@ -694,17 +654,11 @@ def _parse_ipopt_output(self, output: Union[str, io.StringIO]) -> Dict[str, Any] |
694 | 654 |
|
695 | 655 | # Capture optional IPOPT diagnostic tags if present |
696 | 656 | 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) |
703 | 658 |
|
704 | 659 | # 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] |
708 | 662 | if val == '-': |
709 | 663 | iter_data[key] = None |
710 | 664 | else: |
|
0 commit comments