# Algorithm (SciPy?) for Solving Optimization Problem with Absolute Values

I am at a point in n-dimensional space $X^0$ and it costs me to move to $X_i$ with varying cost depending on direction $\Sigma_i c_i |X_i-X^0_i|$.

But, it's good for me to move closer to a target point $X^*$ because I'm penalized quadratically for being away from the target $d \Sigma_i |X_i-X^*_i|^2$.

I know the absolute values make this problematic but is there a way to globally minimize the total cost function for $X_i$? (algorithmically?)

$Cost =\Sigma_i c_i |X_i-X^0_i| + d \Sigma_i |X_i-X^*_i|^2$

• It seems like you're asking an algorithms question - in which case you'd get better answers over at SO instead. – B. Mehta May 8 '18 at 1:14
• Sure I'll give it a shot. – rhaskett May 8 '18 at 1:16
• The cost function I see is plainly sum of functions each depending on a single (and unique) coordinate. If that is it, it may perfectly well be optimized coordinate-wise. And, by the way, why this is tagged 'non-convex optimization'? ;) – metamorphy May 8 '18 at 1:40
• @rhaskett: You might also want to take a look at this. – VHarisop May 8 '18 at 1:52
• Minimizing absolute value is expressible as a linear problem: $x\geq |y|$ is the same as $x\geq y \geq -x$. The square can be handled with a second-order cone. – Michal Adamaszek May 8 '18 at 6:54