Skip to content

Commit 5bb9e7c

Browse files
authored
Update README.md
1 parent c7035e0 commit 5bb9e7c

File tree

1 file changed

+8
-54
lines changed

1 file changed

+8
-54
lines changed

README.md

+8-54
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,7 @@
1010
**DividedRectangles.jl** provides an implementation of the DIRECT (DIvided RECTangles) [algorithm for global optimization](https://scholar.google.com/scholar?hl=en&as_sdt=0%2C5&q=Lipschitzian+optimization+without+the+Lipschitz+constant&btnG=). 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.
1111

1212
---
13-
14-
Example Objective Function:
15-
As an example of an objective function, consider:
16-
17-
```julia
18-
f(x) = dot(coeffs, x)
19-
```
20-
where:
21-
- `x`: represents the variables.
22-
- `coeffs`: represents the coefficients corresponding to each variable.
23-
24-
This is just one possible objective function that could be optimized using the DIRECT algorithm. The algorithm works by dividing the search space into smaller rectangles and evaluating the function at specific points within these rectangles to find the optimal solution.
13+
![page_11](https://github.com/user-attachments/assets/b833bedd-41aa-40c5-a27f-26188a171797)
2514

2615
---
2716

@@ -36,29 +25,31 @@ using Pkg
3625
Pkg.add(url="https://github.com/sisl/DividedRectangles.jl")
3726

3827
```
39-
# Usage
28+
# Usage
4029

4130
To use the `DividedRectangles` module, start your code with:
4231

4332
```julia
4433
using DividedRectangles
4534
```
35+
---
36+
4637
## Core Functions
4738

4839
### `optimize`
4940
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.
5041

51-
To use the `optimize` function with a custom mathematical function:
42+
To use the `optimize` function with a custom objective function::
5243

5344
```julia
5445
using DividedRectangles
5546

5647
# Define the objective function
57-
f(x) = dot([1.0, 2.0, 3.0], x) # Example objective function with coefficients
48+
f(x) = x[1]^2 + x[2]^2 + 3 * sin(5 * x[1]) + 2 * cos(3 * x[2]) # Multivariate example
5849

5950
# Set the search bounds
60-
a = [0.0, 0.0, 0.0]
61-
b = [1.0, 1.0, 1.0]
51+
a = [-2.0, -2.0]
52+
b = [2.0, 2.0]
6253

6354
# Call the optimization function
6455
result = optimize(f, a, b)
@@ -78,43 +69,6 @@ println("Best design found: ", result)
7869
- The best design 𝑥 found by DIRECT.
7970
---
8071

81-
### Example: Multivariate Optimization
82-
83-
The following example shows how to optimize a multivariate function using the DIRECT algorithm:
84-
85-
```julia
86-
using DividedRectangles
87-
88-
# Define the objective function
89-
f(x) = x[1]^2 + x[2]^2 + 3 * sin(5 * x[1]) + 2 * cos(3 * x[2])
90-
91-
# Set the search bounds
92-
a = [-2.0, -2.0]
93-
b = [2.0, 2.0]
94-
95-
# Optimize
96-
result = DividedRectangles.optimize(f, a, b)
97-
98-
println("Best design found: ", result)
99-
```
100-
101-
### Parameters
102-
- `f`: This is the objective function to minimize. Should be an operation that accepts a vector of Float64 values.
103-
- `a`: Vector representing the lower bounds of the search space.
104-
- `b`: Vector representing the upper bounds of the search space.
105-
- `max_iterations`: Maximum number of iterations for the optimization (default: 100).
106-
- `min_radius`: Minimum size of hyper-rectangles (`default: 1e-5`).
107-
108-
## Advanced Usage
109-
### Fine-Tuning Optimization:
110-
The `optimize` function offers several parameters for fine-tuning the optimization process:
111-
112-
- `max_iterations`: Sets the maximum number of iterations. Increasing this value can improve accuracy but requires more computational time.
113-
- `min_radius`: Specifies the minimum size of hyper-rectangles to control the granularity of the search.
114-
115-
```julia
116-
result = DividedRectangles.optimize(f, a, b, max_iterations=500, min_radius=1e-6)
117-
```
11872
## Credits
11973

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

0 commit comments

Comments
 (0)