Decomposing absolute value terms

651 Views Asked by At

I have something like the following term:


7x1 + 9x2 + | 10 - 7x1 | + | 15 - 11x2 |

I want to make it into something like this:


Ax1 + Bx2 , where A and B are constants

For two values x1 and x2, it is ok to try out both positive and negative values. However, I have 18 such terms and the coefficient for these xs' need to be used in a linear optimization problem in Matlab. Is there a way to achieve the above?

1

There are 1 best solutions below

0
On

In general, there is no way to simplify such an expression to a linear expression $Ax_1+Bx_2$.

Here is a single-variable example using $f(x)=x+|x|$.

enter image description here

Clearly there is no way to simplify that to $f(x)=Ax$ or even $f(x)=Ax+B$. You would need a piece-wise definition, which is what you are trying to avoid.

Here is a WolframAlpha graph of the expression you gave:

enter image description here

Again, clearly there is no way to make that linear without a piece-wise definition.