jijzepttools.blackbox_optimization.bbo_ommx#
Classes#
Generic enumeration. |
|
Blackbox optimization using surrogate models. |
Module Contents#
- class BBOMethod#
Bases:
enum.Enum
Generic enumeration.
Derive from this class to define new enumerations.
- FMO = 'FMO'#
- BOCS = 'BOCS'#
- BayesianFMO = 'BayesianFMO'#
- TPE = 'TPE'#
- class BlackboxOptimization(bb_model: jijzepttools.blackbox_optimization.problem.BlackboxProblem)#
Blackbox optimization using surrogate models.
This class provides a unified interface for optimizing blackbox functions using different surrogate modeling approaches such as Factorization Machine and BOCS.
The typical workflow is: 1. Initialize with a BlackboxProblem 2. Setup with initial data and objectives 3. Run optimization with specified method and parameters
- bb_model#
- X: numpy.ndarray | None = None#
- y: numpy.ndarray | None = None#
- experiment_details: minto.Experiment | None = None#
- setup(dataset: pandas.DataFrame | tuple[list[dict], list[dict]], objectives: list[str], instance_data: dict | None = None, record_experiment_details: bool = False, record_instance_in_experiment_details: bool = False, record_solution_in_experiment_details: bool = False, experiment_name: str = 'blackbox_optimization')#
Setup the optimization with initial data and objectives. Creates a minto.Experiment and logs initial data.
- Parameters:
dataset (pd.DataFrame or tuple[list[dict], list[dict]]) – Initial dataset containing decision variables and objective values. Can be either a DataFrame or tuple of (input_dicts, output_dicts).
objectives (list[str]) – Names of objective functions to optimize.
instance_data (dict, optional) – Additional data for creating the problem instance.
record_experiment_details (bool, default=False) – Whether to record the experiment details. If True, the experiment details will be recorded and you can see this by using get_experiment_details() method.
record_instance_in_experiment_details (bool, default=False) – Whether to record the instance in the experiment details. If True, the instance will be recorded in the experiment details. Instance Recording can be so heavy.
record_solution_in_experiment_details (bool, default=False) – Whether to record the solution in the experiment details. If True, the solution will be recorded in the experiment details. Solution Recording can be so heavy.
experiment_name (str, default="blackbox_optimization") – Name for the minto experiment.
- run(n_iter: int, blackbox_func: Callable[[dict], dict[str, float]] | None = None, solver: Callable | None = None, methods: List[BBOMethod] | None = None, surrogate_params: jijzepttools.blackbox_optimization.surrogate_model.SurrogateModelParams | None = None, enable_binary_conversion: bool = False, resolution_continuous_to_integer: int | None = None) minto.Experiment #
Run blackbox optimization iterations using the existing experiment.
# TODO: FMOやBOCSのサロゲートベースの方法だけでなく、Optunaにも対応できるようにする。 # TODO: 複数メソッドを使ってブラックボックス最適化できるようにする。またそれをデフォルトにする。 # TODO: 連続変数の問題に対して、FMのfit前にバイナリ変数への変換を行う機能を実装する。 # TODO: enable_binary_conversionが現在FMOのみ対応だが、他の必要なメソッドにも対応できるようにする。 # TODO: 多目的最適化への対応を行う。
- Parameters:
n_iter (int) – Number of optimization iterations.
methods (list of BBOMethod, optional) – List of surrogate model methods. Currently only supports a list with one method. #TODO: 複数メソッドに対応させる Defaults to [BBOMethod.FMO].
blackbox_func (callable, optional) – Function to evaluate new candidates. Required if n_iter > 1.
solver (callable, optional) – OMMX solver function. Defaults to ommx_pyscipopt_adapter.OMMXPySCIPOptAdapter.solve.
surrogate_params (SurrogateModelParams, optional) – Parameters for the surrogate model. Uses defaults if None.
enable_binary_conversion (bool, default=False) – Whether to use binary variable conversion (now, support only BBOMethod.FMO).
resolution_continuous_to_integer (int, optional) – Resolution for continuous to integer conversion (required if enable_binary_conversion=True).
- Returns:
The experiment object containing all optimization history.
- Return type:
minto.Experiment
- Raises:
ValueError – If setup() hasn’t been called or invalid parameters are provided.
- get_experiment_details() minto.Experiment #