Absolute Value in optimization expression
7 次查看(过去 30 天)
显示 更早的评论
How can I add an absolute value to an optimization expression I am trying to optimize? MATLAB shows the following error :
Undefined function 'abs' for input arguments of type 'optim.problemdef.OptimizationExpression'.
problem is :
minimize abs ( ax + by + cz - d )
subject to , x,y,z are integers in some range
0 个评论
回答(2 个)
Sean de Wolski
2019-2-1
编辑:Sean de Wolski
2019-2-1
Square it instead so as to not introduce a discontinuity
(expr).^2
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Problem-Based Optimization Setup 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!