MATLAB 帮助中心
(不推荐)显示优化约束
showconstr(constr)
不推荐使用 showconstr。请改用 show。
showconstr
show
showconstr(constr) 在 MATLAB® 命令行窗口中显示优化约束 constr。
constr
示例
全部折叠
显示优化约束的数组。
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
OptimizationEquality
OptimizationInequality
OptimizationConstraint
优化约束,指定为 OptimizationEquality 对象、OptimizationInequality 对象或 OptimizationConstraint 对象。constr 可以表示单个约束或约束数组。
示例: 当 x 和 y 是标量变量时,constr = x + y <= 1 是单个约束。
x
y
constr = x + y <= 1
示例: 当 x 是二维或多维数组时,constr = sum(x) == 1 是约束数组。
constr = sum(x) == 1
对于大型或复杂的约束,请使用 writeconstr 生成包含约束信息的文本文件。
writeconstr
不推荐使用 showconstr 函数。请改用 show。show 函数取代了 showconstr 和许多其他基于问题的函数。
目前没有删除 showconstr 的计划。
OptimizationConstraint | show | write
write
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
欧洲
亚太
联系您当地的办事处