Solving an LP problem with an upper limit for the variables











up vote
0
down vote

favorite
2












enter image description here



Im trying to solve the Above LP. Now, can we apply just simplex considering that we can treat the upper bounds of the variables as constraints.



Meaning, we need to add $6$ slack variables, and it would be a bit harder to do the algorithm by hand. Now, the dual will give six variables as well, so it doesnt help much.



In my notes, it says to consider "bounded variable simplex method", but I haven't seen how this method works. how can we apply this method to solve this problem? Is it possible to solve it using the standard primal simplex?










share|cite|improve this question


















  • 1




    Here is a algorithm for Bounded Variables with examples.
    – callculus
    Nov 16 at 12:24










  • What more do you expect from an answer than the algorithm callculus linked to?
    – LinAlg
    Nov 18 at 13:57










  • LinAlg The example in the link is different than my problem. I dont see a way to apply what is on this link to this actual problem.
    – Jimmy Sabater
    Nov 19 at 7:51










  • Could you add to your question where you get stuck? The examples on pages 5-8 seem to cover your needs.
    – LinAlg
    Nov 19 at 14:28

















up vote
0
down vote

favorite
2












enter image description here



Im trying to solve the Above LP. Now, can we apply just simplex considering that we can treat the upper bounds of the variables as constraints.



Meaning, we need to add $6$ slack variables, and it would be a bit harder to do the algorithm by hand. Now, the dual will give six variables as well, so it doesnt help much.



In my notes, it says to consider "bounded variable simplex method", but I haven't seen how this method works. how can we apply this method to solve this problem? Is it possible to solve it using the standard primal simplex?










share|cite|improve this question


















  • 1




    Here is a algorithm for Bounded Variables with examples.
    – callculus
    Nov 16 at 12:24










  • What more do you expect from an answer than the algorithm callculus linked to?
    – LinAlg
    Nov 18 at 13:57










  • LinAlg The example in the link is different than my problem. I dont see a way to apply what is on this link to this actual problem.
    – Jimmy Sabater
    Nov 19 at 7:51










  • Could you add to your question where you get stuck? The examples on pages 5-8 seem to cover your needs.
    – LinAlg
    Nov 19 at 14:28















up vote
0
down vote

favorite
2









up vote
0
down vote

favorite
2






2





enter image description here



Im trying to solve the Above LP. Now, can we apply just simplex considering that we can treat the upper bounds of the variables as constraints.



Meaning, we need to add $6$ slack variables, and it would be a bit harder to do the algorithm by hand. Now, the dual will give six variables as well, so it doesnt help much.



In my notes, it says to consider "bounded variable simplex method", but I haven't seen how this method works. how can we apply this method to solve this problem? Is it possible to solve it using the standard primal simplex?










share|cite|improve this question













enter image description here



Im trying to solve the Above LP. Now, can we apply just simplex considering that we can treat the upper bounds of the variables as constraints.



Meaning, we need to add $6$ slack variables, and it would be a bit harder to do the algorithm by hand. Now, the dual will give six variables as well, so it doesnt help much.



In my notes, it says to consider "bounded variable simplex method", but I haven't seen how this method works. how can we apply this method to solve this problem? Is it possible to solve it using the standard primal simplex?







linear-programming






share|cite|improve this question













share|cite|improve this question











share|cite|improve this question




share|cite|improve this question










asked Nov 16 at 7:11









Jimmy Sabater

1,831218




1,831218








  • 1




    Here is a algorithm for Bounded Variables with examples.
    – callculus
    Nov 16 at 12:24










  • What more do you expect from an answer than the algorithm callculus linked to?
    – LinAlg
    Nov 18 at 13:57










  • LinAlg The example in the link is different than my problem. I dont see a way to apply what is on this link to this actual problem.
    – Jimmy Sabater
    Nov 19 at 7:51










  • Could you add to your question where you get stuck? The examples on pages 5-8 seem to cover your needs.
    – LinAlg
    Nov 19 at 14:28
















  • 1




    Here is a algorithm for Bounded Variables with examples.
    – callculus
    Nov 16 at 12:24










  • What more do you expect from an answer than the algorithm callculus linked to?
    – LinAlg
    Nov 18 at 13:57










  • LinAlg The example in the link is different than my problem. I dont see a way to apply what is on this link to this actual problem.
    – Jimmy Sabater
    Nov 19 at 7:51










  • Could you add to your question where you get stuck? The examples on pages 5-8 seem to cover your needs.
    – LinAlg
    Nov 19 at 14:28










1




1




Here is a algorithm for Bounded Variables with examples.
– callculus
Nov 16 at 12:24




Here is a algorithm for Bounded Variables with examples.
– callculus
Nov 16 at 12:24












What more do you expect from an answer than the algorithm callculus linked to?
– LinAlg
Nov 18 at 13:57




What more do you expect from an answer than the algorithm callculus linked to?
– LinAlg
Nov 18 at 13:57












LinAlg The example in the link is different than my problem. I dont see a way to apply what is on this link to this actual problem.
– Jimmy Sabater
Nov 19 at 7:51




LinAlg The example in the link is different than my problem. I dont see a way to apply what is on this link to this actual problem.
– Jimmy Sabater
Nov 19 at 7:51












Could you add to your question where you get stuck? The examples on pages 5-8 seem to cover your needs.
– LinAlg
Nov 19 at 14:28






Could you add to your question where you get stuck? The examples on pages 5-8 seem to cover your needs.
– LinAlg
Nov 19 at 14:28












1 Answer
1






active

oldest

votes

















up vote
4
down vote



accepted
+150










Let's write down our simplex table, remembering our upper bounds for each variables.



begin{array}{|c|c|c|c|c|c|c|c|c|c|c|}hline
& x_1 & x_2 & x_3 & x_4 & x_5 & s & -z & RHS & text{ratio} &UB \ hline
-z & -2 & -4 & color{blue}{-7} & -1 & -5 & 0 & 1 & 0 & - & - \ hline
s & 3 & 5 & 11 & 2 & 7 & 1 & 0 & 10 & frac{10}{11} & 1 \ hline
end{array}



At the beginning, we are at $(x_1,x_2,x_3,x_4,x_5)=(0,0,0,0,0)$. The entering variable would be $x_3$. since the minimum ratio is less than the upper bound, we will do a regular simplex pivot updating.



begin{array}{|c|c|c|c|c|c|c|c|c|c|c|}hline
& x_1 & x_2 & x_3 & x_4 & x_5 & s & -z & RHS & text{ratio} &UB \ hline
-z & -frac1{11} & color{blue}{-frac9{11}} & 0 & frac3{11} & -frac6{11} & frac7{11} & 1 & frac{70}{11} & - & - \ hline
x_3 & frac3{11} & frac5{11} & 1 & frac2{11} & frac7{11} & frac1{11} & 0 & frac{10}{11} & 2 & 1 \ hline
end{array}



Upon doing the simplex update, we reach $(0,0,frac{10}{11},0,0)$. Our next entering variable is $x_2$. The difference from the previous step this time is the ratio is more than the upper bound. We will increment the $x_2$ by the upperbound amount, which is $1$. We will also update the RHS and mark $x_2$ as $bar{x}_2$ to indicate that it is now non-basic.



begin{array}{|c|c|c|c|c|c|c|c|c|c|c|}hline
& x_1 & bar{x}_2 & x_3 & x_4 & x_5 & s & -z & RHS & text{ratio} &UB \ hline
-z & -frac1{11} & -frac9{11} & 0 & frac3{11} & color{blue}{-frac6{11}} & frac7{11} & 1 & frac{79}{11} & - & - \ hline
x_3 & frac3{11} & frac5{11} & 1 & frac2{11} & frac7{11} & frac1{11} & 0 & frac{5}{11} & frac57 & 1 \ hline
end{array}



Now, we arrive at $(0,1,frac5{11},0,0)$. Our next entering variable is $x_5$, since the ratio is less than the upper bound, we do a regular simplex pivot updating.



begin{array}{|c|c|c|c|c|c|c|c|c|c|c|}hline
& x_1 & bar{x}_2 & x_3 & x_4 & x_5 & s & -z & RHS & text{ratio} &UB \ hline
-z & frac1{7} & -frac3{7} & frac67 & frac3{7} & 0 & frac5{7} & 1 & frac{53}{7} & - & - \ hline
x_5 & frac3{7} & frac5{7} & frac{11}7 & frac2{7} & 1 & frac1{7} & 0 & frac{5}{7} & - & - \ hline
end{array}



Now, we arrive at $(0,1,0,0,frac57)$. Upon checking the reduced cost, we can see that we are optimal with objective value $frac{53}{7}$.



R code to check the final solution:



> library(lpSolve)
> f.obj <- c(2,4,7,1,5)
> n = length(f.obj)
> f.con <- rbind(c(3,5,11,2,7), diag(n), -diag(n))
> f.dir <- rep('<=',2 * n+1 )
> f.rhs <- c(10,rep(1,n),rep(0,n))
> optimum <- lp(direction = "max", objective.in = f.obj, const.mat = f.con, const.dir = f.dir, const.rhs = f.rhs)
> optimum
Success: the objective function is 7.571429
> optimum$solution
[1] 0.0000000 1.0000000 0.0000000 0.0000000 0.7142857





share|cite|improve this answer























  • its very nice, thanks so much! I have a question though. At the beginning, you decide it to put all $x_i$ at $0$, which it at their lower bound. I assume this choice is arbitrary. You could have choosen say $x_1=x_2=1$ and the rest $0$ and this would still work, correct?
    – Jimmy Sabater
    Nov 22 at 2:26










  • Sure, just adjust accodingly.
    – Siong Thye Goh
    Nov 22 at 3:16










  • Can you help me with this question? math.stackexchange.com/questions/3007305/…
    – Jimmy Sabater
    Nov 22 at 4:41











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',
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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3000829%2fsolving-an-lp-problem-with-an-upper-limit-for-the-variables%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








up vote
4
down vote



accepted
+150










Let's write down our simplex table, remembering our upper bounds for each variables.



begin{array}{|c|c|c|c|c|c|c|c|c|c|c|}hline
& x_1 & x_2 & x_3 & x_4 & x_5 & s & -z & RHS & text{ratio} &UB \ hline
-z & -2 & -4 & color{blue}{-7} & -1 & -5 & 0 & 1 & 0 & - & - \ hline
s & 3 & 5 & 11 & 2 & 7 & 1 & 0 & 10 & frac{10}{11} & 1 \ hline
end{array}



At the beginning, we are at $(x_1,x_2,x_3,x_4,x_5)=(0,0,0,0,0)$. The entering variable would be $x_3$. since the minimum ratio is less than the upper bound, we will do a regular simplex pivot updating.



begin{array}{|c|c|c|c|c|c|c|c|c|c|c|}hline
& x_1 & x_2 & x_3 & x_4 & x_5 & s & -z & RHS & text{ratio} &UB \ hline
-z & -frac1{11} & color{blue}{-frac9{11}} & 0 & frac3{11} & -frac6{11} & frac7{11} & 1 & frac{70}{11} & - & - \ hline
x_3 & frac3{11} & frac5{11} & 1 & frac2{11} & frac7{11} & frac1{11} & 0 & frac{10}{11} & 2 & 1 \ hline
end{array}



Upon doing the simplex update, we reach $(0,0,frac{10}{11},0,0)$. Our next entering variable is $x_2$. The difference from the previous step this time is the ratio is more than the upper bound. We will increment the $x_2$ by the upperbound amount, which is $1$. We will also update the RHS and mark $x_2$ as $bar{x}_2$ to indicate that it is now non-basic.



begin{array}{|c|c|c|c|c|c|c|c|c|c|c|}hline
& x_1 & bar{x}_2 & x_3 & x_4 & x_5 & s & -z & RHS & text{ratio} &UB \ hline
-z & -frac1{11} & -frac9{11} & 0 & frac3{11} & color{blue}{-frac6{11}} & frac7{11} & 1 & frac{79}{11} & - & - \ hline
x_3 & frac3{11} & frac5{11} & 1 & frac2{11} & frac7{11} & frac1{11} & 0 & frac{5}{11} & frac57 & 1 \ hline
end{array}



Now, we arrive at $(0,1,frac5{11},0,0)$. Our next entering variable is $x_5$, since the ratio is less than the upper bound, we do a regular simplex pivot updating.



begin{array}{|c|c|c|c|c|c|c|c|c|c|c|}hline
& x_1 & bar{x}_2 & x_3 & x_4 & x_5 & s & -z & RHS & text{ratio} &UB \ hline
-z & frac1{7} & -frac3{7} & frac67 & frac3{7} & 0 & frac5{7} & 1 & frac{53}{7} & - & - \ hline
x_5 & frac3{7} & frac5{7} & frac{11}7 & frac2{7} & 1 & frac1{7} & 0 & frac{5}{7} & - & - \ hline
end{array}



Now, we arrive at $(0,1,0,0,frac57)$. Upon checking the reduced cost, we can see that we are optimal with objective value $frac{53}{7}$.



R code to check the final solution:



> library(lpSolve)
> f.obj <- c(2,4,7,1,5)
> n = length(f.obj)
> f.con <- rbind(c(3,5,11,2,7), diag(n), -diag(n))
> f.dir <- rep('<=',2 * n+1 )
> f.rhs <- c(10,rep(1,n),rep(0,n))
> optimum <- lp(direction = "max", objective.in = f.obj, const.mat = f.con, const.dir = f.dir, const.rhs = f.rhs)
> optimum
Success: the objective function is 7.571429
> optimum$solution
[1] 0.0000000 1.0000000 0.0000000 0.0000000 0.7142857





share|cite|improve this answer























  • its very nice, thanks so much! I have a question though. At the beginning, you decide it to put all $x_i$ at $0$, which it at their lower bound. I assume this choice is arbitrary. You could have choosen say $x_1=x_2=1$ and the rest $0$ and this would still work, correct?
    – Jimmy Sabater
    Nov 22 at 2:26










  • Sure, just adjust accodingly.
    – Siong Thye Goh
    Nov 22 at 3:16










  • Can you help me with this question? math.stackexchange.com/questions/3007305/…
    – Jimmy Sabater
    Nov 22 at 4:41















up vote
4
down vote



accepted
+150










Let's write down our simplex table, remembering our upper bounds for each variables.



begin{array}{|c|c|c|c|c|c|c|c|c|c|c|}hline
& x_1 & x_2 & x_3 & x_4 & x_5 & s & -z & RHS & text{ratio} &UB \ hline
-z & -2 & -4 & color{blue}{-7} & -1 & -5 & 0 & 1 & 0 & - & - \ hline
s & 3 & 5 & 11 & 2 & 7 & 1 & 0 & 10 & frac{10}{11} & 1 \ hline
end{array}



At the beginning, we are at $(x_1,x_2,x_3,x_4,x_5)=(0,0,0,0,0)$. The entering variable would be $x_3$. since the minimum ratio is less than the upper bound, we will do a regular simplex pivot updating.



begin{array}{|c|c|c|c|c|c|c|c|c|c|c|}hline
& x_1 & x_2 & x_3 & x_4 & x_5 & s & -z & RHS & text{ratio} &UB \ hline
-z & -frac1{11} & color{blue}{-frac9{11}} & 0 & frac3{11} & -frac6{11} & frac7{11} & 1 & frac{70}{11} & - & - \ hline
x_3 & frac3{11} & frac5{11} & 1 & frac2{11} & frac7{11} & frac1{11} & 0 & frac{10}{11} & 2 & 1 \ hline
end{array}



Upon doing the simplex update, we reach $(0,0,frac{10}{11},0,0)$. Our next entering variable is $x_2$. The difference from the previous step this time is the ratio is more than the upper bound. We will increment the $x_2$ by the upperbound amount, which is $1$. We will also update the RHS and mark $x_2$ as $bar{x}_2$ to indicate that it is now non-basic.



begin{array}{|c|c|c|c|c|c|c|c|c|c|c|}hline
& x_1 & bar{x}_2 & x_3 & x_4 & x_5 & s & -z & RHS & text{ratio} &UB \ hline
-z & -frac1{11} & -frac9{11} & 0 & frac3{11} & color{blue}{-frac6{11}} & frac7{11} & 1 & frac{79}{11} & - & - \ hline
x_3 & frac3{11} & frac5{11} & 1 & frac2{11} & frac7{11} & frac1{11} & 0 & frac{5}{11} & frac57 & 1 \ hline
end{array}



Now, we arrive at $(0,1,frac5{11},0,0)$. Our next entering variable is $x_5$, since the ratio is less than the upper bound, we do a regular simplex pivot updating.



begin{array}{|c|c|c|c|c|c|c|c|c|c|c|}hline
& x_1 & bar{x}_2 & x_3 & x_4 & x_5 & s & -z & RHS & text{ratio} &UB \ hline
-z & frac1{7} & -frac3{7} & frac67 & frac3{7} & 0 & frac5{7} & 1 & frac{53}{7} & - & - \ hline
x_5 & frac3{7} & frac5{7} & frac{11}7 & frac2{7} & 1 & frac1{7} & 0 & frac{5}{7} & - & - \ hline
end{array}



Now, we arrive at $(0,1,0,0,frac57)$. Upon checking the reduced cost, we can see that we are optimal with objective value $frac{53}{7}$.



R code to check the final solution:



> library(lpSolve)
> f.obj <- c(2,4,7,1,5)
> n = length(f.obj)
> f.con <- rbind(c(3,5,11,2,7), diag(n), -diag(n))
> f.dir <- rep('<=',2 * n+1 )
> f.rhs <- c(10,rep(1,n),rep(0,n))
> optimum <- lp(direction = "max", objective.in = f.obj, const.mat = f.con, const.dir = f.dir, const.rhs = f.rhs)
> optimum
Success: the objective function is 7.571429
> optimum$solution
[1] 0.0000000 1.0000000 0.0000000 0.0000000 0.7142857





share|cite|improve this answer























  • its very nice, thanks so much! I have a question though. At the beginning, you decide it to put all $x_i$ at $0$, which it at their lower bound. I assume this choice is arbitrary. You could have choosen say $x_1=x_2=1$ and the rest $0$ and this would still work, correct?
    – Jimmy Sabater
    Nov 22 at 2:26










  • Sure, just adjust accodingly.
    – Siong Thye Goh
    Nov 22 at 3:16










  • Can you help me with this question? math.stackexchange.com/questions/3007305/…
    – Jimmy Sabater
    Nov 22 at 4:41













up vote
4
down vote



accepted
+150







up vote
4
down vote



accepted
+150




+150




Let's write down our simplex table, remembering our upper bounds for each variables.



begin{array}{|c|c|c|c|c|c|c|c|c|c|c|}hline
& x_1 & x_2 & x_3 & x_4 & x_5 & s & -z & RHS & text{ratio} &UB \ hline
-z & -2 & -4 & color{blue}{-7} & -1 & -5 & 0 & 1 & 0 & - & - \ hline
s & 3 & 5 & 11 & 2 & 7 & 1 & 0 & 10 & frac{10}{11} & 1 \ hline
end{array}



At the beginning, we are at $(x_1,x_2,x_3,x_4,x_5)=(0,0,0,0,0)$. The entering variable would be $x_3$. since the minimum ratio is less than the upper bound, we will do a regular simplex pivot updating.



begin{array}{|c|c|c|c|c|c|c|c|c|c|c|}hline
& x_1 & x_2 & x_3 & x_4 & x_5 & s & -z & RHS & text{ratio} &UB \ hline
-z & -frac1{11} & color{blue}{-frac9{11}} & 0 & frac3{11} & -frac6{11} & frac7{11} & 1 & frac{70}{11} & - & - \ hline
x_3 & frac3{11} & frac5{11} & 1 & frac2{11} & frac7{11} & frac1{11} & 0 & frac{10}{11} & 2 & 1 \ hline
end{array}



Upon doing the simplex update, we reach $(0,0,frac{10}{11},0,0)$. Our next entering variable is $x_2$. The difference from the previous step this time is the ratio is more than the upper bound. We will increment the $x_2$ by the upperbound amount, which is $1$. We will also update the RHS and mark $x_2$ as $bar{x}_2$ to indicate that it is now non-basic.



begin{array}{|c|c|c|c|c|c|c|c|c|c|c|}hline
& x_1 & bar{x}_2 & x_3 & x_4 & x_5 & s & -z & RHS & text{ratio} &UB \ hline
-z & -frac1{11} & -frac9{11} & 0 & frac3{11} & color{blue}{-frac6{11}} & frac7{11} & 1 & frac{79}{11} & - & - \ hline
x_3 & frac3{11} & frac5{11} & 1 & frac2{11} & frac7{11} & frac1{11} & 0 & frac{5}{11} & frac57 & 1 \ hline
end{array}



Now, we arrive at $(0,1,frac5{11},0,0)$. Our next entering variable is $x_5$, since the ratio is less than the upper bound, we do a regular simplex pivot updating.



begin{array}{|c|c|c|c|c|c|c|c|c|c|c|}hline
& x_1 & bar{x}_2 & x_3 & x_4 & x_5 & s & -z & RHS & text{ratio} &UB \ hline
-z & frac1{7} & -frac3{7} & frac67 & frac3{7} & 0 & frac5{7} & 1 & frac{53}{7} & - & - \ hline
x_5 & frac3{7} & frac5{7} & frac{11}7 & frac2{7} & 1 & frac1{7} & 0 & frac{5}{7} & - & - \ hline
end{array}



Now, we arrive at $(0,1,0,0,frac57)$. Upon checking the reduced cost, we can see that we are optimal with objective value $frac{53}{7}$.



R code to check the final solution:



> library(lpSolve)
> f.obj <- c(2,4,7,1,5)
> n = length(f.obj)
> f.con <- rbind(c(3,5,11,2,7), diag(n), -diag(n))
> f.dir <- rep('<=',2 * n+1 )
> f.rhs <- c(10,rep(1,n),rep(0,n))
> optimum <- lp(direction = "max", objective.in = f.obj, const.mat = f.con, const.dir = f.dir, const.rhs = f.rhs)
> optimum
Success: the objective function is 7.571429
> optimum$solution
[1] 0.0000000 1.0000000 0.0000000 0.0000000 0.7142857





share|cite|improve this answer














Let's write down our simplex table, remembering our upper bounds for each variables.



begin{array}{|c|c|c|c|c|c|c|c|c|c|c|}hline
& x_1 & x_2 & x_3 & x_4 & x_5 & s & -z & RHS & text{ratio} &UB \ hline
-z & -2 & -4 & color{blue}{-7} & -1 & -5 & 0 & 1 & 0 & - & - \ hline
s & 3 & 5 & 11 & 2 & 7 & 1 & 0 & 10 & frac{10}{11} & 1 \ hline
end{array}



At the beginning, we are at $(x_1,x_2,x_3,x_4,x_5)=(0,0,0,0,0)$. The entering variable would be $x_3$. since the minimum ratio is less than the upper bound, we will do a regular simplex pivot updating.



begin{array}{|c|c|c|c|c|c|c|c|c|c|c|}hline
& x_1 & x_2 & x_3 & x_4 & x_5 & s & -z & RHS & text{ratio} &UB \ hline
-z & -frac1{11} & color{blue}{-frac9{11}} & 0 & frac3{11} & -frac6{11} & frac7{11} & 1 & frac{70}{11} & - & - \ hline
x_3 & frac3{11} & frac5{11} & 1 & frac2{11} & frac7{11} & frac1{11} & 0 & frac{10}{11} & 2 & 1 \ hline
end{array}



Upon doing the simplex update, we reach $(0,0,frac{10}{11},0,0)$. Our next entering variable is $x_2$. The difference from the previous step this time is the ratio is more than the upper bound. We will increment the $x_2$ by the upperbound amount, which is $1$. We will also update the RHS and mark $x_2$ as $bar{x}_2$ to indicate that it is now non-basic.



begin{array}{|c|c|c|c|c|c|c|c|c|c|c|}hline
& x_1 & bar{x}_2 & x_3 & x_4 & x_5 & s & -z & RHS & text{ratio} &UB \ hline
-z & -frac1{11} & -frac9{11} & 0 & frac3{11} & color{blue}{-frac6{11}} & frac7{11} & 1 & frac{79}{11} & - & - \ hline
x_3 & frac3{11} & frac5{11} & 1 & frac2{11} & frac7{11} & frac1{11} & 0 & frac{5}{11} & frac57 & 1 \ hline
end{array}



Now, we arrive at $(0,1,frac5{11},0,0)$. Our next entering variable is $x_5$, since the ratio is less than the upper bound, we do a regular simplex pivot updating.



begin{array}{|c|c|c|c|c|c|c|c|c|c|c|}hline
& x_1 & bar{x}_2 & x_3 & x_4 & x_5 & s & -z & RHS & text{ratio} &UB \ hline
-z & frac1{7} & -frac3{7} & frac67 & frac3{7} & 0 & frac5{7} & 1 & frac{53}{7} & - & - \ hline
x_5 & frac3{7} & frac5{7} & frac{11}7 & frac2{7} & 1 & frac1{7} & 0 & frac{5}{7} & - & - \ hline
end{array}



Now, we arrive at $(0,1,0,0,frac57)$. Upon checking the reduced cost, we can see that we are optimal with objective value $frac{53}{7}$.



R code to check the final solution:



> library(lpSolve)
> f.obj <- c(2,4,7,1,5)
> n = length(f.obj)
> f.con <- rbind(c(3,5,11,2,7), diag(n), -diag(n))
> f.dir <- rep('<=',2 * n+1 )
> f.rhs <- c(10,rep(1,n),rep(0,n))
> optimum <- lp(direction = "max", objective.in = f.obj, const.mat = f.con, const.dir = f.dir, const.rhs = f.rhs)
> optimum
Success: the objective function is 7.571429
> optimum$solution
[1] 0.0000000 1.0000000 0.0000000 0.0000000 0.7142857






share|cite|improve this answer














share|cite|improve this answer



share|cite|improve this answer








edited Nov 19 at 17:53

























answered Nov 19 at 17:36









Siong Thye Goh

94.9k1462115




94.9k1462115












  • its very nice, thanks so much! I have a question though. At the beginning, you decide it to put all $x_i$ at $0$, which it at their lower bound. I assume this choice is arbitrary. You could have choosen say $x_1=x_2=1$ and the rest $0$ and this would still work, correct?
    – Jimmy Sabater
    Nov 22 at 2:26










  • Sure, just adjust accodingly.
    – Siong Thye Goh
    Nov 22 at 3:16










  • Can you help me with this question? math.stackexchange.com/questions/3007305/…
    – Jimmy Sabater
    Nov 22 at 4:41


















  • its very nice, thanks so much! I have a question though. At the beginning, you decide it to put all $x_i$ at $0$, which it at their lower bound. I assume this choice is arbitrary. You could have choosen say $x_1=x_2=1$ and the rest $0$ and this would still work, correct?
    – Jimmy Sabater
    Nov 22 at 2:26










  • Sure, just adjust accodingly.
    – Siong Thye Goh
    Nov 22 at 3:16










  • Can you help me with this question? math.stackexchange.com/questions/3007305/…
    – Jimmy Sabater
    Nov 22 at 4:41
















its very nice, thanks so much! I have a question though. At the beginning, you decide it to put all $x_i$ at $0$, which it at their lower bound. I assume this choice is arbitrary. You could have choosen say $x_1=x_2=1$ and the rest $0$ and this would still work, correct?
– Jimmy Sabater
Nov 22 at 2:26




its very nice, thanks so much! I have a question though. At the beginning, you decide it to put all $x_i$ at $0$, which it at their lower bound. I assume this choice is arbitrary. You could have choosen say $x_1=x_2=1$ and the rest $0$ and this would still work, correct?
– Jimmy Sabater
Nov 22 at 2:26












Sure, just adjust accodingly.
– Siong Thye Goh
Nov 22 at 3:16




Sure, just adjust accodingly.
– Siong Thye Goh
Nov 22 at 3:16












Can you help me with this question? math.stackexchange.com/questions/3007305/…
– Jimmy Sabater
Nov 22 at 4:41




Can you help me with this question? math.stackexchange.com/questions/3007305/…
– Jimmy Sabater
Nov 22 at 4:41


















draft saved

draft discarded




















































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.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • 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.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3000829%2fsolving-an-lp-problem-with-an-upper-limit-for-the-variables%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

Plaza Victoria

Puebla de Zaragoza

Musa