@@ -547,16 +547,16 @@ Documentation Page: https://docs.sciml.ai/Optimization/stable/API/optimization_p
547
547
548
548
## Mathematical Specification of an Optimization Problem
549
549
550
- To define an Optimization Problem , you simply need to give the function ``f``
551
- which defines the cost function to minimize :
550
+ To define an optimization problem , you need the objective function ``f``
551
+ which is minimized over the domain of ``u``, the collection of optimization variables :
552
552
553
553
```math
554
554
min_u f(u,p)
555
555
```
556
556
557
- ``u₀`` is an initial guess of the minimum . `f` should be specified as `f(u,p)`
558
- and `u₀` should be an AbstractArray (or number) whose geometry matches the
559
- desired geometry of `u`. Note that we are not limited to numbers or vectors
557
+ ``u₀`` is an initial guess for the minimizer . `f` should be specified as `f(u,p)`
558
+ and `u₀` should be an ` AbstractArray` whose geometry matches the
559
+ desired geometry of `u`. Note that we are not limited to vectors
560
560
for `u₀`; one is allowed to provide `u₀` as arbitrary matrices /
561
561
higher-dimension tensors as well.
562
562
@@ -574,27 +574,27 @@ OptimizationProblem{iip}(f, u0, p = SciMLBase.NullParameters(),;
574
574
kwargs...)
575
575
```
576
576
577
- `isinplace` optionally sets whether the function is in-place or not. This is
578
- determined automatically, but not inferred. Note that for OptimizationProblem,
579
- in-place only refers to the Jacobian and Hessian functions, and thus by default
580
- if the `OptimizationFunction` is not defined directly then `iip = true` is
581
- done by default.
577
+ `isinplace` optionally sets whether the function is in-place or not.
578
+ This is determined automatically, but not inferred. Note that for OptimizationProblem,
579
+ in-place refers to the objective's derivative functions, the constraint function
580
+ and its derivatives. `OptimizationProblem` currently only supports in-place.
582
581
583
- Parameters are optional, and if not given, then a `NullParameters()` singleton
582
+ Parameters `p` are optional, and if not given, then a `NullParameters()` singleton
584
583
will be used, which will throw nice errors if you try to index non-existent
585
- parameters. Any extra keyword arguments are passed on to the solvers. For example,
586
- if you set a `callback` in the problem, then that `callback` will be added in
587
- every solve call.
584
+ parameters.
588
585
589
586
`lb` and `ub` are the upper and lower bounds for box constraints on the
590
- optimization. They should be an `AbstractArray` matching the geometry of `u`,
591
- where `(lb[I],ub[I])` is the box constraint (lower and upper bounds)
592
- for `u[I]`.
587
+ optimization variables. They should be an `AbstractArray` matching the geometry of `u`,
588
+ where `(lb[i],ub[i])` is the box constraint (lower and upper bounds) for `u[i]`.
589
+
590
+ `lcons` and `ucons` are the upper and lower bounds in case of inequality constraints on the
591
+ optimization and if they are set to be equal then it represents an equality constraint.
592
+ They should be an `AbstractArray` matching the geometry of `u`, where `(lcons[i],ucons[i])`
593
+ are the lower and upper bounds for `cons[i]`.
593
594
594
- `lcons` and `ucons` are the upper and lower bounds for equality constraints on the
595
- optimization. They should be an `AbstractArray` matching the geometry of `u`,
596
- where `(lcons[I],ucons[I])` is the constraint (lower and upper bounds)
597
- for `cons[I]`.
595
+ The `f` in the `OptimizationProblem` should typically be an instance of [`OptimizationFunction`](@ref)
596
+ to specify the objective function and its derivatives either by passing
597
+ predefined functions for them or automatically generated using the [`ADType`](@ref).
598
598
599
599
If `f` is a standard Julia function, it is automatically transformed into an
600
600
`OptimizationFunction` with `NoAD()`, meaning the derivative functions are not
@@ -605,12 +605,13 @@ Any extra keyword arguments are captured to be sent to the optimizers.
605
605
### Fields
606
606
607
607
* `f`: the function in the problem.
608
- * `u0`: the initial guess for the optima.
609
- * `p`: the parameters for the problem. Defaults to `NullParameters`.
610
- * `lb`: the lower bounds for the optimization of `u`.
611
- * `ub`: the upper bounds for the optimization of `u`.
612
- * `int`: integrality indicator for `u`.
613
- * `lcons`: the vector of lower bounds for the constraints passed to [`OptimizationFunction`](@ref).
608
+ * `u0`: the initial guess for the optimization variables.
609
+ * `p`: the constant parameters used for defining the problem. Defaults to `NullParameters`.
610
+ * `lb`: the lower bounds for the optimization variables `u`.
611
+ * `ub`: the upper bounds for the optimization variables `u`.
612
+ * `int`: integrality indicator for `u`. If `int[i] == true`, then `u[i]` is an integer variable.
613
+ Defaults to `nothing`, implying no integrality constraints.
614
+ * `lcons`: the vector of lower bounds for the constraints passed to [OptimizationFunction](@ref).
614
615
Defaults to `nothing`, implying no lower bounds for the constraints (i.e. the constraint bound is `-Inf`)
615
616
* `ucons`: the vector of upper bounds for the constraints passed to [`OptimizationFunction`](@ref).
616
617
Defaults to `nothing`, implying no upper bounds for the constraints (i.e. the constraint bound is `Inf`)
@@ -619,7 +620,7 @@ Any extra keyword arguments are captured to be sent to the optimizers.
619
620
620
621
## Inequality and Equality Constraints
621
622
622
- Both inequality and equality constraints are defined by the `f.cons` function in the `OptimizationFunction`
623
+ Both inequality and equality constraints are defined by the `f.cons` function in the [ `OptimizationFunction`](@ref)
623
624
description of the problem structure. This `f.cons` is given as a function `f.cons(u,p)` which computes
624
625
the value of the constraints at `u`. For example, take `f.cons(u,p) = u[1] - u[2]`.
625
626
With these definitions, `lcons` and `ucons` define the bounds on the constraint that the solvers try to satisfy.
0 commit comments