gemseo_benchmark / data_profiles

Show inherited members

target_values module

Computation of target values out of algorithms performance histories.

Consider a problem to be solved by an iterative algorithm, e.g. an optimization problem or a root-finding problem. Targets are values, i.e. values of the objective function or values of the residual norm, ranging from a first acceptable value to the best known value for the problem. Targets are used to estimate the efficiency (relative to the number of problem functions evaluations) of an algorithm to solve a problem (or several) and computes its data profile (see data_profiles.data_profile).

class gemseo_benchmark.data_profiles.target_values.TargetValues(objective_values=None, infeasibility_measures=None, feasibility_statuses=None, n_unsatisfied_constraints=None, problem_name=None, objective_name=None, constraints_names=None, doe_size=None, total_time=None, algorithm_configuration=None, number_of_variables=None)[source]

Bases: PerformanceHistory

Target values of a problem.

Parameters:
  • objective_values (Sequence[float] | None) – The history of the quantity to be minimized. If None, will be considered empty.

  • infeasibility_measures (Sequence[float] | None) – The history of infeasibility measures. An infeasibility measure is a non-negative real number representing the gap between the design and the feasible space, a zero value meaning feasibility. If None and feasibility_statuses is not None then the infeasibility measures are set to zero in case of feasibility, and set to infinity otherwise. If None and feasibility_statuses is None then every infeasibility measure is set to zero.

  • feasibility_statuses (Sequence[bool] | None) – The history of the (boolean) feasibility statuses. If infeasibility_measures is not None then feasibility_statuses is disregarded. If None and ‘infeasibility_measures’ is None then every infeasibility measure is set to zero.

  • n_unsatisfied_constraints (Sequence[int] | None) – The history of the number of unsatisfied constraints. If None, the entries will be set to 0 for feasible entries and None for infeasible entries.

  • problem_name (str | None) – The name of the problem. If None, it will not be set.

  • objective_name (str | None) – The name of the objective function. If None, it will not be set.

  • constraints_names (Sequence[str] | None) – The names the scalar constraints. Each name must correspond to a scalar value. If None, it will not be set.

  • doe_size (int | None) – The size of the initial design of experiments. If None, it will not be set.

  • total_time (float | None) – The total time of the optimization, in seconds. If None, it will not be set.

  • algorithm_configuration (AlgorithmConfiguration | None) – The name of the algorithm which generated the history. If None, it will not be set.

  • number_of_variables (int | None) – The number of optimization variables. If None, it will not be set.

Raises:

ValueError – If the lengths of the histories do not match.

compute_target_hits_history(values_history)[source]

Compute the history of the number of target hits for a performance history.

Parameters:

values_history (PerformanceHistory) – The history of values.

Returns:

The history of the number of target hits.

Return type:

list[int]

plot(show=True, file_path=None)[source]

Plot the target values.

Parameters:
  • show (bool) –

    Whether to show the plot.

    By default it is set to True.

  • file_path (str | Path | None) – The path where to save the plot. If None, the plot is not saved.

Returns:

A figure showing the target values.

Return type:

Figure