Linear Programming: Minimizing Vertical Distance to Line

Click For Summary

Homework Help Overview

The discussion revolves around formulating a linear programming problem to minimize the vertical distance between a set of points on a plane and a line with specific constraints, including a positive gradient and y-intercept, while ensuring all points lie below the line.

Discussion Character

  • Exploratory, Problem interpretation, Assumption checking

Approaches and Questions Raised

  • The original poster attempts to define the problem by suggesting the use of a linear function and minimizing the difference between the function value and the y-coordinates of the points. Some participants question how to set up the problem in MATLAB and whether the gradient or derivative is necessary for the solution.

Discussion Status

Participants are exploring various aspects of the problem, including the formulation of the linear function and the constraints involved. There is a mix of attempts to clarify the setup in MATLAB and discussions about the mathematical concepts required, but no consensus has been reached on a specific approach.

Contextual Notes

Some participants express uncertainty about their MATLAB skills and the specific requirements for the linear programming setup, indicating a need for further clarification on constraints and the formulation of the problem.

morry
Messages
136
Reaction score
0
Ok, I hope this is the right section.

I have a problem that I can't even start. I have a set of points on a plane. I need to formulate a linear program so that the vertical distance between each point and a line is minimised. The line must have a positive gradient, positive y-intercept and each point must be below the line.

I have no idea what I am doing. Can anyone point me in the right direction?
Cheers.
 
Physics news on Phys.org
Hmm, so how would I go about setting this up so I could solve it using matlab?
thanks for the help.
 
Could I let x=[1,2,3,4,5 etc] and y=[5,4,3,2,1 etc] ie the points I am given.

Then make some function Y=mx+c? And I want to minimise Y-y.

Am I on the right track here?
 
Enuma Elish,

While we do appreciate the work that you put into the homework help section of PF, it is nonetheless contrary to the Physics Forums Guidelines (which you agreed to) to post complete solutions to problems, or to offer assistance to students who have not shown some attempt at the problem. I have therefore soft deleted your post, and will restore it once this thread is resolved.

Helping someone with homework is great. Doing someone's homework is not OK.

Tom
 
make some function Y=mx+c? And I want to minimise Y-y.
That's correct but incomplete.
 
Ok, so I create that linear function, add the rest of the constraints.

What I don't understand is how to get MATLAB to find the gradient. Is it just a matter of making m a variable too?

I think I get this, but I am not quite there.

Thanks for the help again Enuma. :)
 
Do you really need the gradient, or do you just need the derivative of the line?

If it's the second, look up finite difference approximations (Taylor series expansion with higher order terms discarded)
 
Well, the question asks me to find the equation for the line. Its a straight line, so I suppose the derivative is the gradient.

Doing a Taylor series sounds a bit extreme, all I am asked to do it formulate a linear program.

Ill have a crack and see what I can do.

Thanks enigma.
 
Taylor series with one term is nothing more than a secant approximation. Find two points close together. Compute rise over run. Viola. Looking up finite difference approximation methods give you some ways to do it to minimize error
 
  • #10
Hmm, ok I think I can write the problem down correctly.

But I have no idea how to solve it using matlab. The only examples of these problems are the min f(x)=x1+x2 etc with constraints x1>2 etc.

I am a retard at matlab.

Heres what I just tried:
x=[1,2,3,5,7,9]
y=[4,7,9,17,9,14]

syms X
syms Y
Y=mX+c (I have no idea how to write this equation out)
How can I put in the constraints c>0, m>0, Y>y?

Cheers.
 

Similar threads

  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
Replies
12
Views
5K
  • · Replies 6 ·
Replies
6
Views
3K
Replies
7
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K