Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Linearprogramming conditions are unknown

1 Ansicht (letzte 30 Tage)
NIKLAS EHLERT
NIKLAS EHLERT am 6 Jan. 2020
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
Hello there, I need help figuring out how to set the paremeters for this specific linear programming problem:
including the function for L, and the conditions A, b ,Aeq, beq.
(whichever conditions I might have))
My thoughtprocess so far is that there is only one ineqality condition:
lb < L < ub ( lb = 0, ub = random integer)
f = abs(sum( m - L ));
A = [];
b = [];
Aeq = [];
beq = [];
lb = 0;
ub = j;
Sets are empty because I dont know how to discribe the parameters.
All information I do have is in the Text below.
the "easy" way to calculate L is to take the mean(m), but I must not use anything different then an optiization tool.
L = distance from the "Main Station" to the start of the Line ( point 0), which needs to be optimized.
% A railway line has n stations, with n 2. Each of the stations is at points xj 2 R,
% where j = 1; 2; : : : ; n, and the two ends of the line correspond to x1 and xn,
% respectively. We will assume that the following sequence x1 < x2 < < xn holds.
% It is desired to locate the railway trac management center of that line at a point
% xc 2 [x1; xn] so that the total sum of the distances from the management center
% to each of the stations is minimal. Determine at which point/points xc 2 [x1; xn],
% along the railway line, should the trac management center be located and nd
% the minimum value of the distance in terms of the positions xj of the stations.
Thanks for your time, I hope this is not to much to ask for.
It would already help if you see any mayor mistake and point it out so I can specify my question more.
  1 Kommentar
Matt J
Matt J am 6 Jan. 2020
the "easy" way to calculate L is to take the mean(m)
I think you mean median(m), since the objective is a sum of absolute values, not a sum of squares.

Antworten (1)

Matt J
Matt J am 6 Jan. 2020
Bearbeitet: Matt J am 6 Jan. 2020
As I mentioned in your previous post, you want to set up the following equivalent LP,
I don't think it should be a difficult exercise to write the A,b matrices required by linprog. However, you may also want to consider the problem-based approach to setting up a linear program.
  1 Kommentar
NIKLAS EHLERT
NIKLAS EHLERT am 7 Jan. 2020
Bearbeitet: NIKLAS EHLERT am 7 Jan. 2020
Edit:
So I just randomly used the fminbnd, solver and it works. (I guess)
j = randi([1 1000]);
n = randi([2 20]);
m = randi([j],n,1);
m(1) = 0;
m(n) = j;
m = unique(m);
m = sort(m);
fun = @(L) abs(sum(m - L));
L = fminbnd(fun,0,j)
so ill use this now.
Edit,end
Hey Matt,
thanks for sticking with me.
Honestly its not that easy for me, converting text to Math-expressions and then to code is hard just beginning this journey.
Is it rude to ask for further help?
Trying to figure out what you mean:
L = distance to 0, but what is its function? ( 0+L ; doesn't make sense, i need to solve for L but my programm wants an input before, do I need to make 2 functions and import one into the other?)
r = function for sum, r = abs(sum(m-L)) ; where i ist the number of iterations?
constrains are:
0 < L < j
-sum(max L) < sum(m-L) < +sum(min L) (???)
what do the A and b look like?
n = number of stations (size of m)
A = ones([n,1])
b = ??? ; which constrains belong here?
I dont even know if these are A,b or Aeq,beq ; for not knowing if they are equal or not and if it makes a difference.
Thanks for youre time.
Cheers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by