Skip to content

sisl/DividedRectangles.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DividedRectangles.jl

CI Documentation Status codecov

Important Note: The content in this package is borrowed from Chapter 7, "Direct Methods," of the forthcoming second edition of "Algorithms for Optimization" by Mykel Kochenderfer and Tim Wheeler.

DividedRectangles.jl provides an implementation of the DIRECT (DIvided RECTangles) algorithm for global optimization. The DIRECT algorithm is particularly useful for optimizing functions where the Lipschitz constant is unknown. This package allows users to perform both univariate and multivariate optimization efficiently.

The figure below shows the DIRECT method after 16 iterations on the Branin function. The cells are much denser around the minima of the Branin function because the DIRECT method is designed to increase its resolution in promising regions.

page_11

Installation

To install the package, start Julia and run the following command:

using Pkg
Pkg.add(url="https://github.com/sisl/DividedRectangles.jl")

Usage

To use the DividedRectangles module, start your code with:

using DividedRectangles

The optimize function is the primary function of the DividedRectangles module. It implements the DIRECT algorithm to find the minimum of a given objective function within specified bounds.

To use the optimize function with a custom objective function::

using DividedRectangles

# Define the objective function
f(x) = x[1]^2 + x[2]^2 + 3 * sin(5 * x[1]) + 2 * cos(3 * x[2])  # Multivariate example

# Set the search bounds
a = [-2.0, -2.0]
b = [2.0, 2.0]

# Call the optimization function
result = optimize(f, a, b)

println("Best design found: ", result)

Arguments:

  • f: The objective function to be minimized.
  • a: Vector of lower bounds for the search space.
  • b: Vector of upper bounds for the search space.
  • max_iterations: (Optional) The maximum number of iterations (default: 100).
  • min_radius: (Optional) The minimum radius of hyper-rectangles (default: 1e-5).

Returns:

  • The best design x found by DIRECT.

Credits

Contributors to this package include Anshrin Srivastava, Mykel Kochenderfer, Dylan Asmar, and Tim Wheeler.

About

Divided Rectangles global optimization method

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages