/LIPO

This repository contains an implementation of LIPO, LIPO+, AdaLIPO, and AdaLIPO+.

Primary LanguagePythonGNU Affero General Public License v3.0AGPL-3.0

LIPO, AdaLIPO, LIPO+, and AdaLIPO+ implementation

This repository contains an implementation of the following algorithms:

LIPO+ and AdaLIPO+ are empirical enhancements introduced of LIPO and AdaLIPO, introduced in the paper Experimental Improvements of Global Optimization Algorithms for Lipschitz Functions. A demo of these algorithms is available on the IPOL website.

Usage

You need to create a class for your function to maximize. This class must be named Function and follow the following interface:

import numpy as np

class Function:
  def __init__(self) -> None:
    self.bounds = bounds # (min, max) tuple for each dimension (numpy array)
    self.k = k # Lipschitz constant (float)
    pass

  def __call__(self, x: np.ndarray) -> float:
    # Closed form of the function to maximize
    pass

The file containing the class must be in the functions folder.

Several examples are available in the functions folder.

Then, you can run the algorithm with the following command:

python src/main.py --function <path_to_your_function_class> -n <number_of_function_eval>

Some optional arguments are available, you can see them with the --help flag.