Skip to content

Commit ecccbc4

Browse files
authored
Update usage.md - Made Tim's requested changes
1 parent 7696b8a commit ecccbc4

File tree

1 file changed

+4
-45
lines changed

1 file changed

+4
-45
lines changed

docs/src/usage.md

+4-45
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,24 @@ To use the `DividedRectangles` module, start your code with:
55
```julia
66
using DividedRectangles
77
```
8-
98
---
109

1110
## Core Functions
1211

1312
### `optimize`
1413
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.
1514

16-
To use the `optimize` function with a custom mathematical function:
15+
To use the `optimize` function with a custom objective function::
1716

1817
```julia
1918
using DividedRectangles
2019

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

2423
# Set the search bounds
25-
a = [0.0, 0.0, 0.0]
26-
b = [1.0, 1.0, 1.0]
24+
a = [-2.0, -2.0]
25+
b = [2.0, 2.0]
2726

2827
# Call the optimization function
2928
result = optimize(f, a, b)
@@ -42,43 +41,3 @@ println("Best design found: ", result)
4241
**Returns:**
4342
- The best design 𝑥 found by DIRECT.
4443
---
45-
46-
### Example: Multivariate Optimization
47-
48-
The following example shows how to optimize a multivariate function using the DIRECT algorithm:
49-
50-
```julia
51-
using DividedRectangles
52-
53-
# Define the objective function
54-
f(x) = x[1]^2 + x[2]^2 + 3 * sin(5 * x[1]) + 2 * cos(3 * x[2])
55-
56-
# Set the search bounds
57-
a = [-2.0, -2.0]
58-
b = [2.0, 2.0]
59-
60-
# Optimize
61-
result = DividedRectangles.optimize(f, a, b)
62-
63-
println("Best design found: ", result)
64-
```
65-
---
66-
67-
### Parameters
68-
- `f`: This is the objective function to minimize. Should be an operation that accepts a vector of Float64 values.
69-
- `a`: Vector representing the lower bounds of the search space.
70-
- `b`: Vector representing the upper bounds of the search space.
71-
- `max_iterations`: Maximum number of iterations for the optimization (default: 100).
72-
- `min_radius`: Minimum size of hyper-rectangles (`default: 1e-5`).
73-
---
74-
75-
## Advanced Usage
76-
### Fine-Tuning Optimization:
77-
The `optimize` function offers several parameters for fine-tuning the optimization process:
78-
79-
- `max_iterations`: Sets the maximum number of iterations. Increasing this value can improve accuracy but requires more computational time.
80-
- `min_radius`: Specifies the minimum size of hyper-rectangles to control the granularity of the search.
81-
82-
```julia
83-
result = DividedRectangles.optimize(f, a, b, max_iterations=500, min_radius=1e-6)
84-
```

0 commit comments

Comments
 (0)