rksact Subroutine

private subroutine rksact(Ioptn, Numgr, Icntyp, Rchdwn, Rchin, Conup, Projct, Error, Mactrk, Actdif, Iact)

This subroutine puts the (signed) indices of the mactrk active constraints in iact. it also sets the right side vector actdif for the wolfe subproblem.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: Ioptn
integer, intent(in) :: Numgr
integer, intent(in) :: Icntyp(Numgr)
real(kind=wp), intent(in) :: Rchdwn
real(kind=wp), intent(in) :: Rchin
real(kind=wp), intent(in) :: Conup
real(kind=wp), intent(in) :: Projct
real(kind=wp), intent(in) :: Error(Numgr+3)
integer, intent(out) :: Mactrk
real(kind=wp) :: Actdif(Numgr)
integer :: Iact(Numgr)

Called by

proc~~rksact~~CalledByGraph proc~rksact rksact proc~rkcon conmax_solver%rkcon proc~rkcon->proc~rksact proc~conmax conmax_solver%conmax proc~conmax->proc~rkcon

Source Code

    subroutine rksact(Ioptn, Numgr, Icntyp, Rchdwn, Rchin, Conup, Projct, &
                      Error, Mactrk, Actdif, Iact)

        implicit none

        integer, intent(in) :: Ioptn
        integer, intent(in) :: Numgr
        real(wp), intent(in) :: Rchdwn
        real(wp), intent(in) :: Rchin
        real(wp), intent(in) :: Conup
        real(wp), intent(in) :: Projct
        real(wp), intent(in) :: Error(Numgr + 3)
        real(wp) :: Actdif(Numgr)
        integer :: Iact(Numgr)
        integer, intent(in)  :: Icntyp(Numgr)
        integer, intent(out) :: Mactrk

        real(wp) :: elow, enorm, rchind
        integer :: i, l

        ! SET MACHINE AND PRECISION DEPENDENT CONSTANTS FOR RKSACT.
        enorm = Error(Numgr + 1)
        elow = enorm - Rchdwn*Projct
        rchind = Rchin*Projct

        ! DETERMINE THE NUMBER MACTRK OF ACTIVE CONSTRAINTS, THEIR INDICATOR
        ! IACT, AND THE VECTOR ACTDIF OF RIGHT SIDES FOR THE WOLFE SUBPROBLEM.
        l = 0
        do i = 1, Numgr
            if (Icntyp(i) < 0) then
                if (Icntyp(i) + 1 >= 0) then
                    ! HERE WE HAVE A TYPE -1 CONSTRAINT, WHICH WILL AUTOMATICALLY BE
                    ! DECLARED TO BE ACTIVE.
                    l = l + 1
                    Iact(l) = i
                    Actdif(l) = Error(i)/Projct
                    ! HERE WE HAVE A TYPE -2 CONSTRAINT, WHICH WILL BE DECLARED TO BE
                    ! ACTIVE IFF ERROR(I) >= -RCHIND.
                else if (Error(i) + rchind >= 0) then
                    ! HERE WE HAVE AN ACTIVE TYPE -2 CONSTRAINT, AND WE SET ACTDIF(L)=
                    ! MIN (CONUP, ERROR(I)/PROJCT).
                    l = l + 1
                    Iact(l) = i
                    Actdif(l) = Error(i)/Projct
                    if (Actdif(l) > Conup) Actdif(l) = Conup
                end if
            else if (Icntyp(i) /= 0) then
                if (Icntyp(i) > 1) then
                    ! HERE WE HAVE A TYPE 2 CONSTRAINT.
                    if (Error(i) < 0) then
                        if (-Error(i) >= elow) then
                            ! HERE WE HAVE A -ACTIVE TYPE 2 CONSTRAINT.
                            l = l + 1
                            Iact(l) = -i
                            Actdif(l) = one + (-Error(i) - enorm)/Projct
                        end if
                        cycle
                    end if
                end if
                ! HERE WE HAVE A TYPE 1 CONSTRAINT, OR A TYPE 2 CONSTRAINT WITH
                ! ERROR(I) >= 0.0.
                if (Error(i) >= elow) then
                    ! HERE WE HAVE AN ACTIVE TYPE 1 CONSTRAINT OR A +ACTIVE TYPE 2 CONSTRAINT.
                    l = l + 1
                    Iact(l) = i
                    Actdif(l) = one + (Error(i) - enorm)/Projct
                end if
            end if
        end do

        Mactrk = l

    end subroutine rksact