Post Reply 
Simplex method in prime how to use the constrains maximise s.t. constraints.
11-10-2023, 09:44 PM (This post was last modified: 11-10-2023 10:19 PM by ftneek.)
Post: #42
RE: Simplex method in prime how to use the constrains maximise s.t. constraints.
Yes, I suppose it is equivalent. But the textbook I'm learning from uses artificial variables for equality. Here is the difference.

Originally we had n "=" constraints. Using artificial variables, we only need add n columns and 1 row.

> simplex([[3,2,1,1,0,10],[2,5,3,0,1,15],[-2,-3,-4,0,0,0],[0,0,0,1,1,0]])
>dim(Ans(3))
[3 6], only keeping track of 18 elements once the artificial row is deleted.

Of course, the artificial columns could be deleted once w (sum of artificial variables) is determined to be 0, meaning calculations from that point on would be on a matrix of dimension [3 4], bringing down to 12 elements. This is under the assumption no artificial variables are currently basic variables. If there is one, it probably needs to be replaced with non-artificial variable before the column can be deleted. But I have left the artificial columns in since solutions to the "primal system" can give solutions to the "dual system".

Using the <= + >= method, we now have 2n <= constraints, and must therefore add 2n columns for slack variables.

(11-10-2023 08:26 PM)Albert Chan Wrote:  > m := [[3,2,1,10], [2,5,3,15], [-2,-3,-4,-1]
> m := extend(−matrix(row(m,1 .. 2)), m)
> simplex_le(m)
> dim(Ans(3))
[5 8]
We must keep track of 40 elements. The size of the matrix is larger, meaning more memory and calculations are required, and none of the columns should be deleted. Although I admit I am not as familiar with this method, so maybe you could delete some rows/columns at some point.

In short, I believe the artificial variable method should be more efficient.

- 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-10-2023 09:44 PM



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