|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.java.recycle.GaussianController
This is an adaptive controller based on a statistical analysis of the level transitions. The optimal level is derived from the variance of the transitions using the following equation:
adaptiveLevel = bias + factor * standardDeviationwhere the standard deviation signifies the variability of level around its average.
This class creates a convergence of the system Container-Controller to a point in which the average level tends to its standard deviation. This creates a negative feedback that stabilizes the system.
NOTE: This class is only experimental and it is meant to show only a more
complex implementation of a Controller
. The routines
that calculate the statistical parameters this class uses to determine
the level use heavy calculations and should be used only when a
very precise adaptivity is required.
Field Summary | |
private static int |
BIAS
This is the minimum value allowed to be reached. |
private int |
cursor
The cursor in the circular array. |
private static int |
FACTOR
This is multiplication factor for the standard deviation. |
private int |
level
The current pool level. |
private int[] |
levels
The array of pool levels. |
private static int |
WINDOW
This is the log2 value of the sampling window. |
Constructor Summary | |
GaussianController()
|
Method Summary | |
void |
down()
Writes on the memory of this controller decrementing the level. |
private float |
getAverage(int[] array)
Calculates the average value of a given array. |
private float |
getStandardDeviation(int[] array)
Calculates the RMS value of a given array. |
boolean |
isThereRoomFor(Recyclable object)
Evaluates the room for the object to recycle basing this decision to the optimum level estrapolated from the level history. |
void |
up()
Writes on the memory of this controller incrementing the level. |
Methods inherited from class java.lang.Object |
|
Field Detail |
private static final int WINDOW
private static final int BIAS
private static final int FACTOR
private int level
private int[] levels
private int cursor
Constructor Detail |
public GaussianController()
Method Detail |
public void up()
public void down()
public boolean isThereRoomFor(Recyclable object)
private float getStandardDeviation(int[] array)
private float getAverage(int[] array)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |