call the applet update method from the observer update function
[aco.git] / ChoiceInformation.java
blobcdf08d411fd45ee1e6eacb501c8a85adf8268322
1 class ChoiceInformation {
3 protected Graph graph;
4 protected double[][] ChoiceInformation;
6 ChoiceInformation(Graph graph) {
7 this.graph = graph;
8 ChoiceInformation = new double[graph.getNumOfCities()][graph.getNumOfCities()];
10 for (int i = 0; i < graph.getNumOfCities(); i++) {
11 for (int j = 0; j < graph.getNumOfCities(); j++) {
12 setChoiceInformation(i,j, 0);
17 public void computeChoiceInformation() {
18 for (int i = 0; i < graph.getNumOfCities(); i++) {
19 for (int j = 0; j < graph.getNumOfCities(); j++) {
20 setChoiceInformation(i,j,
21 Math.pow( graph.getPheromone(i,j), graph.getALPHA() ) *
22 Math.pow( (1.0/(double)graph.getDistance(i,j)), graph.getBETA() ));
27 public double[][] getChoiceInformation() {
28 return this.ChoiceInformation;
31 public double getChoiceInformation(int x, int y) {
32 return this.ChoiceInformation[x][y];
35 public void setChoiceInformation(double[][] ChoiceInformation) {
36 this.ChoiceInformation = ChoiceInformation;
39 public void setChoiceInformation(int x, int y, double ChoiceInformation) {
40 this.ChoiceInformation[x][y] = ChoiceInformation;