Get maximum target value found and corresponding parameters. If there is a constraint present, the maximum value that fulfills the constraint within the parameter bounds is returned. Returns ------- res: dict A dictionary with the keys 'target' a
(self)
| 622 | return self.target[self.mask].max() |
| 623 | |
| 624 | def max(self) -> dict[str, Any] | None: |
| 625 | """Get maximum target value found and corresponding parameters. |
| 626 | |
| 627 | If there is a constraint present, the maximum value that fulfills the |
| 628 | constraint within the parameter bounds is returned. |
| 629 | |
| 630 | Returns |
| 631 | ------- |
| 632 | res: dict |
| 633 | A dictionary with the keys 'target' and 'params'. The value of |
| 634 | 'target' is the maximum target value, and the value of 'params' is |
| 635 | a dictionary with the parameter names as keys and the parameter |
| 636 | values as values. |
| 637 | """ |
| 638 | target_max = self._target_max() |
| 639 | if target_max is None: |
| 640 | return None |
| 641 | |
| 642 | target = self.target[self.mask] |
| 643 | params = self.params[self.mask] |
| 644 | target_max_idx = np.argmax(target) |
| 645 | |
| 646 | res = {"target": target_max, "params": self.array_to_params(params[target_max_idx])} |
| 647 | |
| 648 | if self._constraint is not None: |
| 649 | constraint_values = self.constraint_values[self.mask] |
| 650 | res["constraint"] = constraint_values[target_max_idx] |
| 651 | |
| 652 | return res |
| 653 | |
| 654 | def res(self) -> list[dict[str, Any]]: |
| 655 | """Get all target values and constraint fulfillment for all parameters. |