Linear Programming - Separation of Points

In summary: I get the solution a=-1, b=0, d=0. The resulting line y = -x passes exactly through points Q but misses points P and has positive (absolute) errors at point P. Thus, whatever your d may be, it is NOT the maximum absolute error!
  • #1
lockedup
70
0

Homework Statement


I made this problem up as an example for a bigger problem I have to do. P = {(-2,4),(1,3)} and Q = {(-1,1),(0,0)}. I need to use linear programming to find the best line to go between them.

Homework Equations


Max d
subject to:
y[itex]_{i}[/itex]≥ax[itex]_{i}[/itex]+b+d (for all points above the line (P))
y[itex]_{i}[/itex]≤ax[itex]_{i}[/itex]+b-d (for all points below the line (Q))

The Attempt at a Solution


Max d
subject to:
4≥-2a+b+d
3≥ a+b+d
1≤ -a+b-d
0≤ b-d

I put this into Excel (the file is attached) and it's telling me that it is not feasible. I'm trying to do the Simplex Algorithm by hand but it is taking forever. I'm thinking that maybe I don't have it set up right in Excel. Any suggestions? Thanks in advance for any help you all can give!
 

Attachments

  • separation of points.xls
    17.5 KB · Views: 191
Physics news on Phys.org
  • #2
lockedup said:

Homework Statement


I made this problem up as an example for a bigger problem I have to do. P = {(-2,4),(1,3)} and Q = {(-1,1),(0,0)}. I need to use linear programming to find the best line to go between them.

Homework Equations


Max d
subject to:
y[itex]_{i}[/itex]≥ax[itex]_{i}[/itex]+b+d (for all points above the line (P))
y[itex]_{i}[/itex]≤ax[itex]_{i}[/itex]+b-d (for all points below the line (Q))

The Attempt at a Solution


Max d
subject to:
4≥-2a+b+d
3≥ a+b+d
1≤ -a+b-d
0≤ b-d

I put this into Excel (the file is attached) and it's telling me that it is not feasible. I'm trying to do the Simplex Algorithm by hand but it is taking forever. I'm thinking that maybe I don't have it set up right in Excel. Any suggestions? Thanks in advance for any help you all can give!

I assume you want to minimize the maximum vertical distance from the line to the four points. The absolute distance between point P1=(-2,4) and line y = ax + b is 4 - a(-2)-b, and you want the max absolute deviation z to be at least that large, so you need z >= 4+2a-b or z -2a+b>= 4; this is different from your first constraint (my z = your d). Use similar reasoning for the other three points, then minimize z. I get a perfectly well-defined optimal solution.

RGV
 
  • #3
Ray Vickson said:
I assume you want to minimize the maximum vertical distance from the line to the four points. The absolute distance between point P1=(-2,4) and line y = ax + b is 4 - a(-2)-b, and you want the max absolute deviation z to be at least that large, so you need z >= 4+2a-b or z -2a+b>= 4; this is different from your first constraint (my z = your d). Use similar reasoning for the other three points, then minimize z. I get a perfectly well-defined optimal solution.

RGV
I'm really sorry. I've read your post a hundred times and I don't understand what you're trying to say. It seems like you just rewrote z in terms of my first constraint. ?
 
  • #4
Well, you say that when you run your formulation you get a signal that the problem is infeasible, However, when I run your formulation (with the added constraint d >= 0) i get the solution a=-1, b=0, d=0. The resulting line y = -x passes exactly through points Q but misses points P and has positive (absolute) errors at point P. Thus, whatever your d may be, it is NOT the maximum absolute error!

For point P1 = (-2,4) the error is 4 - [a*(-2)+b], and assuming the line lies below (-2,4), this is *also* the absolute error at P1. At P2 = (1,3) the (absolute) error is 3 - [a*1+b]. At Q1=(-1,1) the absolute error is [a*(-1) + b]-1 (because Q1 lies above the line) and at Q2 = (0,0) the absolute error is [a*0+b]-0. To get the minimum of the largest absolute error, we just need to minimize a variable, z (or d, or whatever), subject to z being >= all the individual absolute errors; minimizing z will slam z down until it reaches one of the absolute errors, and since z is >= all of them, it will equal the largest of them; furthermore, this largest will be forced to be a small as possible, because a and b are adjusted to give the minimum possible value. So, the problem is:
min z,
subject to
z >= 4 +2a-b (from P1),
z >= 3-a-b (from P2),
z >= -a+b-1 (from Q1),
z >= b (from Q2)

This problem has optimal solution a = -1/3, b = 5/3, z = 5/3, so I get the line y = 5/3 - x/3. (Note that when using an LP package on this problem we need to permit negative values of a and/or b.)

RGV
 
  • #5
Ray Vickson said:
Well, you say that when you run your formulation you get a signal that the problem is infeasible, However, when I run your formulation (with the added constraint d >= 0) i get the solution a=-1, b=0, d=0. The resulting line y = -x passes exactly through points Q but misses points P and has positive (absolute) errors at point P. Thus, whatever your d may be, it is NOT the maximum absolute error!

For point P1 = (-2,4) the error is 4 - [a*(-2)+b], and assuming the line lies below (-2,4), this is *also* the absolute error at P1. At P2 = (1,3) the (absolute) error is 3 - [a*1+b]. At Q1=(-1,1) the absolute error is [a*(-1) + b]-1 (because Q1 lies above the line) and at Q2 = (0,0) the absolute error is [a*0+b]-0. To get the minimum of the largest absolute error, we just need to minimize a variable, z (or d, or whatever), subject to z being >= all the individual absolute errors; minimizing z will slam z down until it reaches one of the absolute errors, and since z is >= all of them, it will equal the largest of them; furthermore, this largest will be forced to be a small as possible, because a and b are adjusted to give the minimum possible value. So, the problem is:
min z,
subject to
z >= 4 +2a-b (from P1),
z >= 3-a-b (from P2),
z >= -a+b-1 (from Q1),
z >= b (from Q2)

This problem has optimal solution a = -1/3, b = 5/3, z = 5/3, so I get the line y = 5/3 - x/3. (Note that when using an LP package on this problem we need to permit negative values of a and/or b.)

RGV

Sorry: I meant to say that Q1 lies *below* the line (as does Q2). I would have edited the post if I could find an "edit" button, but this now seems to be gone!

RGV
 
  • #6
You're going to think I'm really dumb but I figured out what I was doing wrong. I did not use the right cells for my constraints in the solver.
 
  • #7
lockedup said:
You're going to think I'm really dumb but I figured out what I was doing wrong. I did not use the right cells for my constraints in the solver.

That is a common type of mistake, which is why when I was teaching I always strongly advised my students to use _names_. For example, if you have a block of variable cells in Solver, you can give them a name, such as 'Vars'. Then you can just type the word Vars in the variable cells menu tab. This makes model development easier and helps to avoid errors; also, it makes it easy to do absolute addressing, so you don't need to use the $ sign to pin down row or column locations.

RGV
 

1. What is Linear Programming?

Linear programming is a mathematical method used to optimize a system with linear constraints. It involves finding the maximum or minimum value of a linear objective function, subject to a set of linear constraints.

2. What is Separation of Points in Linear Programming?

Separation of points is a technique used to solve linear programming problems by dividing the solution space into two regions: feasible and infeasible. This helps to determine the optimal solution by eliminating any infeasible solutions.

3. How is Separation of Points used in Linear Programming?

Separation of points is used to identify the boundaries of the feasible region in a linear programming problem. By finding the intersections of the constraints, we can determine the feasible region and narrow down the search for the optimal solution.

4. What are the key assumptions made in Linear Programming?

The key assumptions in Linear Programming include proportionality (the objective function and constraints are linear), additivity (the objective function is a sum of individual terms), and divisibility (the solution can take on any value within the feasible region).

5. What are some real-world applications of Linear Programming - Separation of Points?

Linear Programming - Separation of Points has many real-world applications, including resource allocation, production planning, transportation and logistics, financial planning, and scheduling. It is used in industries such as manufacturing, agriculture, finance, and transportation to optimize processes and make efficient decisions.

Similar threads

  • Calculus and Beyond Homework Help
Replies
1
Views
284
  • Calculus and Beyond Homework Help
Replies
11
Views
1K
  • Calculus and Beyond Homework Help
Replies
5
Views
1K
Replies
3
Views
1K
  • Calculus and Beyond Homework Help
Replies
3
Views
1K
  • Calculus and Beyond Homework Help
Replies
10
Views
2K
  • Calculus and Beyond Homework Help
Replies
1
Views
1K
  • Calculus and Beyond Homework Help
Replies
2
Views
1K
  • Calculus and Beyond Homework Help
Replies
4
Views
1K
  • Calculus and Beyond Homework Help
Replies
5
Views
1K
Back
Top