rbfopt_black_box module

Black-box function.

This module contains the definition of the black box function that is optimized by RBFOpt, when using the default command line interface. This is an abstract class: all methods must be reimplemented by the user.

Licensed under Revised BSD license, see LICENSE. (C) Copyright Singapore University of Technology and Design 2014. (C) Copyright International Business Machines Corporation 2016.

class rbfopt_black_box.RbfoptBlackBox[source]

Bases: object

Abstract class for a black-box function that can be optimized.

A class that declares (but does not implement) the necessary methods to describe a black-box function. The user can implement a derived class and use it to compute the function that must be optimized.

evaluate(x)[source]

Evaluate the black-box function.

Parameters:
x : 1D numpy.ndarray[float]

Value of the decision variables.

Returns:
float

Value of the function at x.

evaluate_noisy(x)[source]

Evaluate a fast approximation of the black-box function.

Returns an approximation of the value of evaluate(), hopefully much more quickly, and provides error bounds on the evaluation. If has_evaluate_noisy() returns False, this function will never be queried and therefore it does not have to return any value.

Parameters:
x : 1D numpy.ndarray[float]

Value of the decision variables.

Returns:
1D numpy.ndarray[float]

A numpy array with three floats (value, lower, upper) containing the approximate value of the function at x, the lower error bound, and the upper error bound, such that the true function value is contained between value + lower and value + upper. Hence, lower should be <= 0 while upper should be >= 0.

get_dimension()[source]

Return the dimension of the problem.

Returns:
int

The dimension of the problem.

get_var_lower()[source]

Return the array of lower bounds on the variables.

Returns:
1D numpy.ndarray[float]

Lower bounds of the decision variables.

get_var_type()[source]

Return the type of each variable.

Returns:
1D numpy.ndarray[char]

An array of length equal to dimension, specifying the type of each variable. Possible types are ‘R’ for real (continuous) variables, and ‘I’ for integer (discrete) variables.

get_var_upper()[source]

Return the array of upper bounds on the variables.

Returns:
1D numpy.ndarray[float]

Upper bounds of the decision variables.

has_evaluate_noisy()[source]

Indicate whether evaluate_noisy is available.

Indicate if a fast but potentially noisy version of evaluate is available through the function evaluate_noisy. If True, such function will be used to try to accelerate convergence of the optimization algorithm. If False, the function evaluate_noisy will never be queried.

Returns:
bool

Is evaluate_noisy available?