simopt.plots.utils ================== .. py:module:: simopt.plots.utils .. autoapi-nested-parse:: Plotting utilities. Module Contents --------------- .. py:function:: setup_plot(plot_type: simopt.plot_type.PlotType, solver_name: str = 'SOLVER SET', problem_name: str = 'PROBLEM SET', normalize: bool = True, budget: int | None = None, beta: float | None = None, feasibility_score_method: Literal['inf_norm', 'norm'] = 'inf_norm', feasibility_norm_degree: int = 1, solve_tol: float | None = None, plot_title: str | None = None) -> None Create a new figure, add labels to the plot, and reformat axes. :param plot_type: Type of plot to produce. Valid options include: - ALL: All estimated progress curves. - MEAN: Estimated mean progress curve. - QUANTILE: Estimated beta quantile progress curve. - SOLVE_TIME_CDF: CDF of solve time. - CDF_SOLVABILITY: CDF solvability profile. - QUANTILE_SOLVABILITY: Quantile solvability profile. - DIFFERENCE_OF_CDF_SOLVABILITY: Difference of CDF solvability profiles. - DIFFERENCE_OF_QUANTILE_SOLVABILITY: Difference of quantile solvability profiles. - AREA: Area scatterplot. - BOX: Box plot of terminal progress. - VIOLIN: Violin plot of terminal progress. - TERMINAL_SCATTER: Scatterplot of mean and std dev of terminal progress. :type plot_type: PlotType :param solver_name: Name of the solver. Defaults to "SOLVER SET". :type solver_name: str, optional :param problem_name: Name of the problem. Defaults to "PROBLEM SET". :type problem_name: str, optional :param normalize: Whether to normalize with respect to optimality gaps. Defaults to True. :type normalize: bool, optional :param budget: Function evaluation budget. :type budget: int, optional :param beta: Quantile to compute (must be in (0, 1)). :type beta: float, optional :param feasibility_score_method: Method to compute the feasibility score. Defaults to "inf_norm". :type feasibility_score_method: Literal["inf_norm", "norm"], optional :param feasibility_norm_degree: Degree of the norm to use for the feasibility score. Defaults to 1. :type feasibility_norm_degree: int, optional :param solve_tol: Relative optimality gap for declaring a solve (must be in (0, 1]). :type solve_tol: float, optional :param plot_title: Title to override the automatically generated one. :type plot_title: str, optional :raises ValueError: If any inputs are invalid. .. py:function:: save_plot(solver_name: str, problem_name: str, plot_type: simopt.plot_type.PlotType, normalize: bool, extra: float | list[float] | None = None, plot_title: str | None = None, ext: str = '.png', save_as_pickle: bool = False) -> pathlib.Path Create and save a plot with appropriate labels and formatting. :param solver_name: Name of the solver. :type solver_name: str :param problem_name: Name of the problem. :type problem_name: str :param plot_type: Type of plot to produce. Valid options include: - ALL: All estimated progress curves. - MEAN: Estimated mean progress curve. - QUANTILE: Estimated beta quantile progress curve. - SOLVE_TIME_CDF: CDF of solve time. - CDF_SOLVABILITY: CDF solvability profile. - QUANTILE_SOLVABILITY: Quantile solvability profile. - DIFFERENCE_OF_CDF_SOLVABILITY: Difference of CDF solvability profiles. - DIFFERENCE_OF_QUANTILE_SOLVABILITY: Difference of quantile solvability profiles. - AREA: Area scatterplot. - TERMINAL_SCATTER: Scatterplot of mean and std dev of terminal progress. - FEASIBILITY_SCATTER: Scatterplot of terminal objective vs feasibility. - FEASIBILITY_VIOLIN: Violin plot of terminal feasibility. - ALL_FEASIBILITY_PROGRESS: Feasibility progress curves for all macroreps. - MEAN_FEASIBILITY_PROGRESS: Mean feasibility progress curve. - QUANTILE_FEASIBILITY_PROGRESS: Quantile feasibility progress curve. :type plot_type: PlotType :param normalize: Whether to normalize with respect to optimality gaps. :type normalize: bool :param extra: Extra number(s) specifying quantile (e.g., beta) and/or solve tolerance. :type extra: float | list[float], optional :param plot_title: If provided, overrides the default title and filename. :type plot_title: str | None, optional :param ext: File extension for the saved plot. Defaults to ".png". :type ext: str, optional :param save_as_pickle: Whether to save the plot as a pickle file. Defaults to False. :type save_as_pickle: bool, optional :returns: Path pointing to the location where the plot will be saved. :rtype: Path .. py:function:: check_common_problem_and_reference(experiments: list[simopt.experiment.ProblemSolver]) -> None Check if a collection of experiments share the same problem, x0, and x*. :param experiments: Problem-solver pairs of different solvers on a common problem. :type experiments: list[ProblemSolver] :raises ValueError: If any experiments have different problem instances, starting solutions (`x0`), or optimal solutions (`x*`). .. py:function:: plot_bootstrap_conf_ints(bs_conf_int_lower_bounds: simopt.curve.Curve, bs_conf_int_upper_bounds: simopt.curve.Curve, color_str: str = 'C0') -> None Plot bootstrap confidence intervals. :param bs_conf_int_lower_bounds: Lower bounds of bootstrap confidence intervals, as curves. :type bs_conf_int_lower_bounds: Curve :param bs_conf_int_upper_bounds: Upper bounds of bootstrap confidence intervals, as curves. :type bs_conf_int_upper_bounds: Curve :param color_str: String indicating line color, e.g., "C0", "C1", etc. Defaults to "C0". :type color_str: str, optional .. py:function:: report_max_halfwidth(curve_pairs: list[list[simopt.curve.Curve]], normalize: bool, conf_level: float, difference: bool = False) -> None Print caption for the max halfwidth of bootstrap confidence interval curves. :param curve_pairs: A list of paired bootstrap CI curves. :type curve_pairs: list[list[Curve]] :param normalize: Whether to normalize progress curves with respect to optimality gaps. :type normalize: bool :param conf_level: Confidence level for confidence intervals (must be in (0, 1)). :type conf_level: float :param difference: Whether the plot is for difference profiles. Defaults to False. :type difference: bool, optional :raises ValueError: If `conf_level` is not in (0, 1) or if `curve_pairs` is empty.