Are Slack Variables Causing Infeasible Points in Simplex Method?

  • Thread starter Thread starter liquidFuzz
  • Start date Start date
  • Tags Tags
    Method
Click For Summary
The discussion centers on issues encountered while applying the simplex method to a linear optimization problem, particularly regarding the feasibility of starting points and the setup of slack variables. The original poster experiences infeasible results due to starting at a point not within the feasible set, prompting questions about the role of slack variables and pivoting choices. Participants emphasize that starting outside the feasible region can lead to erratic results, and suggest that iterating from a feasible starting point is crucial for the simplex method to function correctly. The conversation highlights the importance of selecting appropriate pivoting elements and understanding the calculation of steepest descent in the algorithm. Ultimately, the need for a feasible starting point is reiterated as essential for successful optimization.
liquidFuzz
Messages
107
Reaction score
6
Simplex method - infeasible

I'm looking at some linear optimization problems. In one example I must be missing something, maybe someone can point it out. Here's the example:

<br /> \begin{align*}<br /> \textrm{max } f(\textbf{x}) = &amp; 2x_1 + x_2 \\<br /> \textrm{subject to} &amp; x_1 + x_2 \leq 5 \\<br /> &amp; -x_1 + x_2 \geq 1 \\<br /> &amp; \textbf{x} \geq 0 <br /> \end{align*}<br />

When I try to perform iterations of the simplex method I get funky results, not feasible stuff. I suspect that it is due to how I set up my slack variables, ##x_3## and ##x_4##. My starting point ##x=(0,0)## is not in the feasible set, but that shouldn't matter, right?

<br /> \begin{align*}<br /> \textrm{min } f(\textbf{x}) = &amp; -2x_1 - x_2 \\<br /> \textrm{subject to} &amp; x_1 + x_2 + x_3 = 5 \\<br /> &amp; x_1 - x_2 + x_4 = - 1 \\<br /> &amp; \textbf{x} \geq 0 <br /> \end{align*}<br />

Are my slack variables wrong..? Or is it something else causing me to end up in infeasible points in my iterations?
 
Mathematics news on Phys.org
Have you tried a starting point that is in your set? like, x1 = 1, x2 = 2?

I am not familiar with the method you're talking about, but whenever I get crazy results or errors in MATLAB from fitting, it's usually because of the starting point I've chosen.
 
liquidFuzz said:
My starting point ##x=(0,0)## is not in the feasible set, but that shouldn't matter, right?

Of course it matters - the trial solution blindly heads off down the line of steepest descent, how do you expect it is going to find its way into the feasible set?
 
MrAnchovy said:
Of course it matters - the trial solution blindly heads off down the line of steepest descent, how do you expect it is going to find its way into the feasible set?
Eh could you refresh my memory. Where do you calculate the steepest descent direction in the simplex algorithm..?
 
elegysix said:
Have you tried a starting point that is in your set? like, x1 = 1, x2 = 2?

I am not familiar with the method you're talking about, but whenever I get crazy results or errors in MATLAB from fitting, it's usually because of the starting point I've chosen.

I haven't tinkered with this in matlab. Is the optimixation tool kit good? I'll try different starting points and see what I get.
 
Maybe it's how I chose pivoting element..?

I'll post some iterations, maybe you can comment on them.

Tableau
\begin{matrix}
& x_1 & x_2 & s_1 & s_2 & f(x) & \hat{x} \\
r1 & 1 & 1 & 1 & 0 & 0 & 5 \\
r2 & 1 & -1 & 0 & 1 & 0 & -1 \\
obj & -2 & -1 & 0 & 0 & 1 & 0 \\
\end{matrix}

If I chose column ##x_1## as pivoting column the ratio test gives pivoting element ##r_1,x_1##. The updated tableau is then:
\begin{matrix}
& x_1 & x_2 & s_1 & s_2 & f(x) & \hat{x} \\
r1 & 1 & 1 & 1 & 0 & 0 & 5 \\
r2 & 0 & -2 & -1 & 1 & 0 & -6 \\
obj & 0 & 1 & 2 & 0 & 1 & 10 \\
\end{matrix}
This would imply that there are no descent direction, so no further optimization is possible. The current solution however is ##x =(5,0)## which isn't feasible.

If I instead chose starting pivoting element ##r2,x1## I end up in the point ##x=(2,3)## after a couple of iterations with ##f(2,3) = 7##. This suggests that I don't have a clue on how to chose pivoting elements. Pointers would be appreciated...
 
Sigh, I got now. I just needed to iterate until I had the solution...
 
liquidFuzz said:
Eh could you refresh my memory. Where do you calculate the steepest descent direction in the simplex algorithm..?

I could have put that better, but it would have taken more words. At each vertex (the initial vertex in particular) you have a number of choices of which variable to vary. An efficient implementation generally chooses the variable that descends most steeply (or possibly the one which achieves the greatest descent when reaching the next extremum).

This is not really relevant to the point though, which is that the simplex method works by traversing (a subset of) the extrema of the feasible set. If you start outside the feasible set you are only going to end up inside it by luck.
 
liquidFuzz said:
If I instead chose starting pivoting element ##r2,x1## I end up in the point ##x=(2,3)## after a couple of iterations with ##f(2,3) = 7##. This suggests that I don't have a clue on how to chose pivoting elements. Pointers would be appreciated...

No, it demonstrates that unless you are at an extremum the choice of reaching the solution is purely down to luck. Now you have struck lucky and found your way to x = (2,3) which is clearly an extremum, the algorithm starts to work and...

liquidFuzz said:
Sigh, I got now. I just needed to iterate until I had the solution...

Bingo!
 
  • #10
MrAnchovy said:
No, it demonstrates that unless you are at an extremum the choice of reaching the solution is purely down to luck. Now you have struck lucky and found your way to x = (2,3) which is clearly an extremum, the algorithm starts to work and...

Could you, or someone else, show me ho to start in, let's say x =(0,1)..?
 
  • #11
Set the slack variables to 0 and solve the simultaneous equations.
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 9 ·
Replies
9
Views
5K
  • · Replies 17 ·
Replies
17
Views
3K
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
5K
  • · Replies 1 ·
Replies
1
Views
6K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
Replies
1
Views
4K