Skip to content

methods: Optimization Algorithms

This module provides various algorithms to optimize the sensor placements or paths. Use the get_methods method to retrieve an optimization method class by its string name.

  • ContinuousSGP: This method directly optimizes the inducing points of the AugmentedSGPR model to maximize the Evidence Lower Bound (ELBO). This is the main SGP-based optimization approach proposed in the papers associated with this library.

  • GreedySGP and GreedyObjective: These implement greedy algorithms for sensor placement. GreedySGP iteratively selects inducing points to maximize the SGP's ELBO, while GreedyObjective uses a more general objective function like Mutual Information.

  • BayesianOpt: This method uses Bayesian Optimization, a powerful black-box optimization algorithm, to find the best sensor locations by maximizing a general objective function.

  • CMA: This method uses Covariance Matrix Adaptation Evolution Strategy (CMA-ES), a powerful black-box optimization algorithm, to find the best sensor locations by maximizing a general objective function.

  • DifferentiableObjective: This method leverages TensorFlow's automatic differentiation to directly optimize the objective function with respect to the sensor locations. This can be more efficient than black-box methods for smooth objective functions. However, the method is also more prone to getting stuck in local minima.

sgptools.methods.get_method(method)

Retrieves an optimization method class by its string name.

Parameters:

Name Type Description Default
method str

The name of the optimization method (e.g., 'ContinuousSGP', 'CMA').

required

Returns:

Type Description
Type[Method]

Type[Method]: The class of the requested optimization method.

Raises:

Type Description
KeyError

If the method name is not found.

Usage
# To get the ContinuousSGP class
ContinuousSGPClass = get_method('ContinuousSGP')
# You can then instantiate it:
# CSGP_instance = ContinuousSGPClass(...)
Source code in sgptools/methods.py
def get_method(method: str) -> Type[Method]:
    """
    Retrieves an optimization method class by its string name.

    Args:
        method (str): The name of the optimization method (e.g., 'ContinuousSGP', 'CMA').

    Returns:
        Type[Method]: The class of the requested optimization method.

    Raises:
        KeyError: If the method name is not found.

    Usage:
        ```python
        # To get the ContinuousSGP class
        ContinuousSGPClass = get_method('ContinuousSGP')
        # You can then instantiate it:
        # CSGP_instance = ContinuousSGPClass(...)
        ```
    """
    if method not in METHODS:
        raise KeyError(f"Method '{method}' not found. Available methods: {', '.join(METHODS.keys())}")
    return METHODS[method]