Skip to content

Commit

Permalink
Update usage.md
Browse files Browse the repository at this point in the history
  • Loading branch information
tawheeler authored Sep 22, 2024
1 parent 424d2bd commit 06d7d53
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions docs/src/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,31 @@ println("Best design found: ", result)

**Returns:**
- The best design `x` found by DIRECT.


The package also provides `direct`, which is the same as `optimize` except it returns all hyperrectangular intervals:

```julia
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]

# Run DIRECT
intervals = direct(f, a, b, max_iterations=10, min_radius=1e-4)

```

**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:**
- All hyperrectangular intervals maintained by DIRECT.

0 comments on commit 06d7d53

Please sign in to comment.