fr.lifl.jedi.model.interactionSelection.reactiveSelection
Class WeightedSelectionNature<Element>

java.lang.Object
  extended by fr.lifl.jedi.model.interactionSelection.reactiveSelection.WeightedSelectionNature<Element>
All Implemented Interfaces:
ElementSelectionNature<Element>

public abstract class WeightedSelectionNature<Element>
extends java.lang.Object
implements ElementSelectionNature<Element>

The weighted selection nature. This provides a tool that makes stochastic selection.

It gives to every element a weight (see getWeightFor(Object)). From this weight, it provides to every element an interval included in [0,1[ such that :

Then, selections gets a random number in [0,1[, and selects the element such that this number was in its interval.

Consequently, even if the list of elements is not empty, this selection process might not select an element.

Version:
JEDI V 2.2
Created the 7th nov. 2008
Modified the 5th may 2009
Author:
Yoann Kubera
SMAC Team (Systèmes Multi-Agents et Comportement)
LIFL (Laboratoire d'Informatique Fondamentale de Lille)
University of Lille, France

Constructor Summary
WeightedSelectionNature()
           
 
Method Summary
abstract  WeightedSelectionNature<Element> clone()
          Clones the selection nature.
abstract  double getWeightFor(Element e)
          Computes the weight associated with a particular element.
 Element performSelection(java.util.List<Element> elements)
          Performs the selection of an element among a list of elements according to the provided nature.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WeightedSelectionNature

public WeightedSelectionNature()
Method Detail

getWeightFor

public abstract double getWeightFor(Element e)
Computes the weight associated with a particular element.

Parameters:
e - The element for which the weight is computed.
Returns:
the weight associated with the element.
See Also:
WeightedSelectionNature

performSelection

public Element performSelection(java.util.List<Element> elements)
Description copied from interface: ElementSelectionNature
Performs the selection of an element among a list of elements according to the provided nature.

Specified by:
performSelection in interface ElementSelectionNature<Element>
Parameters:
elements - The set of elements in which selection is made.
Returns:
The selected element, or null if no element was selected.
See Also:
ElementSelectionNature.performSelection(java.util.List)

clone

public abstract WeightedSelectionNature<Element> clone()
Description copied from interface: ElementSelectionNature
Clones the selection nature.

Specified by:
clone in interface ElementSelectionNature<Element>
Overrides:
clone in class java.lang.Object
Returns:
the new instance, which is a clone of this instance.
See Also:
Object.clone()