HP50G SIMPLEX Version14b Max Min Pivot Algorithm, multiple/unbounded, unfeasible sol
|
11-27-2022, 09:18 PM
(This post was last modified: 02-07-2023 09:04 AM by Gil.)
Post: #1
|
|||
|
|||
HP50G SIMPLEX Version14b Max Min Pivot Algorithm, multiple/unbounded, unfeasible sol
HP49-50G LP for SIMPLEX Max Min Pivot Algorithm
New Version 14b Multiple, Unbounded & Unfeasible Solutions. I VERSIONS II HOW TO USE I VERSIONS Version 4 Bugs corrected. Fully automaticized version Almost no limitation, except storage capacity of the calculator. Version 5 Corrections, in particular for output and stacks levels. Better handling of multiple solutions (see Notes 6,7 & 8 with example in next post). Previous version 6m-p —>GO main program contains now . all — and only — the local variables . together with detailed explanations Still improvement of the final check (linear dependency) & display of the (specific & general/multiple) solutions. Special cases duly mentioned by a DOERR message; otherwise, DOERR replaced by KILL instruction for more direct, visual information in the stack level 1. Version 6r Addition of the definition xia - xib = xi to STEPS variable when xi is a Free variable (>=0 or <0). Version 6s Inclusion of explanation xia - xib = xi to SLACK.beta variable when xi is a Free variable (>=0 or <0). Version 7e Multiple solutions checking improved (extreme directions finding however still not OK). Version 8a Multiple solutions checking finished (with linear combinations of vectors ). Different solution appear now, under menu 1st page, as SOL S.1-N S.LIN d.LIN. Version 8b Even if all your xi are or must be >= 0, you can force to check the possible (existing) multiple "solutiond" when "accepting" to have some xi<0 — but only in relation with the vectors linear depency. Version 8e Bug correction in 'CHECK.lin.comb' for the Input Matrix when m+1 >= n (m+1: # of rows; n: # of variables). Version 8g - Visual output corrected for Multiple Solutions with addition of 2 small subprograms —>xP & dµ.i. - Error corrected in program CHECK.2SOL regarding column choice when at final dictionary table we get one or more zeroes at bottom row (heading label of the corresponding column having to be a xi variable in order to procede to one more special "pivoting" step), with adaptation also of program —>SOL. - In OPTION subprogram, slight change in question 3 formulation showing its link with question 2. - A control HALT command was unduly forgotten in subprogram CHECK.2SOL of Version 8e. Version 9 - Bugs corrected for linear dependencies. - Loop added in case of wrong "choice" in column/row when supplementary step executed for zero value in last, final Matrix row relative to the objective fonction. - Output improved. Version 9d Slight, "cosmetical improvements" in the possible, visual outputs. Version 10d Large changes for the Min problem solution. Version 11 Bugs fixed for the Min problem. Cosmetical improvements of the explanations in —>GO. Version 12 - In some very special cases, the program could be sometimes "stuck" at the end and chose the wrong row, returning then the second solution — but possibly an unfeasible one. A special "artificial" test was duly included in subprogram CHECK.2SOL to fix up that issue. - The NOTE Var was changed : explanations now only regarding the "pivoting" (outside the program) & no more explanations relative to roundings. - Lines of explanations in —>PIVOT¦&COL.ROW subprogram suppressed for speed purpose. Version 13d Handling of unfeasible problem (when sign of found xi ≠ sign of constraint on xi). Version 14 - Linear Combination of xi in prior versions supposed all xi to be >= 0 (default case), or free. Now, in the linear combination of the xi, besides the free case of xi being free, the default case respects the real signs of the xi. - Programs variables S.1N, S.LIN & d.LIN, when called, give more details about the solution (multiple/unbounded/unfeasible solution) Version 14b Slight change in output for RESULT¦Ci.rows in case of unfeasible problem. II HOW TO USE Very first step Copy the annexed file ending by .hp (previously ending by .DOC into your calculator HP50G or EMU48 ; despite its previous ending with ".DOC", note that it was not at all a Word Doc or a file containing explanations; it was a HP50G usual directory containing HP50G programs, variables and other directories.) Save that SIMPLEX.hp file/Directory (previously called SIMPLEX. DOC) on your HP50G with just the name SIMPLEX. As in the previous versions 4, 5, 6,..., 12, nothing here to prepare or think over and check if it is Simplex compatible; the required transformations (added lines/columns/slack variables) are done internally by the program (and explained, for the added variables, under variable SLACK.beta, at first menu page, as well for STEPS variable, equally to be found at first menu page). Then just enter your "problem Matrix" at stack level 1 as a unique argument - with one row per inequality (inéquation) or equality (equation) (equalities/equations are allowed) — almost "normally" as they appear in a text book — and Z-objective function in last row; - for variables restrictions, enter them as normal row inequations/equations; free variables, when you don't know the sign of xi, are also accepted. See next post for example of Input and further explanations. Besides "normal" solution, output includes automatically possible inconsistencies and, if it exists, a "proposal" for a more general, multiple solution formulation. After launching the main program —>GO, answer further, at 1st question, 1 for a Max, 0 for a Min, & confirm your choice pressing ENTER. Press 4 times ENTER at the next four questions/prompts and wait for the results. |
|||
11-27-2022, 09:34 PM
(This post was last modified: 01-08-2023 03:26 PM by Gil.)
Post: #2
|
|||
|
|||
RE: HP49-50G LP for Simplex Max Min Pivot Algorithm
Therefore, 1 single Input Arg:
your System MATRIX as an array [m+1 rows × n+2 columns], with m Inequations /Equations Rows (for a total of m+1 rows) Row i <=Ci, Ci free or Row i >=Ci, Ci free or Row i = Ci, Ci free And Row i "free" when referring to xi free (>=0 or <=0) & 1 last row for Z-Max/Min, with eventual Constant C of the Z-function at column n+1 (not n+2) n Var xi (for a total of m+2 columns) xi <=Ci, Ci free or xi >=Ci, Ci free or xi = Ci, Ci free or xi free: -infinity < xi < infinity With signs >= (here 'G', G for Greater), <= (here 'L', L for Less) = (here 'E', E for Equal) and 'F' (for Free Variable) to be placed at column n+1 & Ci values to be placed at last column n+2 And run —>GO At 1st question further, reply: 1 for MAX or 0 for MIN & press ENTER. Press, 5 times ENTER (or 1/0 & ENTER) to the next five questions and wait for the results, Solution saved under SOL variable (first menu page), appear automatically. Further results are also saved & to be found at first or 2nd menu page: a) at 1st page, S.1-N, S.LIN & d.LIN (new name instead of previous d.EXT); and, at 2nd page now, old variables of previous versions, ie. transformation of (added) variables, under SLACK.beta, resulting values /feasibility for the m inequations, under RESULT¦Ci.rows (normally, with the last correction in version 9, the result should always be in order), & intermediate calculations, under STEPS. |
|||
11-27-2022, 09:45 PM
(This post was last modified: 01-29-2023 02:49 PM by Gil.)
Post: #3
|
|||
|
|||
RE: HP49-50G LP for Simplex Max Min Pivot Algorithm
Most of the examples & explanations are included as a long string
at the very beginning of the main program —>GO at first menu page. Examplification to the unique input Argument (Matrix): [[a11... a1n 'L' C1] [ a21... a2n 'E' C2] [] [1 0 0 0 0 'L' 9] [0 1 0 0 0 'L' -7] [0 0 1 0 0 'G' 6] [0 0 0 1 0 'F' 0] [0 0 0 0 1 'E' 0] [am1amn 'G' Cm] [z1 zn 8 0]] Explanation of the letters in the Matrix, to be entered at column n+1: 'L' Less <= 'E' Equal >= 'F' Free var xi, i.e. xi >=0 or xi <=0 'G' Greater >= Explanation for the above Matrix: [[a11... a1n 'L' 8] 1st row * <=8, which means, with minimum two coefficients of variable xi, xj ≠ 0, that -infinity < above row * <= 8. Note 0a In other words, with no specifications, a Row * may be <=0 (unless only one variable xi is concerned, in which case xi is, by default, >=0, according to Simplex rules). [a21... a2n 'E' C2] 2nd row = C2 [] [10 0 0 0 'L' 9] for Var x1 <= 9 but x1, however, assumed >= 0, as all xi generally, according to Simplex convention/rules. Note 0b Remember: x1, and more or generally xi, by default always assumed >= 0in the Simplex algorithm. Note 0c For effective x1 (xi) <=9, in which x1 (xi) may be <=0, (-infinity <x1/xi<=9), always write 2 rows: [1 0 0 0 'F' 0] [10 0 0 'L' 9], i.e. specifying also that x1 (xi) isFree, but, of course,saying that it is <=9. [0 10 0 0 'L' -7] for var x2 <=-7 [0 0 1 0 0 'G' 6] for var x3 >= 6 [0 0 0 10 'F' 0] for Free var x4, i.e. x4>=0 or x4<=0 when we don't know its sign. [0 0 0 0 1 'E' 2] for var x5 = 2 [am1... amn 'G' Cm] Row m >=Cm [ z1... zn 80]] i.e. last row m+1 for Z=z1x1+... +znxn+8 Note 1a Attention for possible, existing Constant C (8)in Z objective function: if, say, we have three unknown Var x1 x2 x3 & Z=1x1+0x2+3x3+8, the corresponding last Matrix m+1 row should be: [1 0 3 8 0 ] or [1 0 3 8 'Max'] or [1 0 3 8 'Min' ], but never [1 0 3 08]. In other words, in the last Matrix row, the possible, existing Constant C (8) of Z should always be placed in penultimate (second to last) bottom row cell (column c+1, and not last column c+2). Note 1b You don't need to specify the last cell name/content (0, 'Max', 'Min') : the program will do it afterwards for you when you execute it (according to your answer at first question relative to Max/Min). Its content has basically no real effect on the program results; but, if it is exactly equal to 'Min', the first question, when running —> GO program, will suppose a 0 answer corresponding to a Min choice; nevertheless, you can still decide to answer, to that first question, by 1 to choose a Max problem. Note 1c Contrarily to possible constant C (column n+1) of the Z-objective function (in last row), all the terms Ci coming after the signs >= (here 'G' ), <= (here 'L') or = (here 'E') are to be placed at last column n+2. Note 2 - Order for the rows of the Inequalities or Equalities is free. - Only Z coefficients must always be inlast Matrix row m+1. Note 3 When Inequalities transformations were necessary in order to have the Matrix 'Simplex compatible', the automatically introduced Slack added variables will be duly indicated with xi=beta.i ± di under SLACK.beta variable (2ndmenu page). Note 4a With the default fraction mode (question 3 under main program —>GO), the non integer solution (SOL variable at first menu page) always appears under two forms : fractions (even if you have inequalities of the form 2.23x1 + 4.108x2 <= 99.114 or xi =7.019) and latter corresponding numerical values. Note 4b Note that no fractions is given if you chose the alternative fast mode option (question 3 above under main program —>GP: see also NB 8). Note 4c When final results of the form 4.0799999903 (six 9s) or 2.370000008 (six 0s) are found, the subroutine ROUND¦9&0 transforms them into, respectively, the more readable 4.08 & 2.37 results. This was not given as an option, in order not to hassle the user with always the same recurring question. Should you not be satisfied by the above rounding mode, edit the ROUND¦9&0 program (to be found at the very last page of the many program-variables). As explained at the very beginning of that program, modify then the string relative to the number of nines you want (not the zeros to be changed, as they will be adjusted automatically for you by the program) in order to get a "nicer" result. Furthermore, as explained in ROUND¦9&0 program, no rounding at all is possible & achieved simply by changing the original string of 9s (always in ROUND¦9&0 program) with a string containing twice the infinity mathematical sign. Note 5a "Feasibility" A checking of the found solution, to verify if the calculated xi values respect the inequalities/equalities of the initial system, is then registered under RESULT¦Ci.rows variable-program (at 2nd menu page), with the resulting values for each of the m rows relative to ak1x1+ak2x2+... When the inequalities or equalities are not respected — which should be seldom the case since version 9d — with the found "solution", then a 'not' appear before the signs <= (here 'L') , >= (here 'G') or = (here 'E') in the corresponding row i Matrix of RESULT¦Ci.rows variable-program; it means that the given result is "not feasible, i.e., it is not allowed, as it breaks condition row i. If such a non feasible solution does appear despite the changes in the version 9d, the problematic rows will be also indicated, in form of a list, at the beginning of the Sol variable solution (to be found at first menu page). (See also next Notes such as #6 for other special situations.) Example Suppose we have the following System: [[ 2 3 'L' 4 ] [ 5 3 'L' 10 ] [ 6 4 'G' 50 ] [ 0 1 'L' 0 ] [ 1 -1 0 'Max' ]] and launch —>GO. To the four questions, accept the suggested choice just pressing ENTER. The given SOL variable (to be found at first menu page) shows the following content: { :Att\166 found 'Sol': VIOLATES.input :Inequal (Ci) at: { :row: 1 :row: 4 } Var\|>2\166Steps\|>5 Time\|>1\166s :Z-Max: -150 :x1: -55 :x2: 95 } And RESULT¦Ci.rows Variable, as mentioned to be found at 2nd menu page, is: :SolviolatesRowInCi: [[ 175 'not\|>LE' 4 ] [ 10 'LE' 10 ] [ 50 'GE' 50 ] [ 95 'not\|>LE' 0 ]] Note 5b Other example of an "unfeasible" problem [[ 1 1 'L' 5 ]* [ 0 1 'G' 8 ]** [ 6 4 0 'Max' ]] According to usual SIMPLEX convention (in this program), if nothing is said about xi (here x1 and x2), it is assumed to be >=0. If x2 >= 8 according to **, then * cannot be <0 as said in *, unless breaking the above rule and accepting that x1 might be <= 0 (x1=-3). Put [[ 1 1 'L' 5] [ 0 1 'G' 8 ] [ 6 4 0 'Max' ]] on the stack and launch —>GO. You get then: { Var 2¦Steps 4 Time1¦s : Z-Max: 14 :x1: -3 :x2: 8 : Sign { x1 } not allowed: UNFEASIBLE.problem } Note 6 "Unbounded" case It may also happen that the Simplex algorithm is stopped "too early": some Z coefficient of the Simplex table are indeed positive (to carry on the process as usual), but no negative value is found in the same, corresponding positive z column (to allow a further step). That case, when it occurrs, means that there is no Min/Max solutions, that there is an infinity of feasible "solutions"; then this observation of "unbounded" problem will be duly included at the end of SOL variable (as for non feasible "solutions", see also Note 5 above). Example Suppose that you have to solve: [[ 1 -1 1 'E' 0 ] * [ 0 -1 4 'E' 1 ] ** [ -1 -4 -2 0 'Min' ]], 'E' meaning "equal to". Run —>GO, choose 0 for the 1st question (we have to deal with a Min) then press 3 times ENTER. The output will be the following: { :'Sol' is no Max!: \ooUnbound.Sol\->\ooMax Var\|>2\166Steps\|>4 Time\|>1\166s : Z-Max: 52 :x1: 32 :x2: 20 : as only positive Val: in.Col\1662\166final.STEPS }. Now, let's look at final Simplex table. To that, just press STEPS variable (at first menu page). Edit it by pressing "down arrow". Go to last line of that large content by pressing RS+ "down arrow". We have then: [[ 1 'y3' '\Gb2' 'Con1' ] [ 'x1' '-1/2' '3/2' 32 ] [ 'x2' 0 1 20 ] [ 'y4' '-5/2' '9/2' 0 ] [ 'Z' '-1/2' ' 5/2' 52 ]] We see that, among columns 1 & 2, we do have a positive number in last row Z for column 2: 5/2. Unfortunately, no way to proceed as no value in that column 2 is negative (we have +3/2,+1 and +9/2). Other example Enter then the following Matrix: [[ 1 0 0 'F' 0 ] [ 0 1 0 'F' 0 ] [ 0 0 1 'F' 0 ] [ 1 -1 1 'E' 0 ] * [ 0 -1 4 'E' 1 ] ** [ -1 -4 -2 0 'Min' ]], *** remembering that 'F' stands for Free (variable), allowing x1, x2 and x3 to be negative. Put the above Matrix on the stack and launch —>GO. To the four questions, accept the suggested choice just pressing ENTER. The "solution" found is shown in the following form: { :'Sol' is no Min!: \ooUnbound.Sol\->\ooMin Var\|>3\166Steps\|>6 Time\|>2\166s : Z-Min: 5 :x1: -1 :x2: -1 :x3: 0 : as only positive Val: in.Col\1665\166final.STEPS }, noting here that \oo stands for the mathematical infinity symbol. Let x2 be := 1003 in equation **. It comes from ** that x3=251. With those values in *, it comes that x1=752. And finally, from *** and with above xi values, Z=-5266, which is < than given Simplex solution Z = 5. Now, let's look at final Simplex table. To that, just press STEPS variable (at first menu page). Edit it by pressing "down arrow". Go to last line of that large content by pressing RS+ "down arrow". We get: :Final Step: [[ 3 'y07' '\Gb2' 'y10' '\Gb4' '\Gb5' 'x3b' 'Con1' ] [ 'x1a' -1 1 -1 0 3 -3 0 ] [ 'x1b' 0 1 0 0 0 0 1 ] [ 'x2a' 0 0 -1 1 4 -4 0 ] [ 'x2b' 0 0 0 1 0 0 1 ] [ 'x3a' 0 0 0 0 1 0 0 ] [ 'y08' -1 0 0 0 0 0 0 ] [ 'y09' 0 0 -1 0 0 0 0 ] [ 'Z' -1 0 -5 0 21 -21 -5 ]] We see that, among columns 1,2,3,4,5 & 6, we do have a positive number in last row Z for column 5: 21. Unfortunately, no way to proceed as no value in that column 5 is negative (we have +3,+4 and +1). Note 7 Inclusion of 2nd main solution, when possible Suppose you have the following Matrix on the stack: [[ 8 6 1 'L' 48 ] [ 4 2 1.5 'L' 20 ] [ 2 1.5 .5 'L' 8 ] [ 0 1 0 'L' 5 ] [ 60 35 20 0 'Max' ]] Launch —> GO and press 4 times ENTER to the 4 program questions. The answer SOL, at first menu page will appear as: { :\GlSol 1+(1-\Gl)Sol 2: \Gl\166GE\1840\183and\183\Gl\166LE\1841 :Main Sol 1,as Zrow=0: in.Col\1662\166final.STEPS Var\|>3\166Steps\|>2 Time\|>0\166s :Z-Max: 280 :x1: 2 :x2: 0 :x3: 8 :Main Sol 2,as Zrow=0: in.Col\1662\166addit.STEPS Var\|>3\166Steps\|>3 Time\|>1\166s :Z-Max: 280 :x1: 0 :x2: [ '8/5' 1.6 ] :x3: [ '56/5' 11.2 ] } In fact, here two main solutions are calculated & given under SOL: SOL 1 & Sol 2. The general solution (to be found under SOL at first menu page) is then: lambda × SOL 1 + (1-lambda) × SOL 2, with 0 <= lambda <= 1 (as mentioned here in a compact way). Note 8 Other special case for infinite/multiple solution Where Sol i (general) = Sol by SIMPLEX + lambda0 × [lambda1, lambda2... lambdan] = [x1, x2... xn] + lambda0 × [lambda1, lambda2... lambdan], in which lambda0 is any number. To illustrate the above, put the following Matrix in stack level 1: [[ 1 0 0 '1/4' -8 -1 9 'E' 0 ] [ 0 1 0 '1/2' -12 '-1/2' 3 'E' 7 ] [ 0 0 1 0 0 1 0 'E' 1 ] [ 0 0 0 '3/4' 20 '-1/6' 6 0 'Min' ]] ... and press —> GO Then, pressing 4 times ENTER to answer the 4 questions, you should get: { Var\|>7\166Steps\|>11 Time\|>5\166s : Z-Min: [ '-1/6' -.166666666667 ] :x1: 1 :x2: [ '15/2' 7.5 ] :x3: 0 :x4: 0 :x5: 0 :x6: 1 :x7: 0 : (Above Sol) + \lambda.free *: [ 1 '19/11' 0 '-20/11' '3/44' 0 0 ] } Note 9 As cycling does not appear very often, no counting loop has been made yet to check and break the process for that type of occurrence. An example of cycling is given in directory called DATA, a directory to be found at last menu page (in DATA directory, enter then the directory labelled SPECIAL and choose the variable CYCLE). Note 10a If you chose the full stack option (default case at question 4 under main program —>GO), all the intermediate, important decision steps will be registered under STEPS variable (at first menu page, as mentioned). For the above example, STEPS variable is: { :Part1\166added x7=\Gb7+: 1 :as in transf. '\<=': some.Ci :<0 Ci min: -1 :Step-0 (total: 3): [[ 0 'x1a' 'x1b' 'x2a' 'x2b' 'x3a' 'x3b' '\Gb7' 'Con1' ] [ 'y1' -1 1 1 -1 -1 1 1 1 ] [ 'y2' 1 -1 -1 1 1 -1 1 1 ] [ 'y3' 0 0 1 -1 -4 4 1 2 ] [ 'y4' 0 0 -1 1 4 -4 1 0 ] [ 'x7' 0 0 0 0 0 0 1 1 ] [ 'Z' 0 0 0 0 0 0 -1 -1 ]] { "Ratios w/ C7" "(to elimin \Gb7)" :L1: 1 :L2: 1 :L3: 2 :L4: 0 :L5: 1 :Min: L4 } [[ 1 'x1a' 'x1b' 'x2a' 'x2b' 'x3a' 'x3b' 'y4' 'Con1' ] [ 'y1' -1 1 2 -2 -5 5 1 1 ] [ 'y2' 1 -1 0 0 -3 3 1 1 ] [ 'y3' 0 0 2 -2 -8 8 1 2 ] [ 'x7' 0 0 1 -1 -4 4 1 1 ] [ 'Z' 0 0 -1 1 4 -4 -1 -1 ]] { "Ratios w/ C4" :L1: '-1/2' :L3: -1 :L4: -1 :Max: L1 } [[ 2 'x1a' 'x1b' 'x2a' 'y1' 'x3a' 'x3b' 'y4' 'Con1' ] [ 'x2b' '-1/2' '1/2' 1 '-1/2' '-5/2' '5/2' '1/2' '1/2' ] [ 'y2' 1 -1 0 0 -3 3 1 1 ] [ 'y3' 1 -1 0 1 -3 3 0 1 ] [ 'x7' '1/2' '-1/2' 0 '1/2' '-3/2' '3/2' '1/2' '1/2' ] [ 'Z' '-1/2' '1/2' 0 '-1/2' '3/2' '-3/2' '-1/2' '-1/2' ]] { "Ratios w/ C2" :L2: -1 :L3: -1 :L4: '-1' :Max: L2 } :Final Step: [[ 3 'x1a' 'y2' 'x2a' 'y1' 'x3a' 'x3b' 'y4' 'Con1' ] [ 'x2b' 0 '-1/2' 1 '-1/2' '-4' 4 1 1 ] [ 'x1b' 1 -1 0 0 -3 3 1 1 ] [ 'y3' 0 1 0 1 0 0 -1 0 ] [ 'x7' 0 '1/2' 0 '1/2' 0 0 0 0 ] [ 'Z' 0 '-1/2' 0 '-1/2' 0 0 0 0 ]] \173\173\173\173\173\173\173\173\173\173\173\173\173\173\173\173\173\173\173\173\173\173 :Part2\166with x1a=\Gb1a+: 0 :x1b=\Gb1b+: 1 :x2a=\Gb2a+: 0 :x2b=\Gb2b+: 1 :x3a=\Gb3a+: 0 :x3b=\Gb3b+: 0 :Step-0 (total: 3): [[ 0 '\Gb1' '\Gb2' '\Gb3' '\Gb4' '\Gb5' '\Gb6' 'Con1' ] [ 'x1a' 1 0 0 0 0 0 0 ] [ 'x1b' 0 1 0 0 0 0 1 ] [ 'x2a' 0 0 1 0 0 0 0 ] [ 'x2b' 0 0 0 1 0 0 1 ] [ 'x3a' 0 0 0 0 1 0 0 ] [ 'x3b' 0 0 0 0 0 1 0 ] [ 'y07' -1 1 1 -1 -1 1 0 ] [ 'y08' 1 -1 -1 1 1 -1 0 ] [ 'y09' 0 0 1 -1 -4 4 0 ] [ 'y10' 0 0 -1 1 4 -4 0 ] [ 'Z' 1 -1 4 -4 2 -2 -5 ]] { "Ratios w/ C1" "(to elimin \Gb1)" :L7: 0 :Max: L7 } [[ 1 'y07' '\Gb2' '\Gb3' '\Gb4' '\Gb5' '\Gb6' 'Con1' ] [ 'x1a' -1 1 1 -1 -1 1 0 ] [ 'x1b' 0 1 0 0 0 0 1 ] [ 'x2a' 0 0 1 0 0 0 0 ] [ 'x2b' 0 0 0 1 0 0 1 ] [ 'x3a' 0 0 0 0 1 0 0 ] [ 'x3b' 0 0 0 0 0 1 0 ] [ 'y08' -1 0 0 0 0 0 0 ] [ 'y09' 0 0 1 -1 -4 4 0 ] [ 'y10' 0 0 -1 1 4 -4 0 ] [ 'Z' -1 0 5 -5 1 -1 -5 ]] { "Ratios w/ C3" "(to elimin \Gb3)" :L9: 0 :Max: L9 } [[ 2 'y07' '\Gb2' 'y10' '\Gb4' '\Gb5' '\Gb6' 'Con1' ] [ 'x1a' -1 1 -1 0 3 -3 0 ] [ 'x1b' 0 1 0 0 0 0 1 ] [ 'x2a' 0 0 -1 1 4 -4 0 ] [ 'x2b' 0 0 0 1 0 0 1 ] [ 'x3a' 0 0 0 0 1 0 0 ] [ 'x3b' 0 0 0 0 0 1 0 ] [ 'y08' -1 0 0 0 0 0 0 ] [ 'y09' 0 0 -1 0 0 0 0 ] [ 'Z' -1 0 -5 0 21 -21 -5 ]] { "Ratios w/ C6" "(to elimin \Gb6)" :L6: 0 :Min: L6 } :Final Step: [[ 3 'y07' '\Gb2' 'y10' '\Gb4' '\Gb5' 'x3b' 'Con1' ] [ 'x1a' -1 1 -1 0 3 -3 0 ] [ 'x1b' 0 1 0 0 0 0 1 ] [ 'x2a' 0 0 -1 1 4 -4 0 ] [ 'x2b' 0 0 0 1 0 0 1 ] [ 'x3a' 0 0 0 0 1 0 0 ] [ 'y08' -1 0 0 0 0 0 0 ] [ 'y09' 0 0 -1 0 0 0 0 ] [ 'Z' -1 0 -5 0 21 -21 -5 ]] } Note 10b Note, however, that such default full stack option may cause interruption of the program for large Matrixes that require a lot of Memory storage capacity and may use a very large number of stacks levels. Hence, to prevent premature program interruption in large Matrixes, the alternative option is to have just 4 stack-level (in last question 4 choice of the main program —>GO) : it may then help the program, without accumulating too many results in the different stacks levels & saving all the intermediate results, to fulfil nevertheless all the required steps and get the solution. By alternative 4 stacks levels, only initial and final steps are saved under STEPS variable (to be found at first menu page). If 4 stacks levels were chosen, STEPS variable would look like: { :Part1\166added x7=\Gb7+: 1 :as in transf. '\<=': some.Ci :<0 Ci min: -1 :Step-0 (total: 3): [[ 0 'x1a' 'x1b' 'x2a' 'x2b' 'x3a' 'x3b' '\Gb7' 'Con1' ] [ 'y1' -1 1 1 -1 -1 1 1 1 ] [ 'y2' 1 -1 -1 1 1 -1 1 1 ] [ 'y3' 0 0 1 -1 -4 4 1 2 ] [ 'y4' 0 0 -1 1 4 -4 1 0 ] [ 'x7' 0 0 0 0 0 0 1 1 ] [ 'Z' 0 0 0 0 0 0 -1 -1 ]] :Final Step: [[ 3 'x1a' 'y2' 'x2a' 'y1' 'x3a' 'x3b' 'y4' 'Con1' ] [ 'x2b' 0 '-1/2' 1 '-1/2' '-4' 4 1 1 ] [ 'x1b' 1 -1 0 0 -3 3 1 1 ] [ 'y3' 0 1 0 1 0 0 -1 0 ] [ 'x7' 0 '1/2' 0 '1/2' 0 0 0 0 ] [ 'Z' 0 '-1/2' 0 '-1/2' 0 0 0 0 ]] \173\173\173\173\173\173\173\173\173\173\173\173\173\173\173\173\173\173\173\173\173\173 :Part2\166with x1a=\Gb1a+: 0 :x1b=\Gb1b+: 1 :x2a=\Gb2a+: 0 :x2b=\Gb2b+: 1 :x3a=\Gb3a+: 0 :x3b=\Gb3b+: 0 :Step-0 (total: 3): [[ 0 '\Gb1' '\Gb2' '\Gb3' '\Gb4' '\Gb5' '\Gb6' 'Con1' ] [ 'x1a' 1 0 0 0 0 0 0 ] [ 'x1b' 0 1 0 0 0 0 1 ] [ 'x2a' 0 0 1 0 0 0 0 ] [ 'x2b' 0 0 0 1 0 0 1 ] [ 'x3a' 0 0 0 0 1 0 0 ] [ 'x3b' 0 0 0 0 0 1 0 ] [ 'y07' -1 1 1 -1 -1 1 0 ] [ 'y08' 1 -1 -1 1 1 -1 0 ] [ 'y09' 0 0 1 -1 -4 4 0 ] [ 'y10' 0 0 -1 1 4 -4 0 ] [ 'Z' 1 -1 4 -4 2 -2 -5 ]] :Final Step: [[ 3 'y07' '\Gb2' 'y10' '\Gb4' '\Gb5' 'x3b' 'Con1' ] [ 'x1a' -1 1 -1 0 3 -3 0 ] [ 'x1b' 0 1 0 0 0 0 1 ] [ 'x2a' 0 0 -1 1 4 -4 0 ] [ 'x2b' 0 0 0 1 0 0 1 ] [ 'x3a' 0 0 0 0 1 0 0 ] [ 'y08' -1 0 0 0 0 0 0 ] [ 'y09' 0 0 -1 0 0 0 0 ] [ 'Z' -1 0 -5 0 21 -21 -5 ]] } Note 11a To speed up process, sometimes quite a lot, in particular for large Matrixes, you may not be interested by exact, fractional results (default mode at question 4 mentioned further above), and prefer to chose the alternative option (fast/approximation mode, with no fractions, relative to mentioned question 4). Note 11b Note, however, that if you chose the option "All Gen/Mult Sol:check lin dep" at question 2, option that requires exact mode, you won't be able to access to question 4 relative to fast approximation mode. For fast approximation calculation, you must select 0 at question 2, indicating that you selected the corresponding option "only SIMPLEX solution"; then only you will be prompted the question for fast mode in question 4. Note 11c Note also that, when choosing approximation mode (question 4/5 in OPTIONS prompted), you might get unexpected, special solutions. Example Go (press) DATA directory (last menu page). Go then to (press) SPECIAL directory. Choose last variable (last menu page) called SPEC.SPEC. You should get [[ 1 -1 0 0 1 0 0 'E' 3 ] [ -3 2 9 2 0 -2 0 'E' 22 ] [ 0 1 0 0 0 -1 0 'E' 2 ] [ 4 3 5 0 1 0 -1 'E' 4 ] [ -1 0 3 -1 0 0 0 0 'Max' ]] Press then —>GO. a) Press 5 times ENTER. The full solution is then given by {lambda × [ 0 2 2 0 5 0 17 ] + (1-lambda) [ 5 2 '11/3' 0 0 0 '121/3' ] + mu1 × [ 1 1 '1/3' 0 0 1 '26/3' ] + mu2 × [ 0 1 0 0 1 1 4 ]}, with 0<=lambda<=1 & mu i >= 0 b) Press now INPUT.last (at 1st menu page) & launch (press) a 2nd time the main program —>GO. Be careful and, to the questions/prompts that appear: - answer 1 for 1st question (MAX option) - answer 0 for 2nd question (no multiple solution) - answer 1 for 3rd question here (automatic mode) - answer 0 for 4th question here (no fractions —> approximation) - answer 1 for 5th question (full stacks & details). The full and unrecognisable solution is then given as: [ 0 8.28947368439 2 0 11.2894736843 6.28947368439 42.1578947369 ]. c) In fact, the above solution b) is a special case of a). Indeed: Solution b) [ 0 8.28947368439 2 0 11.2894736843 6.28947368439 42.1578947369 ] =? solution a) lambda × [ 0 2 2 0 5 0 17 ] + (1-lambda) × [ 5 2 '11/3' 0 0 0 '121/3' ] + mu1× [ 1 1 '1/3' 0 0 1 '26/3' ] + mu2 × [ 0 1 0 0 1 1 4 ] Set lambda = 1, mu1 =0, mu2 =6.28947368439. Then solution b) [/b] [ 0 8.28947368439 2 0 11.2894736843 6.28947368439 42.1578947369 ] =? solution a) 1 × [ 0 2 2 0 5 0 17 ] + 6.28947368439 × [ 0 1 0 0 1 1 4 ] Or [ 0 8.28947368439 2 0 11.2894736843 6.28947368439 42.1578947369 ] =? [ 0 2 2 0 5 0 17 ] + [ 0 6.28947368439 0 0 6.28947368439 6.28947368439 25.1578947376 ] And we see that the expected (or unexpected!) equality is, to the rounding errors, indeed fully fulfilled. Note 12 Question 3, under main program —>GO, enables you to choose your own column (within an allowed list of Simplex compatible columns, of course). It's called the step-by-step mode : besides the possibility of letting you chose your own colums, the program stops then at every important intermediate decision step. Note, however, that it is not the default setting, for which the program makes itself all the appropriate "decisions", with no stop till the final solution. Note 13a For checking purposes, you can use subroutine Mkl—>N (last page of the many program-variables) to change the line and column of your test Matrix M according to Simplex Pivot Rules. But don't modify or delete that subroutine used in Simplex algorithm program. Use: enter Matrix in stack level 3 (without labels in 1st row & in 1st column, or with them as the program will detect them and not consider them), the row# k of the pivot (not counting the first row of label names if such a line exists) in stack level 2 and column # l of the pivot (not counting the first column of label names if such a column exists) in stack level 1. Note 13b If you have a Matrix to be 'pivoted' together with its labels, you can also use now '\->PIVOT\166&COL.ROW' subprogram (at last page of the many program-variables), counting here, however & contrarily to Mkl—>N subprogram, the label top line as the first row and the left label column as the first column. Note 14 Initial Inequalities & Equalities System Matrix, including Z objective Max/Min function in last row, are saved always under INPUT.last (first appearing variable at page 1). Note that the answer to the first question Max/Min will be integrated to last cell of the INPUT.last. Note 15 Regarding your own System of Matrixes (including Z objective Max/Min function in last row): to keep the program directory clean of "new entries /Matrixes", preferably save them in DATA Directory at the very last page of the many program variables, directory including interesting Min/Max problems. Note that this DATA directory may be freely deleted (purged). Note 16 Observe, finally, that the SOL variable informs you also about the number of recursive loops/steps ("SIMPLEX tables"), the number of variables involved and the elapsed time, in seconds, to get the solution. Note 17 - When solutions are not a linear combination of the variables xi, & if the given solution SOL (at first menu page) is of the kind Sum (lambda i × solution i), with 0<=lambda<=1 & sum (lambda i) = 1, then it will present a minimum of two particular solutions : main solution 1 & main solution 2, but not always all the possible other solutions (such as lambda 3 × solution 3, lambda 4 × solution 4, etc.). - For linear combination of the variables xi, when corresponding option is selected, the given solution under S.LIN & d.LIN (both at 1st menu page) are always exhaustive. Tests & bugs reporting, as well as commentaries, are welcome. Gil |
|||
11-28-2022, 11:15 AM
(This post was last modified: 01-04-2023 01:37 PM by Gil.)
Post: #4
|
|||
|
|||
RE: HP49-50G LP for Simplex Max Min Pivot Algorithm, almost any situation
Post with no more purpose with the last version.
Regards, Gil |
|||
12-12-2022, 04:15 PM
(This post was last modified: 01-03-2023 08:06 AM by Gil.)
Post: #5
|
|||
|
|||
RE: HP49-50G Version 7 Simplex Max Min Pivot Algorithm, almost any situation
Post with no more purpose with the last version 8e.
Regards, Gil |
|||
12-12-2022, 10:12 PM
(This post was last modified: 01-04-2023 01:38 PM by Gil.)
Post: #6
|
|||
|
|||
RE: HP49-50G Version 6o Simplex Max Min Pivot Algorithm, almost any situation
See, please, next "replies" for last version.
|
|||
12-13-2022, 05:21 PM
(This post was last modified: 01-02-2023 01:33 PM by Gil.)
Post: #7
|
|||
|
|||
RE: HP49-50G Version 6r Simplex Max Min Pivot Algorithm, multiple/unbounded solutions
When in presence of a free variable, the program transforms it systematically into two variables xia and xib, both >= 0, defining xi = xia - xib (transforming back again, for the final SOL variable at the very end of the program execution, xia - xib —>xi).
Now, for better comprehension of the decision steps, that definition is given at the beginning of the STEPS variable when dealing with free variables xi; for clarity, the same applies to SLACK.BETA variable Regards |
|||
12-13-2022, 11:01 PM
(This post was last modified: 01-10-2023 10:34 AM by Gil.)
Post: #8
|
|||
|
|||
RE: HP49-50G Versions 8 Simplex Max Min Pivot Algorithm, multiple/unbounded solutions
Changes in versions 8
Version 8b Large improvements regarding linear dependency (multiple solutions). Version 8e Bug correction in 'CHECK.lin.comb' for the Input Matrix when m+1 >= n (m+1: # of rows; n: # of variables). Version 8g - Visual output corrected for Multiple Solutions with addition of 2 small subprograms —>xP & dµ.i. - Error corrected in program CHECK.2SOL regarding column choice when at final dictionary table we get one or more zeroes at bottom row (heading label of the corresponding column having to be a xi variable in order to procede to one more special "pivoting" step), with adaptation also of program —>SOL. - A HALT command suppressed in previous version 8f. |
|||
12-15-2022, 12:17 AM
(This post was last modified: 01-04-2023 01:42 PM by Gil.)
Post: #9
|
|||
|
|||
RE: HP49-50G Version 7f Simplex Max Min Pivot Algorithm, multiple/unbounded solutions
Important
When given, the more general solution (in function of a lambda parameter) should be now exhaustive and does correspond fully to the paper "A Way to Find All the Optimal Solutions in Linear Programming", by Zuo Xiaode, Xue Shengjia & Luo Lei, to be found at https://ieeexplore.ieee.org/stamp/stamp....er=6075407 Contrarily to what I wrote previously, the solutions given in the above Paper are perfectly correct (my earlier transcription of the restrictions contained an error) — and my versions after 8e have been accordingly modified into: Lambda × Sol1 + (1-Lamda) × Sol2, with 0<= Lambda <= 1. |
|||
12-18-2022, 12:28 PM
(This post was last modified: 01-04-2023 01:00 PM by Gil.)
Post: #10
|
|||
|
|||
HP49-49G Version 8f Simplex Max Min Pivot Algorithm, multiple/unbounded solutions
See please other posts.
|
|||
12-26-2022, 05:28 PM
(This post was last modified: 01-10-2023 10:42 AM by Gil.)
Post: #11
|
|||
|
|||
HP49-50G - Versions 8 Simplex Max Min Pivot Algorithm, multiple/unbounded solutions
Changes in versions 8...8g
Version 8 1) Pivot program: easier, improved external use. 2) Output results: further use improved without manipulations. 3) Linear depencies: improved checking. 4) In relation to 3, added a 5th question to confirm that we want to check the linear dependency relative to more general solution (case a): a1x1+... +anxn= Ci is OK; case b), for x1=a2x2+...+anxn & x2=a1x1+...+anxn &... xn=a1x1+...+a<n-1>x<n-1, now also satisfactory solved with all the possible combinations). 5) Solution name of d.EXT changed into d.LIN. 6) More explicit labelling of both solutions S.LIN & d.LIN. Version 8e Bug correction in 'CHECK.lin.comb' for the Input Matrix when m+1 >= n (m+1: # of rows; n: # of variables). Version 8g - Visual output corrected for Multiple Solutions with addition of 2 small subprograms —>xP & dµ.i. - Error corrected in program CHECK.2SOL regarding column choice when at final dictionary table we get one or more zeroes at bottom row (heading label of the corresponding column having to be a xi variable in order to procede to one more special "pivoting" step), with adaptation also of program —>SOL. - A HALT command suppressed in previous version 8f. |
|||
12-27-2022, 11:38 PM
(This post was last modified: 01-02-2023 02:08 PM by Gil.)
Post: #12
|
|||
|
|||
RE: (49G)-(50G) Simplex Max Min Pivot Algorithm, multiple/unbounded solutions
No more purpose.
. |
|||
01-01-2023, 08:47 PM
(This post was last modified: 01-04-2023 01:05 PM by Gil.)
Post: #13
|
|||
|
|||
RE:HP49-50G Old Ver SIMPLEX Max Min Pivot Algorithm, multiple/unbounded solutions
No more purpose.
|
|||
01-03-2023, 08:00 AM
(This post was last modified: 01-04-2023 01:22 PM by Gil.)
Post: #14
|
|||
|
|||
REHP49G-50G Old Version Simplex Max Min Pivot Algorithm, multiple/unbounded solutions
No more purpose.
|
|||
01-03-2023, 04:33 PM
(This post was last modified: 01-10-2023 10:35 AM by Gil.)
Post: #15
|
|||
|
|||
HP49G-50G Version 8f Simplex Max Min Pivot Algorithm, multiple/unbounded solutions
Codes for all variables / subprograms
relative to Version 8e of SIMPLEX "'INPUT.last'" " " "[[ 2 1 'L' 50 ] [ 2 5 'L' 100 ] [ 2 3 'L' 90 ] [ 4 10 0 'Max' ]]" " " "'\\->GO'" " " "\\<< \"1 Arg: MATRIX [m+1 \\.x n+2] m Row Inequat/Equat n Var xi (\\>=0/\\<=0/Free) &1 Z-Max/Min last Row m+1: [[1 0 0 0 0 'F' 0] [0 1 0 0 0 'F' 0] [0 1 0 0 0 'L' 9] [] [0 0 0 1 0 'E' 6] [] [Al1 Aln 'E' Cl] [Am1 Amn 'G' Cm] [ z1 zn C 0]] \\|> Letters F L E G (& possible number C): in Matrix Col n+1 'F' Free var xi\\>=0, \\<=0 'L' Less \\-> \\<= 'E' Equal \\-> = 'G' Greater \\-> \\>= \\|> Numbers Ci (Cl,Cm) \\[] are free: \\>=0 or \\<=0 \\[] & in Col n+2 \\|> Input example & explanations: [[1 0 0 0 0 0 'F' 0] Free var x1:-\\oo<x1<\\oo Sign of xi unknown: x1 may be \\>=0 or \\<=0 [0 1 0 0 0 0 'F' 0] [0 1 0 0 0 0 'L' 9] 'x2 is Free but \\<=(L)9' \\->2 rows for -\\oo<x2\\<=9! [0 0 1 0 0 0 'L' 8] var 0 \\<= x3 \\<= 8 as by default: x3 (xi) alw. \\>= 0! [0 0 0 1 0 0 'E' 6] var x4 = 6 [0 0 0 0 1 0 'L' 0] var x5:-\\oo< x5 \\<= 0 [0 0 0 0 0 1 'L'-8] var x6:-\\oo< x6 \\<= -8 [0 0 0 0 0 0 1 'G'-9] var x7: -9 \\<= x7<\\oo [] [Ak1 Akn 'L' Ck] -\\oo< row k \\<= Ck [Al1Aln 'E' Cl] row l = Cl [Am1Amn 'G' Cm] Cm \\<= row m<\\oo [ z1 zn C 0 ]] or [ z1 zn C 'Max']] or [ z1 zn C 'Min']] for Z=z1x1+znxn+C \\[] Z-row in last row \\[] C(often 0) of Z in Col n+1 (not n+2!) \\[] 0 'Max' or 'Min': not important but in Col n+2 \\|>Order for the Rows of the Ineq/Equ is free \\|>Only Z-coef must alw. be in last MatRow m+1 \\|>At 1st question further, reply: 1 for MAX or 0 for MIN & press ENTER & wait \\|> For the other 4 less important questions: \\[]General sol (slow)\\->1 * Only SIMPLEX sol \\->0 \\[]Lin comb:all xi\\>=0 \\->1 Lin comb:allow x<0\\->0 \\[]Auto/direct exec \\->1 Step-by-step \\->0 \\[]Fractions (slow) \\->1 * Fast (no fract.) \\->0 \\[]Full steps saved \\->1 * If lack of memory \\->0 choose 1/0 & ENTER (1 is default sett.) 0 to above * Quest. to speed up (\\-> less details & no fract.) \\|> Review data/results after output? \\->Press (at 1st Page) \\[]INPUT.last \\[]SOL \\[]S.1\\173N S.LIN d.LIN \\->Press (at 2nd Page) \\[]SLACK.\\Gb \\[]RESULT\\166Ci.rows \\[]STEPS \\|> Save all your Matrixes in DATA Dir (last menu page)\" DROP 'INPUT.last' STO 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 { } DUP DUP 0 0 0 0 0 RCLF 0 0 0 0 0 0 { } 0 \\-> \\<-Rnd \\<-STACK.full \\<-Auto \\<-MiMa.s \\<-m \\<-l.xi \\<-l.xi.s \\<-time \\<-m0 \\<-m00 \\<-minCi \\<-Zrow \\<-I \\<-J \\<-VECT\\Gbi \\<-step0 \\<-STEPS.x\\Gb \\<-l.check \\<-INP.cut \\<-Ci.sol \\<-I.INP \\<-F.l \\<-F.l2 \\<-Jor \\<-l.xi.or \\<-fraction \\<-INPUTmod \\<-\\ooSOL \\<-fg \\<-SOL1 \\<-jj \\<-SLACK1.\\Gb \\<-STEPS1 \\<-RESULT1.ROW \\<-xab \\<-row.prob.l \\<-Z \\<< GO.NEXT \\>> \\>>" " " "'SOL'" " " "{ :\\GlSol 1+(1-\\Gl)Sol 2: \\Gl\\184GE\\1660\\183and\\183\\Gl\\184LE\\1661 : Main Sol 1,as Zrow=0: in.Col\\1661\\166final.STEPS Var\\|>2\\166Steps\\|>2 Time\\|>0\\166s : Z-Max: 200 :x1: [ '75/4' 18.75 ] :x2: [ '25/2' 12.5 ] : Main Sol 2,as Zrow=0: inCol\\1661\\166addit.STEPS Var\\|>2\\166Steps\\|>3 Time\\|>0\\166s : Z-Max: 200 :x1: 0 :x2: 20 }" " " "'S.1\\173N'" " " "{ [ '75/4' '25/2' ] [ 0 20 ] }" " " "'S.LIN'" " " "\\<< CASE Mult.Lin.D 1 == THEN S.lin 0 \\=/ IF THEN S.lin xP 1 == IF THEN \"S\\>=0\" ELSE \"Sfree\" END \" \\Gax1+\\Ganxn=Ci\" + \\->TAG ELSE No\\|>Exact\\166lin.comb\\166S xP 1 == IF THEN \"xi\\>=0\" ELSE \"xfree\" END \" \\Gax1+\\Ganxn\\=/Ci\" + \\->TAG END END at.Question.2 \"No calc request\" \\->TAG END \\>>" " " "'d.LIN'" " " "\\<< CASE Mult.Lin.D 1 == THEN d\\Gm 0 \\=/ IF THEN d\\Gm \"S\\|>Sol i+\\Gm\" xP 1 == IF THEN \"[\\>=0]\" ELSE \"free\" END + \"*d, d\" + \\->TAG ELSE No\\|>Exact\\166lin.comb\\166d xP 1 == IF THEN \"xi\\>=0\" ELSE \"xfree\" END \" \\Ga1x1+\\Ganxn\\=/0\" + \\->TAG END END at.Question.2 \"No calc request\" \\->TAG END \\>>" " " "'RESULT\\166Ci.rows'" " " "\\<< SOL TYPE 5 == IF THEN RESULT.ROW row.prob 1 == IF THEN \"SolviolatesRowInCi\" ELSE \"CiCalc\\[]CiInSyst\\->OK\" END \\->TAG ELSE :Interrupt Cycling?: \\->no\\166result.calc END \\>>" " " "'STEPS'" " " "{ :Step-0 (total: 2): [[ 0 'x1' 'x2' 'Con1' ] [ 'y1' -2 -1 50 ] [ 'y2' -2 -5 100 ] [ 'y3' -2 -3 90 ] [ 'Z' 4 10 0 ]] { \"Ratios w/ C1\" :L1: -25 :L2: -50 :L3: -45 :Max: L1 } [[ 1 'y1' 'x2' 'Con1' ] [ 'x1' '-1/2' '-1/2' 25 ] [ 'y2' 1 -4 50 ] [ 'y3' 1 -2 40 ] [ 'Z' -2 8 100 ]] { \"Ratios w/ C2\" :L1: '-50' :L2: '-25/2' :L3: -20 :Max: L2 } :Final Step: [[ 2 'y1' 'y2' 'Con1' ] [ 'x1' '-5/8' '1/8' '75/4' ] [ 'x2' '1/4' '-1/4' '25/2' ] [ 'y3' '1/2' '1/2' 15 ] [ 'Z' 0 -2 200 ]] :Additional Step: For\\1662nd.Main.Sol [[ 3 'x1' 'y2' 'Con1' ] [ 'y1' '-8/5' '1/5' 30 ] [ 'x2' '-2/5' '-1/5' 20 ] [ 'y3' '-4/5' '3/5' 30 ] [ 'Z' 0 -2 200 ]] }" " " "'GO.NEXT'" " " "\\<< OPTION TICKS '\\<-time' STO -100 CF RAD \"Interr.\\->no\\166result\" 'SOL' STO \"Interr.\\->no\\166saving\" 'STEPS' STO 0 'row.prob' STO \"No transf/slack \\Gb\" 'SLACK.\\Gb' STO 0 { S.lin d\\Gm } STO { } 'S.1\\173N' STO ADD.MIN\\166MAX C\\<-\\->Max\\166Min 2 SF TEST.EXACT CHECK.lin.comb \\->INP.cut EQ\\1831\\->INEQ\\1832 FREExi\\1661C\\->2C \\->LIST.xi { } 1 \\<-J 1 - START 1 + NEXT '\\<-l.xi.s' STO INEQ.INPUT\\166G\\->INEQ\\166L INEQ.LESS\\->TAB.OPPs \\->SIGN.xi\\166&xiL0\\->XiG0 \\<-m0 \\<-I ROW- \\<-MiMa.s * '\\<-Zrow' STO DUP '\\<-m0' STO '\\<-m00' STO \\->TAB.\\Gb0\\166MinCi\\166LESS?0 \\<-minCi 0 < IF THEN 1 SF MAIN DROP2 \\->SLACK.\\Gb STEPS '\\<-STEPS.x\\Gb' STO SOL\\Gbi\\->VECT\\Gbi \\->M\\166FOR.2ndMAIN END 1 CF MAIN \\>>" " " "'OPTION'" " " "\\<< \" Max Problem \\-> 1 or Min Problem \\-> 0 * * * *\" INPUT.last DUP SIZE OBJ\\-> DROP * GET \"\" + 2 3 SUB DUP \"in\" SAME SWAP \"IN\" SAME OR IF THEN { \":Your choice (1/0): 0\" -21 } ELSE { \":Your choice (1/0): 1\" -21 } END INPUT OBJ\\-> 0 == IF THEN -1 '\\<-MiMa.s' STO END \"All Gen/Mult Sol:check lin dep \\-> exact mode only (slower) \\-> 1 Or only SIMPLEX sol (faster result) \\-> 0\" { \":Your choice (1/0): 1\" -21 } INPUT OBJ\\-> 'Mult.Lin.D' STO Mult.Lin.D 1 == IF THEN \"For Gen/Mult Sol: lin dep. w/ all xi\\>=0 \\-> 1 Or accept lin. depend. with some xi<0 \\-> 0\" { \":Your choice (1/0): 1\" -21 } INPUT OBJ\\-> 'xP' STO END \"Automatic/direct exec & no Col choice \\-> 1 Or Step-by-Step execut & Col choice \\-> 0\" { \":Your choice (1/0): 1\" -21 } INPUT OBJ\\-> '\\<-Auto' STO Mult.Lin.D 0 == IF THEN \"Fractions: exact calc, but (much) slower\\-> 1 Or Fast calculation & no fractions \\-> 0\" { \":Your choice (1/0): 1\" -21 } INPUT OBJ\\-> ELSE 1 END '\\<-fraction' STO \"Stack: Keep all steps if enough memory \\-> 1 Or only 4 levels Stack if lack of space \\-> 0\" { \":Your choice (1/0): 1\" -21 } INPUT OBJ\\-> '\\<-STACK.full' STO \\>>" " " "'Mult.Lin.D'" " " "1" " " "'xP'" " " "1" " " "'ADD.MIN\\166MAX'" " " "\\<< INPUT.last DUP SIZE OBJ\\-> DROP * \\<-MiMa.s 1 == 'Max' 'Min' IFTE PUT 'INPUT.last' STO \\>>" " " "'C\\<-\\->Max\\166Min'" " " "\\<< INPUT.last DUP SIZE OBJ\\-> DROP * 1 - GETI UNROT DUP UNROT GETI UNROT 4 ROLL SWAP - ROT PUTI ROT PUT \\>>" " " "'TEST.EXACT'" " " "\\<< -3 CF \\<-fraction 1 == IF THEN -105 CF :: \\->Q MAP :: EVAL MAP ELSE -105 SF \\->NUM END DUP '\\<-m0' STO '\\<-INPUTmod' STO \\>>" " " "'CHECK.lin.comb'" " " "\\<< Mult.Lin.D 1 == IF THEN \\<-INPUTmod DUP SIZE OBJ\\-> DROP 0 0 \\-> m I J L.Comb L.s \\<< m J COL- DROP J 1 - COL- DROP 'm' STO -2 'J' STO+ { } I 1 + J MIN 1 J FOR j j NEXT J \\->LIST Comb DUP 'L.Comb' STO SIZE 'L.s' STO 1 L.s FOR i L.Comb i GET 0 \\-> l0 l01 \\<< { I 1 } 0 CON 2 I 1 + J MIN FOR i m l0 i GET COL- SWAP DROP i COL+ NEXT m l0 1 GET COL- SWAP DROP I 2 + J 1 + MIN COL+ 1 COL- DROP RREF \\-> r \\<< 1 1 I FOR i r i ROW- SWAP DROP DUP DOT 0 == r i ROW- I 1 + J MIN COL- DROP SWAP DROP DUP DOT 0 \\=/ OR IF THEN 1 ELSE 0 END * NEXT xP 1 == IF THEN 1 I FOR i r i I 1 + J MIN 2 \\->LIST GET 0 > IF THEN I 'i' STO 0 * END NEXT END 0 \\=/ IF THEN r I 1 + J MIN COL- SWAP DROP l0 1 GET 'l01' STO WHILE l01 1 > REPEAT -1 'l01' STO 0 1 COL+ END -1 l0 1 GET COL+ l0 2 GET J FOR j l0 j DUP UNROT POS 0 == IF THEN 0 SWAP COL+ ELSE DROP END NEXT NEG :: \\->Q MAP I J \\>= IF THEN J I START J 1 + COL- DROP NEXT END + END \\>> \\>> NEXT DUP SIZE 0 > IF THEN EXPAND SAME.Sol DUP SIZE 1 == IF THEN 1 GET END 'd\\Gm' STO ELSE DROP END \\>> END \\>>" " " "'Comb'" " " "\\<< \"By Thomas Klemm\" DROP \\<< \\-> m s \\<< CASE m s SIZE > THEN { } END m 1 == THEN s 1 \\<< 1 \\->LIST \\>> DOLIST END m s SIZE == THEN s 1 \\->LIST END m 1 - s TAIL \\<-C EVAL 1 \\<< s HEAD SWAP + \\>> DOLIST m s TAIL \\<-C EVAL + END \\>> \\>> \\-> \\<-C \\<< \\<-C EVAL \\>> \\>>" " " "'d\\Gm'" " " "0" " " "'SAME.Sol'" " " "\\<< \"By Werner\" DROP \\-> L \\<< L 1 \\<< L OVER POS NSUB \\=/ DROPN \\>> DOSUBS \\>> \\>>" " " "'SAME.SOL'" " " "\\<< \"Not used \\-> Can be deleted Own 1st version \" DROP DUP \\->STR \\-> l.s s \\<< l.s SIZE 1 FOR i s l.s i GET DUP UNROT \"\" SREPL DROP + 's' STO -1 STEP \"\\|>\" s + \"\\|>\" \"{\" SREPL DROP \"\\|>\" + \"\\|>\" \"}\" SREPL DROP OBJ\\-> OBJ\\-> SWAP DROP 1 - \\->LIST \\>> \\>>" " " "'\\->INP.cut'" " " "\\<< \\<-m0 DUP SIZE OBJ\\-> DROP \\-> J \\<< '\\<-I.INP' STO J DUP '\\<-Jor' STO COL- DROP J 1 - COL- DROP \\<-I.INP ROW- DROP '\\<-INP.cut' STO \\>> \\>>" " " "'EQ\\1831\\->INEQ\\1832'" " " "\\<< \\<-m0 0 \\-> ii \\<< DUP SIZE OBJ\\-> DROP '\\<-J' STO '\\<-I' STO DUP '\\<-m0' STO 1 \\<-I 1 - 2 * FOR i 2 'ii' STO+ i ROW- DUP \\<-J 1 - GET 'E' SAME IF THEN \\<-J 1 - 'G' PUT DUP \\<-J 1 - 'L' PUT UNROT i ROW+ SWAP i ROW+ 1 'i' STO+ ELSE i ROW+ END ii 2 \\<-I 1 - * == IF THEN ii 'i' STO END NEXT DUP SIZE OBJ\\-> DROP2 '\\<-I' STO '\\<-m0' STO \\>> \\>>" " " "'FREExi\\1661C\\->2C'" " " "\\<< 0 \\-> ii \\<< \\<-m0 1 \\<-I 1 - FOR i i ii - ROW- \\-> r \\<< r \\<-J 1 - GET 'F' SAME IF THEN 1 '\\<-xab' STO 1 'ii' STO+ 1 \\<-J 2 - FOR j r j GET 1 == IF THEN j '\\<-F.l' STO+ \\<-J 2 - 'j' STO END NEXT ELSE r i ii - ROW+ END \\>> NEXT '\\<-m0' STO \\<-F.l SORT '\\<-F.l' STO 1 \\<-J 2 - FOR j j \\<-F.l j POS 0 \\=/ IF THEN DUP END NEXT \\<-J 2 - \\<-F.l SIZE + \\->LIST '\\<-F.l2' STO 1 \\<-J 2 - FOR j \\<-m0 j COL- SWAP DROP \\<-F.l j POS 0 \\=/ IF THEN DUP -1 * END NEXT \\<-m0 \\<-J 1 - COL- SWAP DROP \\<-m0 \\<-J COL- SWAP DROP \\<-J \\<-F.l SIZE + COL\\-> DUP SIZE OBJ\\-> DROP '\\<-J' STO '\\<-I' STO '\\<-m0' STO \\>> \\>>" " " "'INEQ.INPUT\\166G\\->INEQ\\166L'" " " "\\<< \\<-m0 1 \\<-I 1 - FOR i i ROW- DUP \\<-J 1 - GET 'G' SAME IF THEN -1 * \\<-J 1 - 'L' PUT END i ROW+ NEXT '\\<-m0' STO \\>>" " " "'INEQ.LESS\\->TAB.OPPs'" " " "\\<< \\<-m0 1 \\<-I 1 - FOR i 1 \\<-J 2 - FOR j { i j } DUP2 GET -1 * PUT NEXT NEXT :: EVAL MAP '\\<-m0' STO \\>>" " " "'\\->SIGN.xi\\166&xiL0\\->XiG0'" " " "\\<< \\<-m0 1 \\<-I 1 - FOR i i ROW- DUP \\<-J COL- SWAP \\<-J 1 - COL- DROP DUPDUP DOT \\v/ \\-> Ci row Rdot \\<< i ROW+ 1 \\<-J 2 - FOR j row j GET ABS Rdot == IF THEN row j GET SIGN -1 == Ci 0 \\<= AND IF THEN j COL- -1 * j COL+ \\<-l.xi.s j -1 PUT '\\<-l.xi.s' STO END END NEXT \\>> NEXT '\\<-m0' STO \\>>" " " "'\\->TAB.\\Gb0\\166MinCi\\166LESS?0'" " " "\\<< \\<-m0 SIZE OBJ\\-> DROP R\\->I '\\<-J' STO '\\<-I' STO \\oo '\\<-minCi' STO 1 \\<-I FOR i \\<-m0 { i \\<-J } GET DUP 0 < IF THEN DUP \\<-minCi < IF THEN '\\<-minCi' STO ELSE DROP END ELSE DROP END NEXT \\<-minCi 0 < IF THEN 1 \\<-I FOR i \\<-m0 { i \\<-J } DUP2 GET \\<-minCi - PUT '\\<-m0' STO NEXT { 1 \\<-J } 0 CON 1 \\<-J 1 - 2 \\->LIST 1 PUT { 1 \\<-J } \\<-minCi NEG PUT DUP -1 * \\<-m0 ROT \\<-I 1 + ROW+ SWAP \\<-I 2 + ROW+ 1 \\<-I FOR i i \\<-J 1 - 2 \\->LIST 1 PUT NEXT ELSE \\<-m0 \\<-Zrow \\<-MiMa.s * \\<-I 1 + ROW+ \\<-J 1 - COL- DROP DUP '\\<-m0' STO END \\>>" " " "'\\->LABEL'" " " "\\<< DTAG DUP SIZE OBJ\\-> DROP \\-> I J \\<< \\<-l.xi OBJ\\-> J 1 - < IF THEN DUP \"\" + \"b\" \"\" SREPL DROP \"x\" \"\" SREPL DROP OBJ\\-> 1 + R\\->I \"x\" SWAP + OBJ\\-> END 'Con1' { 1 J } \\->ARRY 1 ROW+ 0 1 I 1 - FOR i \"y\" I 11 \\>= i 10 < AND IF THEN 0 + END i R\\->I + OBJ\\-> NEXT 'Z' I 1 + 1 2 \\->LIST \\->ARRY 1 COL+ \\->\\Gb? CLLCD \"\\|> Check/Edit Stack \\|^ for added Var \\Gbi \\<- \\-> when Axi + <Ci, \\|v Ci<0 \\-> xi=\\Gbi\\177\\Ga or when xi\\<=0 \\->xi=-\\Gbi \\|> If OK: ENTER & CONT\" \"3 DISP 2 FREEZE HALT\" \"Now 3 lines useless\" 3 DROPN \\>> \\>>" " " "'\\->\\Gb?'" " " "\\<< DUP SIZE OBJ\\-> DROP \\-> m I J \\<< 2 I 1 - FOR i m i ROW- SWAP DROP 1 COL- DROP J 1 - COL- DROP 0 0 \\-> v t ij \\<< 1 J 2 - FOR j v j GET ABS 1 == IF THEN j 'ij' STO J 'j' STO END NEXT ij 0 > IF THEN v DUP DOT \\-> dot \\<< dot 1 == IF THEN 1 'ij' STO+ m { 1 ij } GET \\->STR 1 2 SUB \"'\\Gb\" \\=/ IF THEN IF m { i ij } GET -1 == m { i J } GET 0 \\<= AND THEN \"no more relevant\" DROP END m { i ij } GET -1 == m { i J } GET 0 > AND NOT IF THEN m { 1 ij } '\\Gb' ij 1 - R\\->I \\->STR + OBJ\\-> PUT { i 1 } 1 FS? IF THEN 'x' ij 1 - R\\->I \\->STR + OBJ\\-> ELSE \\<-l.xi ij 1 - GET END PUT 'm' STO END END END \\>> END \\>> NEXT m \\>> \\>>" " " "'STEP0'" " " "\\<< \"DUP SIZE OBJ\\-> DROP \\-> m I J \\<< 2 J 1 - FOR i m { I i } DUP2 GET \\<-MiMa.s * PUT 'm' STO NEXT m\" DROP DUP DUP \"Step 0\" \\->TAG UNROT \\>>" " " "'\\->LIST.xi'" " " "\\<< \\<-F.l2 DUP SIZE \\-> l s \\<< { } 1 s 1 - FOR j l j GET l j 1 + GET == IF THEN \"x\" \\<-J 11 > l j GET 10 < AND IF THEN 0 + END l j GET R\\->I + DUP \"b\" + OBJ\\-> UNROT \"a\" + OBJ\\-> + SWAP + 1 'j' STO+ ELSE \"x\" \\<-J 11 > l j GET 10 < AND IF THEN 0 + END l j GET R\\->I + OBJ\\-> + END NEXT DUP SIZE s < IF THEN \"x\" l s GET R\\->I + OBJ\\-> + END '\\<-l.xi' STO \\>> \\>>" " " "'TEST.auto'" " " "\\<< \\<-Auto 0 == IF THEN HALT END \\>>" " " "'LOOP'" " " "\\<< { \"Col#: Var Possib\\->\" } DUP DUP \\-> \\<-\\Gb.l \\<-N.l \\<-v.l \\<< \\->Col DUP 'F' SAME IF THEN DROP 1 ELSE 0 END C\\->L \\->PIVOT\\166&COL.ROW \\<-STACK.full 0 == IF THEN 4 ROLL DROP 4 ROLL DROP END TEST.auto DUP SIZE OBJ\\-> DROP \\-> m I J \\<< CASE \\<-\\Gb.l SIZE 2 > THEN m LOOP END \\<-\\Gb.l SIZE 2 == \\<-N.l SIZE 1 > AND \\<-\\Gb.l SIZE 1 == \\<-N.l SIZE 2 > AND OR THEN m LOOP END END 0 2 J 1 - FOR j m { I j } GET 0 > IF THEN 1 + END NEXT 0 == IF THEN m \\->SOL ELSE m LOOP END \\>> \\>> \\>>" " " "'\\->Col'" " " "\\<< DUP SIZE OBJ\\-> DROP { } DUP DUP DUP DUP 0 0 \\-> m I J \\Gb.lc N.lc v.lc \\<-l.v \\<-l.c \\<-choi.c \\<-ok \\<< 2 J 1 - FOR j 0 \\-> count.s \\<< 2 I 1 - FOR i m { I j } GET DUP 0 == IF THEN DROP I 'i' STO ELSE m { i j } GET * 0 < IF THEN 1 'count.s' STO I 'i' STO END END NEXT count.s 0 > IF THEN m { 1 j } GET \\-> m1j \\<< m1j CASE m1j \\->STR 2 2 SUB \"\\Gb\" SAME THEN j 1 - R\\->I DUP '\\Gb.lc' STO+ \\->TAG '\\<-\\Gb.l' STO+ END m1j \\->STR 2 2 SUB \"N\" SAME THEN j 1 - R\\->I DUP 'N.lc' STO+ \\->TAG '\\<-N.l' STO+ END m { I j } GET 0 > IF THEN j 1 - R\\->I DUP 'v.lc' STO+ \\->TAG '\\<-v.l' STO+ ELSE DROP END END \\>> END \\>> NEXT \\Gb.lc REVLIST '\\Gb.lc' STO \\<-\\Gb.l REVLIST '\\<-\\Gb.l' STO N.lc REVLIST 'N.lc' STO \\<-N.l REVLIST '\\<-N.l' STO \\<-v.l REVLIST '\\<-v.l' STO v.lc REVLIST 'v.lc' STO CASE \\<-\\Gb.l SIZE 1 > THEN \\<-\\Gb.l \\Gb.lc END \\<-N.l SIZE 1 > THEN \\<-N.l N.lc END \\<-v.l v.lc END '\\<-l.c' STO '\\<-l.v' STO \\<-l.c DUP SIZE 0 == IF THEN DROP m \\->SOL END 1 GET '\\<-choi.c' STO TEST.col SWAP DROP m SWAP \\<-\\Gb.l SIZE 1 > \\<-N.l SIZE 1 > OR IF THEN 'F' END \\>> \\>>" " " "'TEST.col'" " " "\\<< \"\" 0 \\-> ok \\<< DO DROP \\<-l.v \\<-l.c 1 GET \"Edit Sugg Col#\" \\->TAG TEST.auto '\\<-choi.c' STO \\<-l.c DUP SIZE \\-> l s \\<< 1 s FOR i l i GET \\<-choi.c == IF THEN 1 'ok' STO s 'i' STO END NEXT \\>> UNTIL ok 1 == END \\<-choi.c \\>> \\>>" " " "'C\\->L'" " " "\\<< ROT DUPDUP SIZE OBJ\\-> DROP \\oo NEG 0 \\-> l F m mn I J minmax k \\<< 1 'l' STO+ m { I l } GET DUP SIGN F 1 == IF THEN \"(to elimin \" m { 1 l } GET + \")\" + 2 ELSE 1 END \"Ratios w/ C\" l 1 - R\\->I + SWAP \\->LIST \\-> z zs l.q \\<< 2 I 1 - FOR i m { i l } GET DUP z * 0 < IF THEN m { i J } GET SWAP / EVAL DUP i 1 - R\\->I \"L\" SWAP + \\->TAG 'l.q' STO+ zs * DUP minmax > IF THEN i 'k' STO 'minmax' STO ELSE DROP END ELSE DROP END NEXT m l.q REVLIST \"L\" k 1 - R\\->I + OBJ\\-> zs 0 < \"Min\" \"Max\" IFTE \\->TAG + TEST.auto m k l \\>> \\>> \\>>" " " "'DISPLAY'" " " "\\<< EVAL DUP \\-> s \\<< TYPE 9 == IF THEN s DUP ROUND\\1669&0 2 \\->ARRY ELSE s ROUND\\1669&0 END \\>> \\>>" " " "'\\->SLACK.\\Gb'" " " "\\<< 1 FS? IF THEN \\<-J 1 - R\\->I DUP \"Part1\\166added x\" SWAP + \"=\" + \"\\Gb\" ROT + \"+\" + + \\<-minCi NEG DUP FP 0 == IF THEN R\\->I END SWAP \\->TAG 1 \\->LIST 'SLACK.\\Gb' STO 4 \\<-J 1 + FOR j SOL j GET DUP OBJ\\-> DUP \"=\" + SWAP \"x\" \"\\Gb\" SREPL DROP + SWAP DUP TYPE 29 == IF THEN 1 GET END 0 \\>= IF THEN \"+\" ELSE \"-\" END + SWAP DTAG DUP TYPE 29 == IF THEN 1 GET END ABS SWAP j 4 == IF THEN \"Part2\\166with \" SWAP + END \\->TAG SLACK.\\Gb SWAP + 'SLACK.\\Gb' STO NEXT END \\>>" " " "'SOL\\Gbi\\->VECT\\Gbi'" " " "\\<< 4 \\<-J 1 + FOR j SOL j GET DTAG DUP TYPE 29 == IF THEN 1 GET END NEXT 1 \\<-J 1 - \\->ARRY '\\<-VECT\\Gbi' STO \\>>" " " "'\\->M\\166FOR.2ndMAIN'" " " "\\<< \\<-m00 \\<-Zrow \\<-I 1 + ROW+ \\<-J 1 - COL- DROP '\\<-m0' STO \\<-m0 1 \\<-I 1 + FOR i i ROW- DUP \\<-VECT\\Gbi DOT \\<-J 1 - SWAP PUT i ROW+ NEXT \\<-J 2 - IDN \\<-VECT\\Gbi \\<-J 1 - COL- DROP \\<-J 1 - ROW+ TRN 1 ROW+ \\>>" " " "'\\->SOL'" " " "\\<< DUP SIZE OBJ\\-> 0 0 \\-> m I J lf xi p \\<< { } 1 I 1 - FOR i m { i 1 } GET + NEXT 'lf' STO m { } m { I J } GET \\<-MiMa.s * DISPLAY 1 FC? IF THEN DUP DUP TYPE 29 == IF THEN 1 GET END '\\<-Z' STO CHECK.lin.comb2 END \\<-MiMa.s 1 == IF THEN \" Z-Max\" ELSE \" Z-Min\" END \\->TAG + 1 \\<-l.xi SIZE FOR i lf \\<-l.xi i GET DUP UNROT POS 'p' STO 'xi' STO 1 FS? IF THEN p 0 == IF THEN 0 ELSE m { p J } GET END ELSE xi \"\" + DUP SIZE DUP2 \\-> x xs \\<< DUP SUB \"a\" SAME IF THEN p 0 == IF THEN 0 ELSE m { p J } GET \\<-l.xi.s i GET * END 1 'i' STO+ lf \\<-l.xi i GET POS 'p' STO p 0 == IF THEN 0 ELSE m { p J } GET \\<-l.xi.s i GET * END - x 1 xs 1 - SUB OBJ\\-> 'xi' STO ELSE lf \\<-l.xi i GET DUP UNROT POS 'p' STO 'xi' STO p 0 == IF THEN 0 ELSE m { p J } GET \\<-l.xi.s i GET * END END \\>> END DISPLAY 1 FC? IF THEN DUP xi\\->V END xi \\->TAG + NEXT 0 SWAP + \"Var\\|>\" \\<-Jor 2 - R\\->I + \"\\166\" + \"Steps\\|>\" + 1 FS? IF THEN m 1 GET DUP '\\<-step0' STO + ELSE m 1 GET \\<-step0 0 > \\<-step0 0 IFTE + + END OBJ\\-> SWAP + \"Sol\" \\->TAG 2 FS? IF THEN SWAP \"Final Step\" \\->TAG SWAP DUP \\<-STACK.full 0 == IF THEN 6 ROLLD 4 ROLL 4 ROLL DROP2 3 ELSE m 1 GET 1 + 2 * 1 + DUP \\-> s2 \\<< ROLL DROP s2 ROLL DROP s2 ROLL DROP s2 ROLLD s2 1 - \\>> END SWAP DROP 1 - \\->LIST DUP 1 GET DTAG \"Step-0 (total: \" m 1 GET R\\->I 1 FS? IF THEN DUP '\\<-step0' STO END + \")\" + \\->TAG 1 SWAP PUT \\<-step0 0 > 1 FC? AND IF THEN SLACK.\\Gb TAIL SWAP + SLACK.\\Gb HEAD :as in transf. '\\<=': some.Ci \\<-minCi \"<0 Ci min\" \\->TAG 2 \\->LIST + \\<-STEPS.x\\Gb + { \\173\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173 } + SWAP + END 'STEPS' STO END 2 \"\" PUT DUP DUP 'SOL' STO \\->STR 1 FC? IF THEN DROP2 m CHECK.UNBOUND CHECK.INEQ SOL 2 \"Time\\|>\" TICKS \\<-time - B\\->R 8192 / 0 RND R\\->I + \"\\166s\" + OBJ\\-> PUT DUP DUP 'SOL' STO \\->STR CASE d\\Gm 0 \\=/ THEN DROP2 SOL d\\Gm \" Above Sol 1+\\Gm\" xP 1 == IF THEN \"[\\>=0]\" ELSE free END + \"*d,d\" + \\->TAG + DUP DUP 'SOL' STO \\->STR END m CHECK.2SOL 2 FC? THEN 3 DROPN 'For\\1662nd.Main.Sol' \"Additional Step\" \\->TAG SWAP 1 \\->LIST + \\<-STEPS1 SWAP + 'STEPS' STO \\<-RESULT1.ROW RESULT.ROW 4 COL+ 'RESULT.ROW' STO DROP2 \"inCol\\166\" \\<-jj 1 - R\\->I + \"\\166addit.STEPS\" + OBJ\\-> \" Main Sol 2,as Zrow=0\" \\->TAG SOL + \\<-SOL1 SWAP + DUP 'SOL' STO DUP \\->STR END \\<-\\ooSOL 0 \\=/ THEN DROP2 \"\\ooUnbound.Sol\\->\\oo\" \\<-MiMa.s 1 == \"Max\" \"Min\" IFTE + OBJ\\-> \"'Sol' is no \" \\<-MiMa.s 1 == \"Max\" \"Min\" IFTE + \"!\" + \\->TAG SOL + \"in.Col\\166\" \\<-\\ooSOL R\\->I + \"\\166final.STEPS\" + OBJ\\-> \" as only positive Val\" \\->TAG + DUP DUP 'SOL' STO \\->STR END END row.prob 1 == IF THEN DROP \\180Sol\\180\\166VIOLATES.input \" Attention ! Found\" \\->TAG + \\<-row.prob.l \"Inequal (Ci) at\" \\->TAG + DUP DUP 'SOL' STO \\->STR END DROP \\<-xab 1 == IF THEN :NB xi Free \\->xia-xib=: xi '\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173' STEPS + + 'STEPS' STO END \\<-xab 1 == IF THEN :xia-xib=: xi\\166for\\183xi\\166Free 1 \\->LIST SLACK.\\Gb DUP TYPE 5 == IF THEN + ELSE DROP END 'SLACK.\\Gb' STO END S.lin 0 \\=/ IF THEN DROP SOL S.lin \" Or not? SIMPLEX Sol 2\" \\->TAG + d\\Gm 0 \\=/ IF THEN d\\Gm \" + \\Gm\" xP 1 == IF THEN \"[\\>=0]\" ELSE free END + \"*d, d\" + \\->TAG + END d\\Gm 0 \\=/ IF THEN Plus \" \\->Mixed Solution a(Sol 1) + b(not? SIMPLEX Sol 2) |a-b|=1\" \\->TAG + d\\Gm \" \\Gm\" xP 1 == IF THEN \"[\\>=0]\" ELSE free END + \"*d, d\" + \\->TAG + END DUP 'SOL' STO END S.1\\173N OBJ\\-> \\<-Jor 2 - / 1 > IF THEN \\<-Jor 2 - \\->ARRY \\<-Jor 1 - ROLLD \\<-Jor 2 - \\->ARRY SWAP 2 \\->LIST S.lin 0 \\=/ IF THEN S.lin + END EXPAND SAME.Sol ELSE \\<-Jor 2 - \\->ARRY S.lin 0 \\=/ IF THEN S.lin DUP TYPE 5 \\=/ IF THEN 1 \\->LIST END + EXPAND SAME.Sol END END DUP DUP TYPE 5 == IF THEN SIZE 1 == IF THEN 1 GET ELSE END ELSE DROP END 'S.1\\173N' STO \\<-fg STOF row.prob 1 == \\<-\\ooSOL 0 \\=/ OR d\\Gm 0 \\=/ S.lin 0 \\=/ OR OR \\<-SOL1 0 \\=/ OR IF THEN \"Attention ! Read carefully: special result\" DOERR ELSE KILL END END \\>> \\>>" " " "'CHECK.lin.comb2'" " " "\\<< Mult.Lin.D 1 == IF THEN \\<-INPUTmod :: \\->Q MAP DUP SIZE OBJ\\-> DROP 1 - 0 0 \\-> m I J L.Comb L.s \\<< m J COL- DROP I J * \\<-Z PUT J COL- NEG J COL+ 'm' STO -1 'J' STO+ { } I J MIN 1 J FOR j j NEXT J \\->LIST Comb DUP 'L.Comb' STO SIZE 'L.s' STO 1 L.s FOR i L.Comb i GET \\-> l0 \\<< { I 1 } 0 CON 2 I J MIN FOR i m l0 i GET COL- SWAP DROP i COL+ NEXT 1 COL- DROP m l0 1 GET COL- SWAP DROP 1 COL+ m J 1 + COL- SWAP DROP I J MIN 1 + COL+ RREF \\-> r \\<< 1 1 I FOR i CASE r i ROW- SWAP DROP DUP DOT 0 == THEN 1 END r i ROW- I J MIN 1 + COL- DROP SWAP DROP DUP DOT 1 == THEN 0 1 I J MIN FOR j r { i j } GET ABS + NEXT 1 == 1 0 IFTE END 0 END * NEXT xP 1 == IF THEN 1 I FOR i r i I J MIN 1 + 2 \\->LIST GET 0 > IF THEN I 'i' STO 0 * END NEXT END 0 \\=/ IF THEN r I J MIN 1 + COL- SWAP DROP 1 J FOR j l0 j POS 0 == IF THEN 0 j COL+ END NEXT NEG I J > IF THEN J 1 + I START J 1 + COL- DROP NEXT END + END \\>> \\>> NEXT DUP SIZE 0 > IF THEN EXPAND SAME.Sol DUP SIZE 1 == IF THEN 1 GET END 'S.lin' STO ELSE DROP END \\>> END \\>>" " " "'S.lin'" " " "0" " " "'CHECK.UNBOUND'" " " "\\<< DUP SIZE OBJ\\-> DROP UNROT ROW- SWAP DROP \\-> J r \\<< 2 J 1 - FOR j r j GET 0 > IF THEN j 1 - '\\<-\\ooSOL' STO J 1 - 'j' STO END NEXT \\>> \\>>" " " "'CHECK.INEQ'" " " "\\<< \\->Ci.sol ROW.CHECK \\>>" " " "'ROW.CHECK'" " " "\\<< 1 \\<-I.INP 1 - FOR i \\<-Ci.sol i GET ROUND\\1669&0 -105 FS? IF THEN \\->NUM ELSE \\->Q END \\<-INPUTmod { i \\<-Jor } GET \\<-INPUTmod i \\<-Jor 1 - 2 \\->LIST GET \\-> Cs Ci in \\<< Cs in \"E\" + CASE in 'G' SAME THEN Cs Ci \\>= IF THEN \"\" ELSE \"not\\|>\" END END in 'L' SAME THEN Cs Ci \\<= IF THEN \"\" ELSE \"not\\|>\" END END in 'E' SAME THEN DROP \"E\" Cs Ci == IF THEN \"\" ELSE \"not\\|>\" END END DROP \"L\\166G\" \"\" END DUP \"not\\|>\" SAME IF THEN 1 'row.prob' STO \\<-row.prob.l i R\\->I \"row\" \\->TAG + '\\<-row.prob.l' STO END SWAP + OBJ\\-> Ci \\>> NEXT \\<-I.INP 1 - 3 2 \\->LIST \\->ARRY 'RESULT.ROW' STO \\>>" " " "'\\->Ci.sol'" " " "\\<< \\<-INP.cut 4 \\<-Jor 1 + FOR i SOL i GET DTAG DUP TYPE 29 == IF THEN 1 GET END NEXT \\<-Jor 2 - 1 2 \\->LIST \\->ARRY * '\\<-Ci.sol' STO \\>>" " " "'row.prob'" " " "0" " " "'RESULT.ROW'" " " "[[ 50 'LE' 50 20 'LE' 50 ] [ 100 'LE' 100 100 'LE' 100 ] [ 75 'LE' 90 60 'LE' 90 ]]" " " "'CHECK.2SOL'" " " "\\<< 2 FS? d\\Gm 0 == AND IF THEN DUP DUP SIZE OBJ\\-> DROP UNROT DUP UNROT ROW- SWAP DROP \\oo NEG 0 1 \\-> m J I r max.i ii s2 \\<< 2 J 1 - FOR j r j GET 0 > IF THEN 0 's2' STO END NEXT s2 1 == IF THEN J 1 - 2 FOR j r j GET 0 == IF THEN 2 I 1 - FOR i m { i j } GET DUP 0 < IF THEN \\<-STACK.full 0 == IF THEN \"Dum\" DUP 5 ROLLD 5 ROLLD END 2 CF m { i J } GET SWAP / DUP max.i > IF THEN 'max.i' STO i 'ii' STO j '\\<-jj' STO I 1 - 'i' STO 0 'j' STO ELSE DROP END ELSE DROP END NEXT END -1 STEP \\<-jj 0 > IF THEN 2 CF m ii \\<-jj \\->PIVOT\\166&COL.ROW SLACK.\\Gb '\\<-SLACK1.\\Gb' STO RESULT.ROW '\\<-RESULT1.ROW' STO STEPS '\\<-STEPS1' STO \"in.Col\\166\" \\<-jj 1 - R\\->I + \"\\166final.STEPS\" + OBJ\\-> \" Main Sol 1,as Zrow=0\" \\->TAG SOL + '\\Gl\\184GE\\1660\\183and\\183\\Gl\\184LE\\1661' \"\\GlSol 1+(1-\\Gl)Sol 2\" \\->TAG SWAP + '\\<-SOL1' STO \\->SOL END END \\>> END \\>>" " " "'xi\\->V'" " " "\\<< DUP TYPE 29 == IF THEN 1 GET END S.1\\173N SWAP + 'S.1\\173N' STO \\>>" " " "'\\->PIVOT\\166&COL.ROW'" " " "\\<< DUP2 \\-> k l \\<< 1 - SWAP 1 - SWAP Mkl\\->N UNROT DROP2 DUP 1 GET 1 + 1 R\\->I SWAP PUT DUPDUP { k 1 } GET SWAP { 1 l } GET ROT { k 1 } ROT PUT { 1 l } ROT PUT DUP { k 1 } GET \\->STR 2 2 SUB \"\\Gb\" SAME IF THEN k ROW- DROP END \\>> \\>>" " " "'Mkl\\->N'" " " "\\<< \"Used in Prog, but can be used alone \\-> 3 Arg: - Mat . without labels . or w/ 1 label line & w/ 1 label col - Pivot line k(without counting label line) - Pivot col l (without counting label col) 3 Outputs: - Orig Mat - {k l} - Simplex transf Mat\" DROP ROT DUP DUP SIZE OBJ\\-> DROP 1 \\-> k l m mn I J lab \\<< m { I 1 } GET TYPE 6 \\=/ IF THEN 0 'lab' STO m { 1 J } 0 CON 1 ROW+ I 1 + 1 2 \\->LIST 0 CON 1 COL+ DUP 'm' STO 'mn' STO 1 'I' STO+ 1 'J' STO+ END 1 'k' STO+ 1 'l' STO+ 2 I FOR i 2 J FOR j i k \\=/ j l \\=/ * IF THEN m { i j } GET m { i l } GET m { k j } GET * m { k l } GET / - EVAL mn { i j } ROT PUT 'mn' STO ELSE END NEXT NEXT 2 I FOR i i k \\=/ IF THEN m { i l } GET m { k l } GET / EVAL mn { i l } ROT PUT 'mn' STO END NEXT 2 J FOR j j l \\=/ IF THEN m { k j } GET m { k l } GET / NEG EVAL mn { k j } ROT PUT 'mn' STO END NEXT m { k l } GET INV EVAL mn { k l } ROT PUT lab 0 == IF THEN 1 ROW- DROP 1 COL- DROP m 1 ROW- DROP 1 COL- DROP :: EVAL MAP 'm' STO END m \"L\" k 1 - + OBJ\\-> \"C\" l 1 - + OBJ\\-> 2 \\->LIST ROT \\>> \\>>" " " "'ROUND\\1669&0'" " " "\\<< \"Input: any Number (fractions allowed)\" DROP \"999999\" \"Modify above previous string for rounding. If that string has: \\oo\\oo \\-> no rounding (twice infinity sign!) 999999 \\-> round. when occurr 6 9s or 6 0s Ex Inp. (-)2.39999993 \\-> Output: (-)2.4 Ex Inp. (-)5.70000008 \\-> Output: (-)5.7 99999 \\-> round. when occurr 5 9s or 5 0s etc \" DROP SWAP STD EVAL DUP DUP FP 0 \\=/ IF THEN SIGN EVAL SWAP ABS EVAL DUP IP SWAP FP \\->STR 0 5 ROLL DUP SIZE \"\" 1 ROT START \"0\" + NEXT \\-> s i f p nine zero \\<< nine \"\\oo\\oo\" SAME IF THEN nine 'zero' STO END CASE f nine POS 'p' STO p 3 > THEN f 1 p 1 - SUB \".\" 1 p 3 - START 0 + NEXT 1 + END f nine POS 'p' STO p 3 == THEN f 1 p 1 - SUB \".1\" END f nine POS 'p' STO p 2 == THEN \"0\" \"1\" END f zero POS 'p' STO p 2 > THEN f 1 p 1 - SUB \"0\" END f zero POS 'p' STO p 2 == THEN \"0\" DUP END f \"0\" END OBJ\\-> SWAP OBJ\\-> + i + s * DUP FP 0 == IF THEN R\\->I END \\>> ELSE ROT DROP2 R\\->I END \\>>" " " "'NOTE'" " " "\\<< CLLCD \"\\|> \\->PIVOT or Mkl\\->N may be used outside the Prog to 'pivot' MATR \\183with col/line labels \\183or without labels \\|> For Roundings like \\1832.37999999 \\->2.38 \\1834.230000001 \\->4.23 \\-> See ROUND\\1669&0\" 1 DISP 7 FREEZE \\>>" " " "'VERS'" " " "\\<< CLLCD \"VER 8e 2023.01.02 Max/Min SIMPLEX campart@hotmail.com (according to 'Lineare Algebra',1980 by Kirchgraber/Marti) \" 1 DISP 7 FREEZE \\>>" " " "'DATA'" " " "DIR SPECIAL DIR \\->GO \\<< UPDIR UPDIR \\->GO \\>> SPEED.RDOM \\<< \"Test Fictive Ineq \\<= 2 Arg: \\183n for #Ineq \\183z for RDZ\" DROP RDZ \\-> n \\<< 1 n SQ START RAND 10 * 1 + IP R\\->I RAND .5 \\>= IF THEN NEG END NEXT { n n } \\->ARRY -1 * 1 n START RAND 10 * 1 + IP R\\->I NEXT { 1 n } \\->ARRY n 1 + ROW+ 1 n 1 + START RAND 100 * 1 + IP R\\->I NEXT n 1 + 1 \\->LIST \\->ARRY n 1 + COL+ 1 n START 'L' NEXT 0 n 1 + 1 2 \\->LIST \\->ARRY n 1 + COL+ \\->GO \\>> \\>> UNBO1 [[ 2 -3 'L' 4 ] [ 5 -3 'G' 100 ] [ 1 1 0 'Max' ]] UNBO2 \\<< 1: { 32 -20 } :Other: { { 2000 -1332 } { 10000 -3332 } } [[ 2 3 'L' 4 ] [ 5 3 'G' 100 ] [ 0 1 'L' 0 ] [ 1 -1 0 'Max' ]] \\>> UNBO3 [[ 2 3 'L' 4 ] [ 5 3 'G' 10 ] [ 0 1 'L' 0 ] [ 1 -1 0 'Max' ]] \\GlS\\GlS1 [[ 8 6 1 'L' 48 ] [ 4 2 1.5 'L' 20 ] [ 2 1.5 .5 'L' 8 ] [ 0 1 0 'L' 5 ] [ 60 35 20 0 'Max' ]] \\GlS\\GlS2 [[ 6 9 'L' 100 ] [ 2 1 'L' 20 ] [ 2000 3000 0 'Max' ]] \\GlS\\GlS3 [[ 2 1 'L' 50 ] [ 2 5 'L' 100 ] [ 2 3 'L' 90 ] [ 4 10 0 'Max' ]] \\GlS\\GlS4 [[ 2 1 'L' 80 ] [ 2 3 'L' 120 ] [ 20 30 0 'Max' ]] \\GlS\\GlS5 [[ 1 2 'L' 5 ] [ 1 1 'L' 4 ] [ 2 4 0 'Max' ]] \\GlS\\GlS6 [[ 2 1 3 'L' 10 ] [ 1 1 0 'L' 5 ] [ 0 1 0 'L' 1 ] [ 2 1 3 0 'Max' ]] S&\\Gl1 [[ 1 0 0 '1/4' -8 -1 9 'E' 0 ] [ 0 1 0 '1/2' -12 '-1/2' 3 'E' 7 ] [ 0 0 1 0 0 1 0 'E' 1 ] [ 0 0 0 '3/4' 20 '-1/6' 6 0 'Min' ]] S&\\Gl2 [[ 1 -1 1 -1 0 'E' 2 ] [ 2 -2 -1 0 1 'E' 0 ] [ 1 -1 3 0 0 0 'Min' ]] CYCLE \\<< \"\\oo Loops/steps & same table \\-> no Sol\" 1 DISP 7 FREEZE [[ 9 -9 -2 1 'L' 0 ] [ -2 1 '1/3' '-1/3' 'L' 0 ] [ -12 3 2 -1 'L' 2 ] [ -12 3 2 -1 0 'Max' ]] \\>> SPEC.SPEC \\<< \"S=\\Glx1+(1-\\Gl)x2 0\\<=\\Gl\\<=1 +\\Gm1d1+\\Gm2d2 \\Gmi\\>=0 \\->Incorrect! Correct is S=ax1+bx2 |a-b|=1 +\\Gm1d1+\\Gm2d2 \\Gmi\\>=0 x1:[0 2 2 0 5 0 17] x2:[5 2 11/3 0 0 0 121/3] d1:[0 1 0 0 1 1 4] d2:[1 1 1/3 0 0 1 26/3] https://ieeexplore.ieee.org/stamp/stamp....er=6075407\" 1 DISP 7 FREEZE [[ 1 -1 0 0 1 0 0 'E' 3 ] [ -3 2 9 2 0 -2 0 'E' 22 ] [ 0 1 0 0 0 -1 0 'E' 2 ] [ 4 3 5 0 1 0 -1 'E' 4 ] [ -1 0 3 -1 0 0 0 0 'Max' ]] \\>> END \\->GO \\<< UPDIR \\->GO \\>> M0 [[ 2 1 'L' 50 ] [ 2 5 'L' 100 ] [ 2 3 'L' 90 ] [ 4 10 0 'Max' ]] M44 [[ 1 2 'L' 110 ] [ 1 4 'L' 160 ] [ 1 1 'L' 100 ] [ 1 4 'G' 130 ] [ 1 -3 0 'Max' ]] M44b [[ 2 1 'L' 110 ] [ 4 1 'L' 160 ] [ 1 1 'L' 100 ] [ 4 1 'G' 130 ] [ -3 1 0 'Max' ]] M44FU [[ 1 0 0 0 'F' 0 ] [ 0 1 0 0 'F' 0 ] [ 0 0 1 0 'F' 0 ] [ 0 0 0 1 'F' 0 ] [ 4 4 3 7 'L' 90 ] [ 6 3 5 4 'L' 120 ] [ 5 2 3 3 'L' 60 ] [ 6 5 1 2 'L' 100 ] [ 75 65 80 75 0 'Max' ]] M3V [[ 1 -1 1 'E' 0 ] [ 0 -1 4 'E' 1 ] [ -1 -4 -2 0 'Max' ]] M4Va [[ 4 4 3 7 'L' 90 ] [ 6 3 5 4 'L' 120 ] [ 5 2 3 3 'L' 60 ] [ 0 1 0 0 'L' 15 ] [ 1 0 0 0 'L' 10 ] [ 6 5 1 2 'L' 100 ] [ 75 65 80 75 0 'Max' ]] M4Vb [[ 0 0 1 0 'F' 0 ] [ 0 0 0 1 'F' 0 ] [ 4 4 3 7 'L' 90 ] [ 6 3 5 4 'L' 120 ] [ 5 2 3 3 'L' 60 ] [ 0 1 0 0 'L' 15 ] [ 1 0 0 0 'L' 10 ] [ 6 5 1 2 'L' 100 ] [ 75 65 80 75 0 'Max' ]] MMIN [[ 2.5 2 'G' 15 ] [ 1 2.5 'G' 25 ] [ 1 0 'G' 12 ] [ 100 120 0 'Min' ]] END" " SLACK.ß "No transf/slack ß" MAIN LABEL "\\<< \\->LABEL STEP0 DUP DUP DUP SIZE OBJ\\-> DROP 3 DROPN LOOP \\>>" |
|||
01-04-2023, 03:57 PM
(This post was last modified: 01-04-2023 04:02 PM by Gil.)
Post: #16
|
|||
|
|||
RE: HP49G-50G Version 8f Simplex Max Min Pivot Algorithm, multiple/unbounded solutions
Remember
as explained in previous Note 11c above When choosing for approximation mode (question 4/5 in OPTIONS prompted), you might get unexpected, special solutions. Example Go (press) DATA directory (last menu page). Go then to (press) SPECIAL directory. Choose last variable (last menu page) called SPEC.SPEC. You should get [[ 1 -1 0 0 1 0 0 'E' 3 ] [ -3 2 9 2 0 -2 0 'E' 22 ] [ 0 1 0 0 0 -1 0 'E' 2 ] [ 4 3 5 0 1 0 -1 'E' 4 ] [ -1 0 3 -1 0 0 0 0 'Max' ]] Press then —>GO. a) Press 5 times ENTER. The full solution is then given by {lambda × [ 0 2 2 0 5 0 17 ] + (1-lambda) [ 5 2 '11/3' 0 0 0 '121/3' ] + mu1 × [ 1 1 '1/3' 0 0 1 '26/3' ] + mu2 × [ 0 1 0 0 1 1 4 ]}, with 0<=lambda<=1 & mu i >= 0 b) Press now INPUT.last (at 1st menu page) & launch (press) a 2nd time the main program —>GO. Be careful and, to the questions/prompts that appear: - answer 1 for 1st question (MAX option) - answer 0 for 2nd question (no multiple solution) - answer 1 for 3rd question here (automatic mode) - answer 0 for 4th question here (no fractions —> approximation) - answer 1 for 5th question (full stacks & details). The full and unrecognisable solution is then given as: [ 0 8.28947368439 2 0 11.2894736843 6.28947368439 42.1578947369 ]. c) In fact, the above solution b) is a special case of a). Indeed: Solution b) [ 0 8.28947368439 2 0 11.2894736843 6.28947368439 42.1578947369 ] =? solution a) lambda × [ 0 2 2 0 5 0 17 ] + (1-lambda) × [ 5 2 '11/3' 0 0 0 '121/3' ] + mu1× [ 1 1 '1/3' 0 0 1 '26/3' ] + mu2 × [ 0 1 0 0 1 1 4 ] Set lambda = 1, mu1 =0, mu2 =6.28947368439. Then solution b) [ 0 8.28947368439 2 0 11.2894736843 6.28947368439 42.1578947369 ] =? solution a) 1 × [ 0 2 2 0 5 0 17 ] + 6.28947368439 × [ 0 1 0 0 1 1 4 ] Or [ 0 8.28947368439 2 0 11.2894736843 6.28947368439 42.1578947369 ] =? [ 0 2 2 0 5 0 17 ] + [ 0 6.28947368439 0 0 6.28947368439 6.28947368439 25.1578947376 ] And we see that the expected (or unexpected!) equality is, to the rounding errors, indeed fully fulfilled. |
|||
01-08-2023, 03:45 PM
(This post was last modified: 01-22-2023 10:52 PM by Gil.)
Post: #17
|
|||
|
|||
RE: HP49G-50G Version 9 Simplex Max Min Pivot Algorithm, multiple/unbounded solutions
Version 9
- Bugs corrected for linear dependencies. - Loop added in case of wrong "choice" in column/row when supplementary step executed for zero value in last, final Matrix row relative to the objective fonction. - Output improved. Note - When solutions are not a linear combination of the variables xi, & if the given solution SOL (at first menu page) is of the kind Sum (lambda i × solution i), with 0<=lambda<=1 & sum (lambda i) = 1, then it will present a minimum of two particular solutions : main solution 1 & main solution 2, but not always all the possible other solutions (such as lambda 3 × solution 3, lambda 4 × solution 4, etc.). - For linear combination of the variables xi, when corresponding option is selected, the given solution under S.LIN & d.LIN (both at 1st menu page) are always exhaustive. |
|||
01-10-2023, 10:36 AM
(This post was last modified: 01-22-2023 11:09 PM by Gil.)
Post: #18
|
|||
|
|||
RE: HP49G-50G Version 9d Simplex Max Min Pivot Algorithm, multiple/unbounded solutions
No more purpose.
|
|||
01-11-2023, 04:41 PM
(This post was last modified: 01-22-2023 11:11 PM by Gil.)
Post: #19
|
|||
|
|||
RE: HP49G-50G Version 9d.hp Simplex Max Min Pivot Algorithm, multiple/unbounded solutions
With no more purpose.
|
|||
01-16-2023, 09:47 PM
(This post was last modified: 01-26-2023 03:18 PM by Gil.)
Post: #20
|
|||
|
|||
HP49-50G VERSION 10d.hp SIMPLEX Max Min Pivot Algorithm, multiple/unbounded solutions
Version 11
To find a minimum is a special case of the Max problem. Simple in theory, as you transform the Min problem into a Max, reversing at the end the signs of the found values. In practical, not that straightforward to implement without error. Up to versions 9d, and even in version 19d, you might get sometimes a wrong answer for the Min problem, as many parameters had to be very carefully checked and changed accordingly in the different programs. Just think, for instance, about the convention rule in SIMPLEX : x <= 10 (in a dictionary Matrix) does not mean that -infinity < x <= 10, but rather 0 <= x <= 10, versus x>= -8, that means instead, -8 <= x < infinity. Now the "bugs" are apparently fixed up. Regards, Gil |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)