Class CPUStreamPheromone
- Direct Known Subclasses:
CPU_SobelPheromone
A pheromone grid that uses a float array to store values. It is used for CPU
computations.
-
Field Summary
Fields inherited from class turtlekit.pheromone.AbstractPheromoneGrid
neighborsIndexes -
Constructor Summary
ConstructorsConstructorDescriptionCPUStreamPheromone(String name, TKEnvironment<?> environment, float evaporationCoeff, float diffusionCoeff) -
Method Summary
Modifier and TypeMethodDescriptionvoidDiffuse the values to a temporary grid.voidApply the diffusion update and evaporation processes at once.voidApply the evaporation process.get(int index) Returns the value at the specified indexintgetMaxDirection(int xcor, int ycor) Returns the direction with the maximum valueintgetMaxDirectionNoRandom(int xcor, int ycor) intgetMaxDirectionRandomWhenEquals(int xcor, int ycor) intgetMinDirection(int xcor, int ycor) Returns the direction with the minimum valueintgetMinDirectionNoRandom(int xcor, int ycor) intgetMinDirectionRandomWhenEquals(int xcor, int ycor) voidincValue(int index, float inc) Addsincto the current value of the cell with the corresponding indexvoidincValue(int x, int y, float quantity) voidvoidCompute the maximum value in the gridvoidUpdate the values in the main grid from the temporary grid.Methods inherited from class turtlekit.pheromone.AbstractPheromoneGrid
getColorModel, getDiffusionCoefficient, getEvaporationCoefficient, getLogMaxValue, getMaxEncounteredValue, getNeighborsIndexes, normeValue, prng, setColorModel, setDiffusionCoefficient, setEvaporationCoefficient, setLogMaxValue, setMaxEncounteredValueMethods inherited from class turtlekit.pheromone.DataGrid
get, get1DIndex, getHeight, getName, getWidth, setMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface turtlekit.pheromone.Pheromone
applyDynamics, diffusion, diffusionAndEvaporation, evaporation, get, get1DIndex, getHeight, getName, getValueColor, getValueIntensity, getWidth, set
-
Constructor Details
-
CPUStreamPheromone
public CPUStreamPheromone(String name, TKEnvironment<?> environment, float evaporationCoeff, float diffusionCoeff)
-
-
Method Details
-
get
-
set
-
getMaxDirection
public int getMaxDirection(int xcor, int ycor) Description copied from interface:PheromoneReturns the direction with the maximum value- Parameters:
xcor- x coordinateycor- y coordinate- Returns:
- the direction with the maximum value
-
getMinDirection
public int getMinDirection(int xcor, int ycor) Description copied from interface:PheromoneReturns the direction with the minimum value- Parameters:
xcor- x coordinateycor- y coordinate- Returns:
- the direction with the minimum value
-
getMaxDirectionRandomWhenEquals
public int getMaxDirectionRandomWhenEquals(int xcor, int ycor) -
getMaxDirectionNoRandom
public int getMaxDirectionNoRandom(int xcor, int ycor) -
getMinDirectionRandomWhenEquals
public int getMinDirectionRandomWhenEquals(int xcor, int ycor) -
getMinDirectionNoRandom
public int getMinDirectionNoRandom(int xcor, int ycor) -
updateValuesFromTmpGridKernel
public void updateValuesFromTmpGridKernel()Description copied from interface:PheromoneUpdate the values in the main grid from the temporary grid. This method is called after thePheromone.diffuseValuesToTmpGridKernel()method. -
diffusionAndEvaporationUpdateKernel
public void diffusionAndEvaporationUpdateKernel()Description copied from interface:PheromoneApply the diffusion update and evaporation processes at once. This method is called after thePheromone.diffuseValuesToTmpGridKernel()method in thePheromone.diffusionAndEvaporation()method. -
diffuseValuesToTmpGridKernel
public void diffuseValuesToTmpGridKernel()Description copied from interface:PheromoneDiffuse the values to a temporary grid. This method is called before thePheromone.updateValuesFromTmpGridKernel()method. -
evaporationKernel
public void evaporationKernel()Description copied from interface:PheromoneApply the evaporation process. It should be overridden by the implementing class to apply the evaporation which is about reducing the value of each cell by a certain percentage. -
incValue
public void incValue(int x, int y, float quantity) -
incValue
public void incValue(int index, float inc) Addsincto the current value of the cell with the corresponding index- Parameters:
index- cell's indexinc- how much to add
-
updateMaxValue
public void updateMaxValue()Compute the maximum value in the grid
-