Display optimization constraint
showconstr(constr)
example
showconstr(constr) displays the optimization constraint constr at the MATLAB®Command Window.
constr
collapse all
Display an array of optimization constraints.
x = optimvar('x',3,2); constr = sum(x,2) <= [1;3;2]; showconstr(constr)
(1, 1) x(1, 1) + x(1, 2) <= 1 (2, 1) x(2, 1) + x(2, 2) <= 3 (3, 1) x(3, 1) + x(3, 2) <= 2
OptimizationConstraint
Optimization constraint, specified as an OptimizationConstraint object. constr can represent a single constraint or an array of constraints.
Example: constr = x + y <= 1 is a single constraint when x and y are scalar variables.
constr = x + y <= 1
x
y
Example: constr = sum(x) == 1 is an array of constraints when x is an array of two or more dimensions.
constr = sum(x) == 1
For a large or complicated constraint, use writeconstr to generate a text file containing the constraint information.
writeconstr
OptimizationConstraint | showproblem | writeconstr
showproblem