Skip to content
Paulo edited this page Mar 5, 2020 · 10 revisions

Table of Contents

  1. Getting started
    1. Specifying the objective functions
    2. Calling the optimizer

Welcome to the MOBOpt wiki!

MOBOpt stands for Multi-Objective Bayesian Optimization

Based on the mono-objective optimizer available at Bayesian Optimization

Getting started

Specifying the objective functions

In order to use the MOBOpt package it is necessary to specify a function that is going to be optimized.

def objective(x):
    """ Objective functions to be optimized

    Input: x --> 1-D np.array with NParam elements
    """
    ...
    return np.array(f1(x), f2(x), ..., f_NObj(x))

Where x is a np.array with the arguments of the objectives, NParam is the dimensionality of the search space, fi is the i-th of the NObj different objectives.

Calling the optimizer

To use the optimizer, it is necessary to instantiate a MOBayesianOpt object.

import mobopt as mo

Optimizer = mo.MOBayesianOpt(target=objective,
                             NObj=NObj,
                             pbounds=bounds)

The required arguments are:

  1. target: the function to be optimized;
  2. NObj: the number of objective functions;
  3. pbounds: numpy array with shape (NParam, 2) specifying the bounds for the variables in the search space, where NParam is the dimensionality of the search space;

It is necessary to call the method initialize which probes the objective functions the first random initial points necessary to initialize the method. The parameter init_points specifies how many random points will be calculated.

Optimizer.initialize(init_points=2)

And finally, the maximize method will actually run the optimization algorithm, it requires the argument n_iter which defines the number of iterations of the method (effectively the number of calls of the objective function)

front, pop = Optimizer.maximize(n_iter=NIter)

The maximize method returns two variables:

  • front: np.array of shape (nPts, NObj), with the Pareto Front of the problem (results in objective space)
  • pop: np.array of shape (nPts, NParam), with the Pareto Set of the problem (results in search space)

In both cases nPts represent the number of points in the Pareto Front.

Clone this wiki locally