|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.cpsolver.ifs.heuristics.RouletteWheelSelection
public class RouletteWheelSelection
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(Object 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 |
Object |
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(Object adept, double points)
adept
- an objectpoints
- object weight (more points, better chance to be selected)public boolean hasMoreElements()
hasMoreElements
in interface Enumeration
public Object nextElement()
nextElement
in interface Enumeration
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 |