* ************************************************************************* subroutine basis( fr, pr, thr, rthr, depth, + lib, lin, ns, w ) * ************************************************************************* * Purpose: * -------- * This routine sets the initial basis to an all atificial * basis. It initializes the dual variables vector W, the * vectors LIB and LIN containing respectively the indices * of the basic and nonbasic variables and the four data * structure vectors PR, THR, RTHR and DEPTH. * Parameters : * ------------ * fr ( int ) * input : vector containing the origine nodes of the arcs. * The components from FR(ARCS+1) to FR(ARCS+NODES) * contain the origine node of the atificial arcs. * output : unmodified. * pr ( int ) * input : the predecessor vector. * output : this vector is initialized. * thr ( int ) * input : the traversal vector. * output : this vector is initialized. * rthr ( int ) * input : the reverse vector. * output : this vector is initialized. * depth ( int ) * input : the depth vector. * output : this vector is initialized. * lib ( int ) * input : vector containing the indices of the basic * variables. * output : this vector contains the indices of the * artificial variables. * lin ( int ) * input : vector containing the indices of the nonbasic * variables. * output : this vector contains the indices of the * non artificial variables. * ns ( int ) * input : meaningless. * output : the number of nonbasic variables that are * non artificial. * w ( dble ) * input : the dual variables vector. * output : this vector is initialized. * Routines used : * --------------- * None. * Programming : * ------------- * D. Tuyttens * ========================================================================= * Routine parameters integer pr(*), thr(*), rthr(*), depth(*), + fr(*), lib(*), lin(*), ns double precision w(*) * Internal variables integer last, i, ia, nd1 * Common specifications integer arcs, nodes, elem common / prbdim / arcs, nodes, elem double precision zero, one, two, three, half, tenm1, tenm2, tenm4 common / prbcst / zero, one, two, three, half, tenm1, tenm2, tenm4 * * We define the artificial node ND1. * nd1 = nodes + 1 w(nd1) = zero depth(nd1) = 0 thr(nd1) = 1 last = nd1 * * The artificial arcs form the initial basis. * do 10 i = 1, nodes * * We initialize the four data structure vectors * PR, THR, RTHR and DEPTH and the vector LIB which * contains the indices of the basic variables. * rthr(i) = last thr(last) = i last = i ia = i + arcs lib(i) = ia depth(i) = 1 pr(i) = nd1 * * We initialize the dual variables vector. * if( fr(ia).ne.nd1 ) then w(i) = - one else w(i) = one endif 10 continue * rthr(nd1) = last thr(last) = nd1 * * All the non artificial arcs form the set * of nonbasic variables. LIN is the list * of the indices of the nonbasic variables. * ns = arcs do 20 i = 1 , arcs lin(i) = i 20 continue * return end