New Reply

Minimizing Sum of Absolute Values

 
Share Thread
Feb16-11, 03:37 AM   #18
 

Minimizing Sum of Absolute Values


Quote by dharapmihir View Post
...But it will be at some critical point provided that all the terms in the absolute value are linear.
What is the reasoning for this?
Feb16-11, 06:57 AM   #19
 
Mentor
Blog Entries: 10
Quote by adoado View Post
What is the reasoning for this?
Between each adjacent pair of critical points, the function is linear. Therefore, no minima or maxima will lie between the critical points -- unless the slope happens to be zero, which is possible.
Feb16-11, 07:41 AM   #20
 
@Redbelly98 : Exactly what I want to say
Feb16-11, 07:49 AM   #21
 
Mentor
Blog Entries: 10
No problem.

Here's a representative graph. (Ignore the zj-1, etc. This comes from a google image search and I took the best graph I could find):
In general, the minimum could be at any one of the critical points. In some special cases, there could be a horizontal line for part of the function -- but even then evaluating the function only at the critical points will yield the minimum value.
Feb16-11, 08:09 AM   #22
 
Awesome, thanks everybody for your help! That answers the question!
Feb22-11, 02:21 AM   #23
 
I recently encountered another problem, but it extends this topic. Instead of opening a new thread I guess this place is as good as any..

If one defines the function [tex]E=|1-x-y| + |4-2x-y| ...[/tex] how can I find it's minimum now (x and y coordinates)? Can this be extended to N variables inside each absolute value? Each absolute value will be linear... I am not sure if the above answer can be generalized to suit this problem?

Any ideas?

Cheers,
Adrian
Feb22-11, 06:44 AM   #24
 
Mentor
Blog Entries: 10
If there are just two terms for E, then find x and y so that both terms are zero.

If there are more than two terms for E, I will have to think about it some more.
Feb22-11, 07:18 AM   #25
 
Mentor
Blog Entries: 10
Okay, I've got it.

You need to consider all possible pairs of expressions, and find (x,y) where both terms in the pair equal zero.

Then evaluate E at all such points, and take the minimum.

So if E has three terms, there are 3 ways to pair up the terms.
If E has four terms, there are 6 ways to pair them up.
Etc.

If that's not clear, let me know.
Feb22-11, 08:31 AM   #26
 
If that's not clear, let me know.
I am not sure the reasoning to it, or exactly what you mean Able to elaborate on the reasoning of this?

Cheers!
Adrian
Feb22-11, 09:42 AM   #27
 
Mentor
Blog Entries: 10
Okay.

First, consider just one absolute value expression,
z=|ax + by + c|.
The line defined by ax+by+c = 0 divides the xy plane into two regions. In one region, the absolute value argument is positive and
z = ax+by+c
On the other side of the line ax+by+c=0, the absolute value argument is negative and
z = -ax-by-c.
So the graph of z is of two tilted half-planes that meet along the line ax+by+c=0. Hopefully you can visualize that.

Next consider several absolute value expressions,
z = |a1x + b1y + c1| + |a2x + b2y + c2| + ...
Setting each absolute value argument aix + biy + ci=0, we get several intersecting lines in the xy plane, dividing the xy plane into distinct regions as shown in this figure:
Within each region, the graph of z(x,y) is of a tilted plane. Each region is described by a different plane, and adjacent planes intersect along one of the lines. The entire graph resembles a polyhedral surface, and the minimum of the function must occur at one of the vertices of the "polyhedron", namely at an intersection of a pair of lines.

So you have to find the intersection of each pair of lines, and evaluate z(x,y) at all such intersection points.
Feb23-11, 06:37 AM   #28
 
Awesome, thanks a lot Redbelly! Really appreciate that! :)
Jul21-12, 11:33 PM   #29
 
Quote by adoado View Post
Hello all,

I am trying to solve a problem based on some computer programming task I am trying to solve, and I have encountered a situation I am having trouble continuing..

Given a function f(x)=|1-x| + |0.5-2x| ...

How can I find it's minimum efficiently? This sum may extend to 4 or 5 more absolute values. I can try using calculus, but I found the derivative was messy, and I was not sure how to find it's zeros.

P.S. LaTeX seemed to be stuffing up, it would never update in the preview box?

Any help greatly appreciated!

Cheers,
Adrian
Given [itex]f(x) = \sum_{i}|a_{i}x+b_i|[/itex], you can use a convex optimization solver as [itex]f(x)[/itex] is a convex function.

Without plodding through a convex solver manual, one can efficiently find the minimum point using the below method:
  1. Compute all knee point coordinates of each absolute term, i.e. [itex]x_i = -\frac{b_i}{a_i}[/itex]. The knee point is where the sharp vertex is if each absolute term is plotted on its own.
  2. Create an array of structures (if you are using either C or MATLAB to program), where each entry is associated with each absolute term, containing the knee point coordinate and the absolute slope [itex]|a_i|[/itex].
  3. Sort the array according to knee point coordinates, in ascending order.
  4. When [itex]x=-\infty[/itex], the slope of [itex]f(x)[/itex] is [itex]-\sum_{i}|a_i|[/itex].
  5. Run through the array of structure to compute the new slope at each knee point. This can be done by adding the current [itex]|a_i|[/itex] in each array element to the current running slope of [itex]f(x)[/itex].
  6. The minimum point of [itex]f(x)[/itex] is reached when the current running slope reaches 0. The associated solution [itex]x^{*}[/itex] is given by the knee point coordinate of the entry in the array where the algorithm terminates.

The above algorithm has an overall runtime complexity of [itex]O(n\log{n})[/itex], due to the sorting procedure in step (3). It would be good if somebody can introduce an algorithm which runs in linear time .

Quote by adoado View Post
I recently encountered another problem, but it extends this topic. Instead of opening a new thread I guess this place is as good as any..

If one defines the function [tex]E=|1-x-y| + |4-2x-y| ...[/tex] how can I find it's minimum now (x and y coordinates)? Can this be extended to N variables inside each absolute value? Each absolute value will be linear... I am not sure if the above answer can be generalized to suit this problem?

Any ideas?

Cheers,
Adrian
Once again the objective is convex hence a convex solver can be applied.

Otherwise, the above algorithm can be adapted for the case of [itex]f(\vec{x})= \sum_{i}|\vec{a_{i}}^{T}\vec{x}+b_i|[/itex], by holding all but one variable in [itex]\vec{x}[/itex] as constant. The algorithm has to be applied repeatedly to every variable in a round robin fashion. Convergence is guaranteed, but I cannot put a bound on the number of iterations required. A good initial value for [itex]\vec{x}[/itex] to start the iteration is [itex]-A^{\dagger}\vec{b}[/itex], where the rows of [itex]A[/itex] are [itex]\vec{a_{i}}^{T}[/itex], and the entries of [itex]\vec{b}[/itex] are [itex]b_i[/itex].

An algorithm which jointly optimizes for all variables in [itex]\vec{x}[/itex] is welcomed.
Jul22-12, 03:00 AM   #30
 
Would it be possible to find the minimum by squaring the function inside the absolute value signs then carrying out the necessary steps to find a minnima/maxima? I think this should work for any polynomial, not sure about other functions though.
Jul22-12, 03:55 AM   #31
 
Quote by Aero51 View Post
Would it be possible to find the minimum by squaring the function inside the absolute value signs then carrying out the necessary steps to find a minnima/maxima? I think this should work for any polynomial, not sure about other functions though.
The solution obtained using this method will not be the same as that in the original formulation, though it may possibly be close.
Jul22-12, 08:15 AM   #32
 
Quote by adoado View Post
I recently encountered another problem, but it extends this topic. Instead of opening a new thread I guess this place is as good as any..

If one defines the function [tex]E=|1-x-y| + |4-2x-y| ...[/tex] how can I find it's minimum now (x and y coordinates)? Can this be extended to N variables inside each absolute value? Each absolute value will be linear... I am not sure if the above answer can be generalized to suit this problem?

Any ideas?

Cheers,
Adrian
If you have access to a linear programming package, problems of this type can be solved by linear programming. In the above problem, we would reformulate the problem as follows:

minimize a + b + c + d
subject to
a - b = 1 - x - y
c - d = 4 - 2x - y
a, b, c, d >= 0

The trick is that if [itex]1 - x - y \ge 0[/itex], then [itex]a = 1 - x - y[/itex] and [itex]b = 0[/itex]; otherwise [itex]a = 0[/itex] and [itex]b = - (1 - x - y)[/itex]. So [itex]a + b = |1 - x - y|[/itex] in all cases.
You might think that other solutions are possible-- for example, if [itex]1 - x - y = 2[/itex], then [itex]a = 3[/itex] and [itex]b = 1[/itex] seems to be an alternative solution that would mess things up. But this will never happen if you are using the Simplex Algorithm, because it is guaranteed to always find a solution at a vertex of the feasible polyhedron. At least one of [itex]a[/itex] and [itex]b[/itex] will always be zero.
Jul22-12, 02:04 PM   #33
 
The solution obtained using this method will not be the same as that in the original formulation, though it may possibly be close.
Why? If you square the function and find the zeros, these points should correspond to where a derivative does not exist in the original function. Take a-x, for example, if you calculate the 0 point of (a-x)^2 you get a double root at x=a, consistent with the original formula. Squaring any higher order polynomial inside the absolute value function will still have roots at the location where the original function has no derivative. You can use this information to more quickly find the max/min of an absolute value function.
Aug6-12, 01:54 AM   #34
 
Quote by Aero51 View Post
Why? If you square the function and find the zeros, these points should correspond to where a derivative does not exist in the original function. Take a-x, for example, if you calculate the 0 point of (a-x)^2 you get a double root at x=a, consistent with the original formula. Squaring any higher order polynomial inside the absolute value function will still have roots at the location where the original function has no derivative. You can use this information to more quickly find the max/min of an absolute value function.
This method works if [itex]f(x)[/itex] comprises of a single absolute term. If there are two or more terms, i.e. [itex]f(x,y) = |2x-y+3|+|x+3y+1| + |x-y+6|[/itex], the optimal solution which minimizes [itex]f[/itex] is not the same as [itex]g(x,y) = (2x-y+3)^2+(x+3y+1)^2 +(x-y+6)^2[/itex], simply because there is no way to transform the second equation to the first.
New Reply

Similar Threads for: Minimizing Sum of Absolute Values
Thread Forum Replies
Absolute values Precalculus Mathematics Homework 5
Absolute values General Math 4
Absolute Values Precalculus Mathematics Homework 5
Help On Absolute Values Introductory Physics Homework 3
Absolute values Introductory Physics Homework 12