Absolute Value in optimization expression

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

답변 (2개)

Torsten
Torsten 2019년 2월 4일
편집: Torsten 2019년 2월 4일

1 개 추천

min: eps
+ (a*x + b*y + c*z - d) - eps <= 0
- (a*x + b*y + c*z - d) - eps <= 0
subject to x,y,z are integers in some range with a new variable "eps".
Sean de Wolski
Sean de Wolski 2019년 2월 1일
편집: Sean de Wolski 2019년 2월 1일

0 개 추천

Square it instead so as to not introduce a discontinuity
(expr).^2

카테고리

도움말 센터File Exchange에서 Problem-Based Optimization Setup에 대해 자세히 알아보기

질문:

2019년 2월 1일

편집:

2019년 2월 4일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by