Display variable bounds
showbounds(var)
example
showbounds(var) displays the bounds for var.
var
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
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
OptimizationVariable
Optimization variable, specified as an OptimizationVariable object. Create var using optimvar.
optimvar
Example: var = optimvar('var',4,6)
var = optimvar('var',4,6)
For a variable that has many bounds, use writebounds to generate a text file containing the bound information.
writebounds
OptimizationVariable | optimvar | writebounds
You have a modified version of this example. Do you want to open this example with your edits?