Package isula.aco
Class Environment
java.lang.Object
isula.aco.Environment
- Direct Known Subclasses:
MatrixEnvironment
The place that our ants traverse, where they gather the information to build
solutions.
This class manages the access to the problem representation - as an array of doubles- and to the pheromone matrix. Each concrete class needs to define a way to build a pheromone matrix to the problem to be solved.
- Author:
- Carlos G. Gavidia
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
applyFactorToPheromoneMatrix
(double factor) Multiplies every cell in the pheromone matrix by a factor.protected abstract double[][]
Creates a pheromone matrix depending of the nature of the problem to solve.double[][]
void
populatePheromoneMatrix
(double pheromoneValue) Assigns the same value to all cells on the Pheromone Matrix.void
setPheromoneMatrix
(double[][] pheromoneMatrix)
-
Constructor Details
-
Environment
public Environment()Creates an Environment for the Ants to traverse.
-
-
Method Details
-
createPheromoneMatrix
protected abstract double[][] createPheromoneMatrix()Creates a pheromone matrix depending of the nature of the problem to solve. When overriding this method, you can call getProblemRepresentation() to obtain problem context information.- Returns:
- Pheromone matrix instance.
-
setPheromoneMatrix
public void setPheromoneMatrix(double[][] pheromoneMatrix) -
getPheromoneMatrix
public double[][] getPheromoneMatrix() -
populatePheromoneMatrix
public void populatePheromoneMatrix(double pheromoneValue) Assigns the same value to all cells on the Pheromone Matrix.- Parameters:
pheromoneValue
- Value to assign.
-
applyFactorToPheromoneMatrix
public void applyFactorToPheromoneMatrix(double factor) Multiplies every cell in the pheromone matrix by a factor.- Parameters:
factor
- Factor for multiplication.
-