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 TypeMethodDescriptionvoid
Diffuse the values to a temporary grid.void
Apply the diffusion update and evaporation processes at once.void
Apply the evaporation process.get
(int index) Returns the value at the specified indexint
getMaxDirection
(int xcor, int ycor) Returns the direction with the maximum valueint
getMaxDirectionNoRandom
(int xcor, int ycor) int
getMaxDirectionRandomWhenEquals
(int xcor, int ycor) int
getMinDirection
(int xcor, int ycor) Returns the direction with the minimum valueint
getMinDirectionNoRandom
(int xcor, int ycor) int
getMinDirectionRandomWhenEquals
(int xcor, int ycor) void
incValue
(int index, float inc) Addsinc
to the current value of the cell with the corresponding indexvoid
incValue
(int x, int y, float quantity) void
void
Compute the maximum value in the gridvoid
Update 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, setMaxEncounteredValue
Methods inherited from class turtlekit.pheromone.DataGrid
get, get1DIndex, getHeight, getName, getWidth, set
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:Pheromone
Returns 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:Pheromone
Returns 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:Pheromone
Update 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:Pheromone
Apply 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:Pheromone
Diffuse the values to a temporary grid. This method is called before thePheromone.updateValuesFromTmpGridKernel()
method. -
evaporationKernel
public void evaporationKernel()Description copied from interface:Pheromone
Apply 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) Addsinc
to 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
-