Post Reply 
Simplex method in prime how to use the constrains maximise s.t. constraints.
11-11-2023, 05:49 PM (This post was last modified: 11-11-2023 07:02 PM by ftneek.)
Post: #51
RE: Simplex method in prime how to use the constrains maximise s.t. constraints.
To convert "=" to standard form, we should add an artificial variable.
Ex: (3x+2y+z = 10) becomes (3x+2y+z +r1 = 10)

To convert ">=" to standard form, we should subtract a slack (to make ">=" become "=") and add an artificial variable (because we now have "=", and the slack is negative).
Ex:(3x+2y+z ≥ 10) becomes (3x+2y+z -s1+r1≥ 10)
Alternatively, multiply by -1 changes ">=" to "<=" constraint: (-3x-2y-z <= -10)

To convert "<=" to standard form, we add a slack variable (to force "="). Since the slack variable is positive, we don't add an artificial variable.
Ex: (-3x-2y-z <= -10) becomes (-3x-2y-z+s1=-10)

If we added artificial variables, we should add a row to the bottom. [0 ... 0 1 ... 1 0] where there are 1's in the position of the artificial columns. By convention we usually order the matrix so that variables are listed first, then slack variables, then artificial variables.

Ex: constraints are
(5x+y-z = 5) becomes (5x+y-z +0s1+r1+0r2= 5) (0s1, 0r2 shown for clarity below)
(3x+2y+z ≥ 10) becomes (3x+2y+z -s1+0r1+r2= 10)
Then the matrix looks like
[[5,1,-1,0,1,0,5],[3,2,1,-1,0,1,10],[c row...],[0,0,0,0,1,1,0]]
We have 2 constraints so we need 2 initial basic variable, in this case we use artificial variables {5,6} (for variables/columns x5,x6).
We could either call simplex2(matrix,{5,6},6,2,0) or simplex2(matrix,{5,6},3,2,0). The only difference should be in number of variable solutions read in the end, we have 3 true variables so we should put at least 3.
The 2 because this "example" has 2 artificial variables, and the 0 because this is an "initial tableau", so we should not ignore any artificial columns.

- neek
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Simplex method in prime how to use the constrains maximise s.t. constraints. - ftneek - 11-11-2023 05:49 PM



User(s) browsing this thread: 2 Guest(s)