|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.cpsolver.ifs.heuristics.RouletteWheelSelection<E>
public class RouletteWheelSelection<E>
A general roulette wheel selection. An object is selected randomly,
proportionaly to the provided weight. This class also supports multiple
selections (it implements Enumeration
interface).
Constructor Summary | |
---|---|
RouletteWheelSelection()
|
Method Summary | |
---|---|
void |
add(E adept,
double points)
Add an adept to the selection |
double |
getRemainingPoints()
Total value of objects that are still in the selection. |
double |
getTotalPoints()
Total value of objects that were added into the selection. |
double |
getUsedPoints()
Total value of objects that were already returned by the selection. |
boolean |
hasMoreElements()
Are there still some adepts that have not been yet selected |
E |
nextElement()
Perform selection. |
int |
size()
Number of objects in the set |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RouletteWheelSelection()
Method Detail |
---|
public void add(E adept, double points)
adept
- an objectpoints
- object weight (more points, better chance to be selected)public boolean hasMoreElements()
hasMoreElements
in interface Enumeration<E>
public E nextElement()
nextElement
in interface Enumeration<E>
public int size()
public double getUsedPoints()
public double getRemainingPoints()
public double getTotalPoints()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |