MultiObjectiveOptimizer¶
- class MultiObjectiveOptimizer¶
Bases:
object
Class for black-box optimization with multiple objective functions.
Methods
Initialize MultiObjectiveOptimizer.
Return the optimization history.
Perform black-box optmization with multiple objective functions.
Attributes
The current Amplify-SDK model.
Objective function value corresponding to the current best solution (optimaized input).
Current best solution (optimized input).
Custom objective function that may be ceated directly from amplify.PolyArray.
The current training data.
The number of current optimization cycle.
Objective functions considered in the
MultiObjectiveOptimizer
.Optimizers passed to the
MultiObjectiveOptimizer
.- __init__(
- optimizers: list[QAOptimizerBase],
- client: FixstarsClient | DWaveSamplerClient | LeapHybridSamplerClient | LeapHybridCQMSamplerClient | FujitsuDA4Client | ToshibaSQBM2Client | GurobiClient | NECVA2Client,
- seed: int = 0,
Initialize MultiObjectiveOptimizer.
- Parameters:
optimizers (list[QAOptimizerBase]) – A list of optimizers each of which is associated with a black-box function, relevant decision variables and constraints. These optimizers do not have to be the same type, e.g. a list like [FMQAOptimizer, KernelQAOptimizer] is allowd. Generally, these individual optimizers are used for everything except the amplify.Model construction and communication with an external solver.
client (amplify.FixstarsClient | amplify.DWaveSamplerClient | amplify.LeapHybridSamplerClient | amplify.LeapHybridCQMSamplerClient | amplify.FujitsuDA4Client | amplify.ToshibaSQBM2Client | amplify.GurobiClient | amplify.NECVA2Client) – A solver client available in the Amplify SDK.
seed (int, optional) – A random seed. Defaults to 0.
- fetch_history() History ¶
Return the optimization history. In multiple-objective optimization, number of initial traininig samples contained in the history is always zero (as individual datasets do not always meet constraints and duplicate variables across objectives).
- Returns:
The optimization history.
- Return type:
- optimize(
- num_cycles: int = 10,
- constraint_weight: float | None = None,
- num_solves: int = 1,
- search_max: int = 1000,
- show_annealing_history: bool = False,
Perform black-box optmization with multiple objective functions.
- Parameters:
num_cycles (int, optional) – A number of optimization iterations. Defaults to 10.
constraint_weight (float | None, optional) – A weight for constraints. If set None, the weight is determined based on the latest training data as in 2 times of
DataList.abs_y_max
. If constraint weights are seperately set forConstraint.weight
, this constraint_weight is multiplied on top ofConstraint.weight
. Defaults to None.num_solves (int, optional) – A number of serial solver execution in the Amplify SDK’s serial solver execution (https://amplify.fixstars.com/en/docs/amplify/v1/serial.html). Defaults to 1.
search_max (int, optional) – If the found solution is found the training data, alternative solution close to the original solution is searched for at most search_max times. Defaults to 1000.
show_annealing_history (bool, optional) – True to show a annealing history with time stamp. Available when Amplify Annealing Engine (amplify.FixstarsClient) is specified as the client in the constructor. Defaults to False.
- __dict__ = mappingproxy({'__module__': 'amplify_bbopt.optimizer', '__doc__': 'Class for black-box optimization with multiple objective functions.', '__init__': <function MultiObjectiveOptimizer.__init__>, 'custom_amplify_objective': <property object>, 'best_objective': <property object>, 'best_solution': <property object>, 'optimizers': <property object>, 'objectives': <property object>, 'optimize': <function MultiObjectiveOptimizer.optimize>, '_generate_surrogate_models': <function MultiObjectiveOptimizer._generate_surrogate_models>, '_generate_amplify_model': <function MultiObjectiveOptimizer._generate_amplify_model>, '_evaluate_objective_funcs': <function MultiObjectiveOptimizer._evaluate_objective_funcs>, '_evaluate_custom_objective': <function MultiObjectiveOptimizer._evaluate_custom_objective>, '_is_satisfied': <function MultiObjectiveOptimizer._is_satisfied>, '_generate_alternative_solution': <function MultiObjectiveOptimizer._generate_alternative_solution>, '_combine_solutions': <function MultiObjectiveOptimizer._combine_solutions>, '_divide_into_solutions': <function MultiObjectiveOptimizer._divide_into_solutions>, '_ensure_uniqueness': <function MultiObjectiveOptimizer._ensure_uniqueness>, '_anneal': <function MultiObjectiveOptimizer._anneal>, 'i_cycle': <property object>, 'data': <property object>, 'amplify_model': <property object>, 'fetch_history': <function MultiObjectiveOptimizer.fetch_history>, '__dict__': <attribute '__dict__' of 'MultiObjectiveOptimizer' objects>, '__weakref__': <attribute '__weakref__' of 'MultiObjectiveOptimizer' objects>, '__annotations__': {'_optimizers': 'list[QAOptimizerBase]', '_best_objective': 'int | float | None', '_amplify_model': 'amplify.Model | None', '_elapsed_time': 'list[float]', '_is_de_duplication': 'list[bool]'}})¶
- __weakref__¶
list of weak references to the object (if defined)
- property amplify_model: Model | None¶
The current Amplify-SDK model. If the model is not constructed yet, return None.
- property best_objective: int | float | None¶
Objective function value corresponding to the current best solution (optimaized input).
- property best_solution: FlatSolutionDict | None¶
Current best solution (optimized input).
- property custom_amplify_objective: Poly¶
Custom objective function that may be ceated directly from amplify.PolyArray.
Custom objective does NOT have to be converted from the surrogate model of the black-box function. Retieve amplify.PolyArray via
Variables.poly_array
orVariables.amplify_variables
, and construct an Amplify SDK’s objective function directly, which will be added to the objective constructed from a surrogate model while creating amplify.Model. Such a custom objective function must be created after the instantiation of an QA-based optimizer class, as this is when amplify.PolyArray’s are issued for each of the variables.
- property objectives: BlackBoxFuncList¶
Objective functions considered in the
MultiObjectiveOptimizer
.
- property optimizers: list[QAOptimizerBase]¶
Optimizers passed to the
MultiObjectiveOptimizer
.