Class CountSelectionMechanism<U extends java.io.Serializable,​I extends java.io.Serializable,​P>

java.lang.Object
es.uam.eps.ir.relison.diffusion.selections.AbstractSelectionMechanism<U,​I,​P>
es.uam.eps.ir.relison.diffusion.selections.CountSelectionMechanism<U,​I,​P>
Type Parameters:
U - type of the users.
I - type of the information.
P - type of the parameters.
All Implemented Interfaces:
SelectionMechanism<U,​I,​P>
Direct Known Subclasses:
BatchRecommenderSelectionMechanism, CountRealPropagatedSelectionMechanism, CountThresholdSelectionMechanism, IndependentCascadeModelSelectionMechanism, LimitedCountThresholdSelectionMechanism, LimitedProportionThresholdSelectionMechanism, OnlyOwnInformationSelectionMechanism, ProportionThresholdSelectionMechanism, PullPushSelectionMechanism, PureRecommenderSelectionMechanism, TimestampOrderedSelectionMechanism

public class CountSelectionMechanism<U extends java.io.Serializable,​I extends java.io.Serializable,​P>
extends AbstractSelectionMechanism<U,​I,​P>
Selects the propagated pieces. This algorithm propagates a certain number of information pieces each iteration, chosen randomly from the own pieces of information and the received ones.
  • Field Details

    • numOwn

      private final int numOwn
      Number of own information pieces to propagate for each user and iteration.
    • numPropagate

      private final int numPropagate
      Number of received information to propagate for each user and iteration.
    • numRepropagate

      private final int numRepropagate
      Number of information pieces to repropagate for each user and iteration.
    • rng

      protected final java.util.Random rng
      Random number generator
  • Constructor Details

    • CountSelectionMechanism

      public CountSelectionMechanism​(int numOwn, int numPropagate, int numRepropagate)
      Constructor.
      Parameters:
      numOwn - number of own information pieces to propagate for each user and iteration.
      numPropagate - number of received information to propagate for each user and iteration.
      numRepropagate - number of information pieces to repropagate for each user and iteration.
    • CountSelectionMechanism

      public CountSelectionMechanism​(int numOwn, int numPropagate)
      Constructor.
      Parameters:
      numOwn - number of own information pieces to propagate for each user and iteration.
      numPropagate - number of received information to propagate for each user and iteration.
  • Method Details

    • getOwnInformation

      protected java.util.List<PropagatedInformation> getOwnInformation​(UserState<U> user, Data<U,​I,​P> data, SimulationState<U,​I,​P> state, int numIter, java.lang.Long timestamp)
      Description copied from class: AbstractSelectionMechanism
      Obtains the list of own information pieces to repropagate.
      Specified by:
      getOwnInformation in class AbstractSelectionMechanism<U extends java.io.Serializable,​I extends java.io.Serializable,​P>
      Parameters:
      user - the user to analyze.
      data - the full data.
      state - current simulation state.
      numIter - the iteration number.
      timestamp - the timestamp for the current simulation.
      Returns:
      a selection of the own information pieces to be propagated.
    • getReceivedInformation

      protected java.util.List<PropagatedInformation> getReceivedInformation​(UserState<U> user, Data<U,​I,​P> data, SimulationState<U,​I,​P> state, int numIter, java.lang.Long timestamp)
      Description copied from class: AbstractSelectionMechanism
      Obtains the list of received information pieces to repropagate.
      Specified by:
      getReceivedInformation in class AbstractSelectionMechanism<U extends java.io.Serializable,​I extends java.io.Serializable,​P>
      Parameters:
      user - the user to analyze.
      data - the full data.
      state - the iteration number.
      numIter - number of the iteration.
      timestamp - the timestamp for the current simulation.
      Returns:
      a selection of the received information pieces to be propagated.
    • getRepropagatedInformation

      protected java.util.List<PropagatedInformation> getRepropagatedInformation​(UserState<U> user, Data<U,​I,​P> data, SimulationState<U,​I,​P> state, int numIter, java.lang.Long timestamp)
      Description copied from class: AbstractSelectionMechanism
      Obtains the list of propagated information pieces to repropagate.
      Specified by:
      getRepropagatedInformation in class AbstractSelectionMechanism<U extends java.io.Serializable,​I extends java.io.Serializable,​P>
      Parameters:
      user - the user to analyze.
      data - the full data.
      state - current simulation state.
      numIter - number of the iteration.
      timestamp - the timestamp for the current simulation.
      Returns:
      a selection of the information pieces to repropagate.
    • getPropagatedInformation

      protected java.util.List<PropagatedInformation> getPropagatedInformation​(int userId, int count, int numIter, java.util.List<PropagatedInformation> propInfo)
      Obtains a subset of the information pieces in a list to repropagate.
      Parameters:
      userId - the identifier of the user.
      count - the (maximum) number of information pieces to retrieve from that list.
      numIter - the current iteration number.
      propInfo - the list of propagated information we want to obtain some pieces from.
      Returns:
      the list of information pieces to propagate.
    • getNumOwn

      public int getNumOwn()
      Gets the number of own information pieces to propagate.
      Returns:
      the number of own information pieces to propagate
    • getNumReceived

      public int getNumReceived()
      Gets the number of received information pieces to propagate.
      Returns:
      the number of received information pieces to propagate.
    • getNumRepropagate

      public int getNumRepropagate()
      Gets the number of propagated information pieces to repropagate.
      Returns:
      the number of propagated information pieces to repropagate.