How to formulate LP for shortest path problems?
$begingroup$
I am trying to understand how LP formulaton for shortest path problem. However I'm having trouble understanding constrains. Why this formulation work?
http://ie.bilkent.edu.tr/~ie400/Lecture8.pdf
I am having trouble understanding how the constraints work at pages 15 and 17. I got the main idea and I understand how and why $x$ should take some values but I did not understand how the whole system works in terms of math. Can someone ELI5? In the exam, I am supposed to be able to create and modify such constraints but I am pretty far from doing that.
linear-programming integer-programming
$endgroup$
add a comment |
$begingroup$
I am trying to understand how LP formulaton for shortest path problem. However I'm having trouble understanding constrains. Why this formulation work?
http://ie.bilkent.edu.tr/~ie400/Lecture8.pdf
I am having trouble understanding how the constraints work at pages 15 and 17. I got the main idea and I understand how and why $x$ should take some values but I did not understand how the whole system works in terms of math. Can someone ELI5? In the exam, I am supposed to be able to create and modify such constraints but I am pretty far from doing that.
linear-programming integer-programming
$endgroup$
add a comment |
$begingroup$
I am trying to understand how LP formulaton for shortest path problem. However I'm having trouble understanding constrains. Why this formulation work?
http://ie.bilkent.edu.tr/~ie400/Lecture8.pdf
I am having trouble understanding how the constraints work at pages 15 and 17. I got the main idea and I understand how and why $x$ should take some values but I did not understand how the whole system works in terms of math. Can someone ELI5? In the exam, I am supposed to be able to create and modify such constraints but I am pretty far from doing that.
linear-programming integer-programming
$endgroup$
I am trying to understand how LP formulaton for shortest path problem. However I'm having trouble understanding constrains. Why this formulation work?
http://ie.bilkent.edu.tr/~ie400/Lecture8.pdf
I am having trouble understanding how the constraints work at pages 15 and 17. I got the main idea and I understand how and why $x$ should take some values but I did not understand how the whole system works in terms of math. Can someone ELI5? In the exam, I am supposed to be able to create and modify such constraints but I am pretty far from doing that.
linear-programming integer-programming
linear-programming integer-programming
edited Dec 27 '16 at 21:26
GNUSupporter 8964民主女神 地下教會
14k82651
14k82651
asked Nov 30 '15 at 12:32
mmswemmswe
12619
12619
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
The variable $$x_{ij}=
begin{cases}
1 &mbox{if the shortest path contains } i to j,\
0 &mbox{otherwise.}
end{cases}$$
In P.12, there's a formula for calculating the amount of flows at each single node $i$.
begin{align}
b(i) &= mbox{Amount of outgoing flow from $i$} - mbox{Amount of incoming flow to $i$} \
&= sum_j x_{ij} - sum_k x_{ki}
end{align}
Since we're finding the minimum distance, an object will travel from the start until the end, and it won't disappear in the middle. Therefore, to simplify matters, we will assume that the amount of object is 1. If you draw a graph, you will realize that in the shortest path,
$$b(i) = begin{cases}
1 &mbox{if $i$ is the starting node,} \
-1 &mbox{if $i$ is the ending node,} \
0 &mbox{otherwise.}
end{cases}$$
In P.15, at the start (node 1), there's no incoming flow, so $x_{j1} = 0 ;forall j$, $x_{12} = 1$, and $x_{1j} = 0 ;forall j ne 2$.
$s$ and $t$ denotes the indices for the source and the target respectively. In P.15, $s = 1$ and $t = 6$. The constraints are just the equations for $b(i)$ for each node $i$.
In P.17, there's $n ,(=6)$ nodes. We choose one of them to be the supplier (node 1), and all others are clients. We calculate the total shortest path. (i.e. We find the minimal distance from each path, and we sum them together, but we can just sum these $n-1$ paths up so as to formulate the problem as one single LPP.) Each client demands one object from the supplier, so $b(s) = n - 1$. I hope at this stage, you'll understand what is meant by "a demand
of 1 unit at all other nodes" in the notes, and conclude that $b(i) = -1 ,forall i ne s$.
$endgroup$
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f1553074%2fhow-to-formulate-lp-for-shortest-path-problems%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
The variable $$x_{ij}=
begin{cases}
1 &mbox{if the shortest path contains } i to j,\
0 &mbox{otherwise.}
end{cases}$$
In P.12, there's a formula for calculating the amount of flows at each single node $i$.
begin{align}
b(i) &= mbox{Amount of outgoing flow from $i$} - mbox{Amount of incoming flow to $i$} \
&= sum_j x_{ij} - sum_k x_{ki}
end{align}
Since we're finding the minimum distance, an object will travel from the start until the end, and it won't disappear in the middle. Therefore, to simplify matters, we will assume that the amount of object is 1. If you draw a graph, you will realize that in the shortest path,
$$b(i) = begin{cases}
1 &mbox{if $i$ is the starting node,} \
-1 &mbox{if $i$ is the ending node,} \
0 &mbox{otherwise.}
end{cases}$$
In P.15, at the start (node 1), there's no incoming flow, so $x_{j1} = 0 ;forall j$, $x_{12} = 1$, and $x_{1j} = 0 ;forall j ne 2$.
$s$ and $t$ denotes the indices for the source and the target respectively. In P.15, $s = 1$ and $t = 6$. The constraints are just the equations for $b(i)$ for each node $i$.
In P.17, there's $n ,(=6)$ nodes. We choose one of them to be the supplier (node 1), and all others are clients. We calculate the total shortest path. (i.e. We find the minimal distance from each path, and we sum them together, but we can just sum these $n-1$ paths up so as to formulate the problem as one single LPP.) Each client demands one object from the supplier, so $b(s) = n - 1$. I hope at this stage, you'll understand what is meant by "a demand
of 1 unit at all other nodes" in the notes, and conclude that $b(i) = -1 ,forall i ne s$.
$endgroup$
add a comment |
$begingroup$
The variable $$x_{ij}=
begin{cases}
1 &mbox{if the shortest path contains } i to j,\
0 &mbox{otherwise.}
end{cases}$$
In P.12, there's a formula for calculating the amount of flows at each single node $i$.
begin{align}
b(i) &= mbox{Amount of outgoing flow from $i$} - mbox{Amount of incoming flow to $i$} \
&= sum_j x_{ij} - sum_k x_{ki}
end{align}
Since we're finding the minimum distance, an object will travel from the start until the end, and it won't disappear in the middle. Therefore, to simplify matters, we will assume that the amount of object is 1. If you draw a graph, you will realize that in the shortest path,
$$b(i) = begin{cases}
1 &mbox{if $i$ is the starting node,} \
-1 &mbox{if $i$ is the ending node,} \
0 &mbox{otherwise.}
end{cases}$$
In P.15, at the start (node 1), there's no incoming flow, so $x_{j1} = 0 ;forall j$, $x_{12} = 1$, and $x_{1j} = 0 ;forall j ne 2$.
$s$ and $t$ denotes the indices for the source and the target respectively. In P.15, $s = 1$ and $t = 6$. The constraints are just the equations for $b(i)$ for each node $i$.
In P.17, there's $n ,(=6)$ nodes. We choose one of them to be the supplier (node 1), and all others are clients. We calculate the total shortest path. (i.e. We find the minimal distance from each path, and we sum them together, but we can just sum these $n-1$ paths up so as to formulate the problem as one single LPP.) Each client demands one object from the supplier, so $b(s) = n - 1$. I hope at this stage, you'll understand what is meant by "a demand
of 1 unit at all other nodes" in the notes, and conclude that $b(i) = -1 ,forall i ne s$.
$endgroup$
add a comment |
$begingroup$
The variable $$x_{ij}=
begin{cases}
1 &mbox{if the shortest path contains } i to j,\
0 &mbox{otherwise.}
end{cases}$$
In P.12, there's a formula for calculating the amount of flows at each single node $i$.
begin{align}
b(i) &= mbox{Amount of outgoing flow from $i$} - mbox{Amount of incoming flow to $i$} \
&= sum_j x_{ij} - sum_k x_{ki}
end{align}
Since we're finding the minimum distance, an object will travel from the start until the end, and it won't disappear in the middle. Therefore, to simplify matters, we will assume that the amount of object is 1. If you draw a graph, you will realize that in the shortest path,
$$b(i) = begin{cases}
1 &mbox{if $i$ is the starting node,} \
-1 &mbox{if $i$ is the ending node,} \
0 &mbox{otherwise.}
end{cases}$$
In P.15, at the start (node 1), there's no incoming flow, so $x_{j1} = 0 ;forall j$, $x_{12} = 1$, and $x_{1j} = 0 ;forall j ne 2$.
$s$ and $t$ denotes the indices for the source and the target respectively. In P.15, $s = 1$ and $t = 6$. The constraints are just the equations for $b(i)$ for each node $i$.
In P.17, there's $n ,(=6)$ nodes. We choose one of them to be the supplier (node 1), and all others are clients. We calculate the total shortest path. (i.e. We find the minimal distance from each path, and we sum them together, but we can just sum these $n-1$ paths up so as to formulate the problem as one single LPP.) Each client demands one object from the supplier, so $b(s) = n - 1$. I hope at this stage, you'll understand what is meant by "a demand
of 1 unit at all other nodes" in the notes, and conclude that $b(i) = -1 ,forall i ne s$.
$endgroup$
The variable $$x_{ij}=
begin{cases}
1 &mbox{if the shortest path contains } i to j,\
0 &mbox{otherwise.}
end{cases}$$
In P.12, there's a formula for calculating the amount of flows at each single node $i$.
begin{align}
b(i) &= mbox{Amount of outgoing flow from $i$} - mbox{Amount of incoming flow to $i$} \
&= sum_j x_{ij} - sum_k x_{ki}
end{align}
Since we're finding the minimum distance, an object will travel from the start until the end, and it won't disappear in the middle. Therefore, to simplify matters, we will assume that the amount of object is 1. If you draw a graph, you will realize that in the shortest path,
$$b(i) = begin{cases}
1 &mbox{if $i$ is the starting node,} \
-1 &mbox{if $i$ is the ending node,} \
0 &mbox{otherwise.}
end{cases}$$
In P.15, at the start (node 1), there's no incoming flow, so $x_{j1} = 0 ;forall j$, $x_{12} = 1$, and $x_{1j} = 0 ;forall j ne 2$.
$s$ and $t$ denotes the indices for the source and the target respectively. In P.15, $s = 1$ and $t = 6$. The constraints are just the equations for $b(i)$ for each node $i$.
In P.17, there's $n ,(=6)$ nodes. We choose one of them to be the supplier (node 1), and all others are clients. We calculate the total shortest path. (i.e. We find the minimal distance from each path, and we sum them together, but we can just sum these $n-1$ paths up so as to formulate the problem as one single LPP.) Each client demands one object from the supplier, so $b(s) = n - 1$. I hope at this stage, you'll understand what is meant by "a demand
of 1 unit at all other nodes" in the notes, and conclude that $b(i) = -1 ,forall i ne s$.
answered Dec 7 '15 at 8:57
community wiki
GNUSupporter 8964民主女神 地下教會
add a comment |
add a comment |
Thanks for contributing an answer to Mathematics Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f1553074%2fhow-to-formulate-lp-for-shortest-path-problems%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown