Class ActiveSet


  • public class ActiveSet
    extends Object
    This class keeps track of the active and inactive indices.
    • Constructor Detail

      • ActiveSet

        public ActiveSet​(boolean sorted)
        Construct a working set of active/inactive indices.
        Parameters:
        sorted - indicator of whether the indices are sorted
      • ActiveSet

        public ActiveSet​(boolean sorted,
                         Collection<Integer> indices)
        Construct a working set of active/inactive indices.
        Parameters:
        sorted - indicator of whether the indices are sorted
        indices - the active indices
      • ActiveSet

        public ActiveSet​(boolean sorted,
                         int[] indices)
        Construct a working set of active/inactive indices.
        Parameters:
        sorted - indicator of whether the indices are sorted
        indices - the active indices
    • Method Detail

      • addActive

        public void addActive​(Collection<Integer> indices)
        Add active indices.
        Parameters:
        indices - a collection of active constraint indices
      • addActive

        public void addActive​(int[] indices)
        Add active indices.
        Parameters:
        indices - an array of active constraint indices
      • addInactive

        public void addInactive​(Collection<Integer> indices)
        Add inactive indices.
        Parameters:
        indices - a collection of inactive constraint indices
      • addInactive

        public void addInactive​(int[] indices)
        Add inactive indices.
        Parameters:
        indices - an array of inactive constraint indices
      • addActive

        public void addActive​(int j)
        Add an active constraint by index.
        Parameters:
        j - an index of an active constraint
      • addInactive

        public void addInactive​(int j)
        Add an inactive constraint by index.
        Parameters:
        j - an index of an inactive constraint
      • removeActive

        public void removeActive​(int j)
        Remove an active index.
        Parameters:
        j - an active index to be removed.
      • removeInactive

        public void removeInactive​(int j)
        Remove an inactive index.
        Parameters:
        j - an inactive index to be removed.
      • removeActiveByIndex

        public void removeActiveByIndex​(int i)
        Remove an active constraint by index.
        Parameters:
        i - an active index, counting from 1
      • removeInactiveByIndex

        public void removeInactiveByIndex​(int i)
        Remove an active constraint by index.
        Parameters:
        i - an inactive index, counting from 1
      • activeSize

        public int activeSize()
        Get the number of active indices.
        Returns:
        the number of active indices
      • inactiveSize

        public int inactiveSize()
        Get the number of inactive indices.
        Returns:
        the number of inactive indices
      • containActive

        public boolean containActive​(int j)
        Check if the active set contains a certain index.
        Parameters:
        j - an index of an active constraint
        Returns:
        true if the active set contains j
      • containInactive

        public boolean containInactive​(int j)
        Check if the inactive set contains a certain index.
        Parameters:
        j - an index of an inactive constraint
        Returns:
        true if the inactive set contains j
      • getActiveIndices

        public int[] getActiveIndices()
        Get all active indices.
        Returns:
        all active indices
      • getInactiveIndices

        public int[] getInactiveIndices()
        Get all inactive indices.
        Returns:
        all inactive indices
      • getActive

        public int getActive​(int i)
        Get the i-th active index.
        Parameters:
        i - an index.
        Returns:
        the i-th active index
      • getInactive

        public int getInactive​(int i)
        Get the i-th inactive index.
        Parameters:
        i - an index, counting from 1
        Returns:
        the i-th inactive index