* ************************************************************************* subroutine dealag( can, ncan, nb, ndacti, ndacts, su, nsu, + ba, nba, ftstem, bep, gptr, elptr, elvar, + fr, to, pr, elst, xst, x, rgra, gra, fuval, + w2 ) * ************************************************************************* * Purpose : * --------- * This routine selects from the nonbasic arcs that * are candidate to be de-activated, the nonbasic * arcs that have an associated Lagrange multiplier * with an appropriate sign and that are not blocked. * These selected variables are then transfered in * the superbasic set and will be de-activated during * the next iterate. * Parameters : * ------------ * can ( int ) * input : vector containing the indices of the nonbasic * arcs candidate to be de-activated. * output : unmodified. * ncan ( int ) * input : the number of nonbasic arcs that are candidate * to be de-activated. * output : unmodified. * nb ( int ) * input : the number of nonbasic variables. * output : this number is decreased by one each time a nonbasic * variable candidate to be de-activated is selected. * ndacti ( int ) * input : meaningless * output : the number of nonbasic arcs selected from the * candidate list CAN. * ndacts ( int ) * input : the total number of nonbasic arcs that have * been de-activated from the begin of the * minimization. * output : this number is increased by one each time a nonbasic * variable candidate to be de-activated is selected. * su ( int ) * input : vector containing the indices of the superbasic * variables. * output : the indices of the nonbasic variables that are * selected to be de-activated are added in SU. * nsu ( int ) * input : the number of superbasic variables. * output : this number is increased by one each * time a nonbasic variable is selected * to be de-activated. * ba ( int ) * input : vector containing the indices of the basic * variables. * output : unmodified. * nba ( int ) * input : the number of basic variables. * output : unmodified. * ftstem ( int ) * input : vector containing for each superbasic variable, * the length from its origine node to the stem * node, and the length of its flow augmenting path. * output : unmodified. * bep ( int ) * input : meaningless. * output : it used to store the flow augmenting paths of the * nonbasic variables candidate to be de-activated. * gptr ( int ) * input : array whose ith value is the position of the * first component of the ith element gradient * in FUVAL. * output : unmodified. * elptr ( int ) * input : array whose kth value is the position of the first * variable of element k, in the list ELVAR. * output : unmodified. * elvar ( int ) * input : array containing the indices of the variables in * the first element, followed by those in the second * element, etc. * output : unmodified. * fr ( int ) * input : vector containing the origine nodes of the arcs. * output : unmodified. * to ( int ) * input : vector containing the end nodes of the arcs. * output : unmodified. * pr ( int ) * input : the predecessor vector. * output : unmodified. * elst ( int ) * input : vector containing the status of the element functions. * output : unmodified. * xst ( int ) * input : vector containing the status of the variables. * output : the status of the nonbasic arcs that are * selected to be de-actived are modified to * correspond to the status of a superbasic * arc. * x ( dble ) * input : the current iterate vector. * output : unmodified. * rgra ( dble ) * input : the reduced gradient vector. * output : the components corresponding to the indices * CAN(ik) for ik=1 up to ik=NCAN are computed. * gra ( dble ) * input : meaningless. * output : the gradient vector of the objective function. * fuval ( dble ) * input : array used to store the function and derivative * values for the element functions. * output : unmodified. * w2 ( dble ) * input : array used as workspace. * output : meaningless. * Routines used : * --------------- * Assgra, lagmul, gxnbl, gxnbu, getdbl, tblock, sxsu. * Programming : * ------------- * D. Tuyttens * ======================================================================== * Routine parameters integer can(*), ncan, nb, ndacti, ndacts, + su(*), nsu, ba(*), nba, ftstem(*), bep(*), + gptr(*), elptr(*), elvar(*), fr(*), to(*), + pr(*), elst(*), xst(*) double precision x(*), rgra(*), gra(*), fuval(*), w2(*) * Internal variables integer k, ik, kdis, fstem logical block, gxnbl, gxnbu double precision zero, one, two, three, half, tenm1, tenm2, tenm4 common / prbcst / zero, one, two, three, half, tenm1, tenm2, tenm4 * * Assemble the gradient of the objective function from * the element gradient vectors stored in FUVAL. * call assgra( fuval, gptr, gra, w2, elptr, elvar, elst ) * * We loop on the nonbasic arcs that * are candidate to be de-activated. * ndacti = 0 do 10 ik = 1 , ncan * * We compute the nonbasic Lagrange multiplier * associated to the nonbasic arc K. * k = can(ik) call lagmul( k, rgra, gra, ftstem, pr, fr, to, + ba, nba, bep ) * * We test if the Lagrange multiplier associated to * the nonbasic arc K has the appropriate sign. * if( (gxnbl(xst(k)) .and. rgra(k).lt.zero) .or. + (gxnbu(xst(k)) .and. rgra(k).gt.zero) ) then * * We test if the nonbasic varibale K is blocked ? * call getdbl( ftstem(k), fstem, kdis ) call tblock( block, k, kdis, bep, rgra, x ) if( .not.block ) then * * The nonbasic variable K is not blocked. This * variable is transfered in the superbasic set. * ndacti = ndacti + 1 nsu = nsu + 1 su(nsu) = k call sxsu(xst(k)) endif endif * * We visit the next candidate. * 10 continue * * We update the number of nonbasic variables * NB and the total number of de-activated * variables NDACTS. * nb = nb - ndacti ndacts = ndacts + ndacti * return end