showbounds

Display variable bounds

Description

Use showbounds to display the bounds on optimization variables.

example

showbounds(var) displays the bounds for var.

Examples

collapse all

Show bounds for various optimization variables.

Create a continuous optimization variable array and display its bounds.

x = optimvar('x',2,2);
showbounds(x)
x is unbounded.

Set lower bounds of 0 on all elements of x, and set upper bounds on the first row.

x.LowerBound = 0;
x.UpperBound(1,:) = [3,5];
showbounds(x)
0 <= x(1, 1) <= 3
0 <= x(2, 1)
0 <= x(1, 2) <= 5
0 <= x(2, 2)

Create a binary optimization variable array and display its bounds.

binvar = optimvar('binvar',2,2,'Type','integer',...
'LowerBound',0,'UpperBound',1);
showbounds(binvar)
0 <= binvar(1, 1) <= 1
0 <= binvar(2, 1) <= 1
0 <= binvar(1, 2) <= 1
0 <= binvar(2, 2) <= 1

Create a large optimization variable that has few bounded elements, and display the variable bounds.

bigvar = optimvar('bigvar',100,10,50);
bigvar.LowerBound(55,4,3) = -20;
bigvar.LowerBound(20,5,30) = -40;
bigvar.UpperBound(35,3,35) = -200;
showbounds(bigvar)
-20 <= bigvar(55, 4, 3)
-40 <= bigvar(20, 5, 30)
bigvar(35, 3, 35) <= -200

Input Arguments

collapse all

Optimization variable, specified as an OptimizationVariable object. Create var using optimvar.

Example: var = optimvar('var',4,6)

Tips

• For a variable that has many bounds, use writebounds to generate a text file containing the bound information.