> well, since our grades are already posted for the homework, i will be > glad to share the code.
> this is a zip file of 27kb size > http://www.2shared.com/file/4613418/36e26fd8/TabuSearch.html > note that i have slightly modified the original lpx_prim_ratio_test() > function of GLPK > the modified files are also in the zip file. > i needed to know how the basic variable changed(-1 decrease, +1 > increase) and the final value of the entering nonbasic variable. maybe > GLPK already presents these values, i am not sure. > glpk.h (obviously since the signature of the function has changed) > glplpx06.c (this is where i added a few lines of code to obtain what i > want) > glplpx08.c (this changes since it has calls to lpx_prim_ratio_test(), > i just added two more parameters with values 0 (null) so that it would > compile) There is no need to change the code. Let the routine choose xB[p]. Looking through the tableau column passed to lpx_prim_ratio_test you can determine corresponding influence coefficient alfa[p] != 0. By definition: (delta xB[p]) = alfa[p] * (delta xN[q]) where: (delta xB[p]) = (adjacent xB[p]) - (current xB[p]) (delta xN[q]) = (adjacent xN[q]) - (current xN[q]) If xN[q] increases (decreases) then: if alfa[p] > 0, xB[p] also increases (decreases), and if alfa[p] < 0, xB[p] decreases (increases). Knowing in which direction xB[p] changes you can determine its change in the adjacent basis: if xB[p] increases, in the adjacent basis it goes to its upper bound: delta xB[p] = (upper bound of xB[p]) - (current xB[p]) (>= 0) if xB[p] decreases, in the adjacent basis it goes to its lower bound: delta xB[p] = (lower bound of xB[p]) - (current xB[p]) (<= 0) And knowing delta xB[p] you can determine the change of xN[q] in the adjacent basis, if necessary: delta xN[q] = (delta xB[p]) / alfa[p]. _______________________________________________ Help-glpk mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-glpk
