Skip to content

Commit dacb8b0

Browse files
add bounds to optimization
1 parent 6b61a6d commit dacb8b0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/src/examples/min_and_max.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function is `f`:
6161
using Optimization, OptimizationNLopt, ForwardDiff
6262
optf = OptimizationFunction(f, Optimization.AutoForwardDiff())
6363
min_guess = 18.0
64-
optprob = OptimizationProblem(optf, [min_guess])
64+
optprob = OptimizationProblem(optf, [min_guess], lb = [0.0], ub = [100.0])
6565
opt = solve(optprob, NLopt.LD_LBFGS())
6666
```
6767

@@ -79,7 +79,7 @@ fminus(t,_) = -sol(first(t),idxs=4)
7979
8080
optf = OptimizationFunction(fminus, Optimization.AutoForwardDiff())
8181
min_guess = 22.0
82-
optprob2 = OptimizationProblem(optf, [min_guess])
82+
optprob2 = OptimizationProblem(optf, [min_guess], lb = [0.0], ub = [100.0])
8383
opt2 = solve(optprob2, NLopt.LD_LBFGS())
8484
```
8585

0 commit comments

Comments
 (0)