* ************************************************************************ subroutine rgrad( rgra, gra, w2, fuval, gptr, elvar, elptr, + elst, su, nsu, bep, beptr, kdist ) * ************************************************************************* * Purpose : * --------- * This routine computes the reduced gradient vector by * going over the flow augmenting paths of the superbasic * variables. Only the components corresponding to the * indices of the superbasic set SU are computed. * Parameters : * ------------ * rgra ( dble ) * input : the reduced gradient vector. * output : the components corresponding to the indices * SU(i) for i=1 up to i=NSU, are computed. * gra ( dble ) * input : the gradient vector of the objective function. * output : unmodified. * w2 ( dble ) * input : array used as workspace. * output : meaningless. * fuval ( dble ) * input : array used to store the function and derivative * values for the element functions. * output : unmodified. * gptr ( int ) * input : array whose ith value is the position of the * first component of the ith element gradient * in FUVAL. * 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. * elptr ( int ) * input : array whose kth value is the position of the * first variable of element k, in the list ELVAR. * output : unmodified. * elst ( int ) * input : vector containing the status of the element * functions. * output : unmodified. * su ( int ) * input : vector containing the indices of the superbasic * variables. * output : unmodified. * nsu ( int ) * input : the number of superbasic variables. * output : unmodified. * bep ( int ) * input : array containing the flow augmenting paths of * the superbasic variables. * output : unmodified. * beptr ( int ) * input : array whose kth value is the position of the * first element of the flow augmenting path of * superbasic arc k, in array BEP. * output : unmodified. * kdist ( int ) * input : vector containing for each superbasic variable * the length of its flow augmenting path. * output : unmodified. * Routine used : * -------------- * assgra. * Programming : * ------------- * D. Tuyttens * ========================================================================= * Routine parameters integer gptr(*), elvar(*), elptr(*), elst(*), + su(*), nsu, bep(*), beptr(*), kdist(*) double precision rgra(*), gra(*), w2(*), fuval(*) * Internal variables integer i, ik, k, kk, kdis * * Assemble the gradient of the objective function from * the element gradients vectors stored in FUVAL. * call assgra( fuval, gptr, gra, w2, elptr, elvar, elst ) * * We obtain the reduced gradient vector by going over the * flow augmenting paths of all the superbasic variables. * do 10 ik = 1 , nsu k = su(ik) kdis = kdist(ik) rgra(k) = gra(k) do 20 i = beptr(k) , beptr(k)+kdis-1 kk = bep(i) if( kk.gt.0 ) then rgra(k) = rgra(k) + gra(kk) else rgra(k) = rgra(k) - gra(-kk) endif 20 continue 10 continue * return end