Main Content

Variable for optimization

An `OptimizationVariable`

object contains variables for
optimization expressions. Use expressions to represent an objective function,
constraints, or equations. Variables are symbolic in nature, and can be arrays of any
size.

**Tip**

For the full workflow, see Problem-Based Optimization Workflow or Problem-Based Workflow for Solving Equations.

Create an `OptimizationVariable`

object using `optimvar`

.

`show` | Display information about optimization object |

`showbounds` | Display variable bounds |

`write` | Save optimization object description |

`writebounds` | Save description of variable bounds |

`OptimizationVariable`

objects have*handle*copy behavior. See Handle Object Behavior and Comparison of Handle and Value Classes. Handle copy behavior means that a copy of an`OptimizationVariable`

points to the original and does not have an independent existence. For example, create a variable`x`

, copy it to`y`

, then set a property of`y`

. Note that`x`

takes on the new property value.x = optimvar('x','LowerBound',1); y = x; y.LowerBound = 0; showbounds(x)

0 <= x

`optimvar`

| `OptimizationConstraint`

| `OptimizationExpression`

| `OptimizationProblem`

| `show`

| `showbounds`

| `write`

| `writebounds`