Provide bounds, linear constraints, and nonlinear constraints
How to express constraints for various problem types.
|Check first derivative function against finite-difference approximation (Since R2023b)|
- Types of Constraints
Choose the most appropriate form for your constraints.
- Iterations Can Violate Constraints
Considerations for constrained problems.
- Bound Constraints
How to write constraints for individual components.
- Linear Constraints
Include constraints that can be expressed as matrix inequalities or equalities.
- Nonlinear Constraints
How to include general inequality and equality constraints.
- Checking Validity of Gradients or Jacobians
Check whether a derivative function matches finite difference estimates.
- Or Instead of And Constraints
Optimize when only one constraint of a set is necessary.
- Objective and Nonlinear Constraints in the Same Function
Save function evaluations, typically useful in simulations.
- How to Use All Types of Constraints
Example showing all constraints.
Pass Extra Parameters
- Passing Extra Parameters
Including extra parameters or data in your objective or nonlinear constraint functions.
Constraint Argument Details
- Matrix Arguments
Handling multidimensional arguments.