|
1 | 1 | from iOpt.method.listener import Listener
|
2 | 2 | from iOpt.method.method import Method
|
3 | 3 | from iOpt.method.search_data import SearchData
|
4 |
| -from iOpt.output_system.painters.static_painters import StaticPainter, StaticPainterND, DiscretePainter |
| 4 | +from iOpt.output_system.painters.static_painters import StaticPainter, StaticPainterND, DiscretePainter, StaticPainterPareto |
5 | 5 | from iOpt.solution import Solution
|
6 | 6 |
|
7 | 7 |
|
@@ -89,7 +89,7 @@ def __init__(self, file_name: str, path_for_saves="", indx=0, is_points_at_botto
|
89 | 89 | """
|
90 | 90 | Constructor of the StaticPainterListener class
|
91 | 91 |
|
92 |
| - :param file_name: File name specifying the format for saving the image. |
| 92 | + :param file_name: File name specifying the format for saving the image. |
93 | 93 | :param path_for_saves: The directory to save the image. If this parameter is not specified, the image is saved in the current working directory.
|
94 | 94 | is saved in the current working directory.
|
95 | 95 | :param indx: Index of the variable of the optimization problem. It is used in multivariate optimization.
|
@@ -133,9 +133,9 @@ class StaticPainterNDListener(Listener):
|
133 | 133 | def __init__(self, file_name: str, path_for_saves="", vars_indxs=[0, 1], mode='lines layers',
|
134 | 134 | calc='objective function'):
|
135 | 135 | """
|
136 |
| - Конструктор класса StaticPainterNDListener |
| 136 | + Constructor of the StaticPainterNDListener class |
137 | 137 |
|
138 |
| - :param file_name: File name specifying the format for saving the image. |
| 138 | + :param file_name: File name specifying the format for saving the image. |
139 | 139 | :param path_for_saves: The directory to save the image. If this parameter is not specified, the image is saved in the current working directory.
|
140 | 140 | is saved in the current working directory.
|
141 | 141 | :param vars_indxs: A pair of indices of the variables of the optimization problem for which the figure will be plotted.
|
@@ -167,3 +167,30 @@ def on_method_stop(self, search_data: SearchData,
|
167 | 167 | painter.paint_points()
|
168 | 168 | painter.paint_optimum()
|
169 | 169 | painter.save_image()
|
| 170 | + |
| 171 | + |
| 172 | +class StaticPainterParetoListener(Listener): |
| 173 | + """ |
| 174 | + The StaticPainterParetoListener class is an event listener. It contains a method handler that produces an image as a |
| 175 | + image as a reaction to the method completion. |
| 176 | + It is used for multicriteria optimization |
| 177 | + """ |
| 178 | + |
| 179 | + def __init__(self, file_name: str, path_for_saves="", criteria_indxs=[0, 1]): |
| 180 | + """ |
| 181 | + Constructor of the StaticPainterParetoListener class |
| 182 | +
|
| 183 | + :param file_name: File name specifying the format for saving the image. |
| 184 | + :param path_for_saves: The directory to save the image. If this parameter is not specified, the image is saved in the current working directory. |
| 185 | + is saved in the current working directory. |
| 186 | + :param criteria_indxs: A pair of indices of the criteria of the optimization problem for which the figure will be plotted. |
| 187 | + """ |
| 188 | + self.file_name = file_name |
| 189 | + self.path_for_saves = path_for_saves |
| 190 | + self.criteria_indxs = criteria_indxs |
| 191 | + |
| 192 | + def on_method_stop(self, search_data: SearchData, |
| 193 | + solution: Solution, status: bool, ): |
| 194 | + painter = StaticPainterPareto(solution, self.criteria_indxs, self.path_for_saves, self.file_name) |
| 195 | + painter.paint_pareto() |
| 196 | + painter.save_image() |
0 commit comments