Exemplo n.º 1
0
Arquivo: State.cs Projeto: tlyon3/TSP
 

 public State(RMatrix m, City c, int n, int s)
 {
     
                        this.matrix = m; 
                       this.bssfCost = m.computeLowerBound(s); 
                        this.city = c; 
                 this.node = n; 
                 this.visited = new HashSet <int>(); 
 this.visited.Add(n); 
                   this.route = new ArrayList(); 
 this.route.Add(c); 

 }
Exemplo n.º 2
0
Arquivo: State.cs Projeto: tlyon3/TSP
 public RMatrix matrix; 
 public double currentCost; 
 public City city; 
 public HashSet <int> visited; 
 public int node; 
 public ArrayList route; 
 public double bssfCost; 

 public State(State prevState, double extraCost, int node, City city, int size)
 {
     
                       this.node = node; 
                      this.city = city; 
                      this.currentCost = prevState.currentCost + extraCost; 
                  this.visited = new HashSet <int>(prevState.visited); 
 this.visited.Add(node); 
                        this.matrix = new RMatrix(prevState.matrix, size); 
                     this.bssfCost = matrix.update(prevState.node, node, size) + prevState.bssfCost; 
                        this.route = (ArrayList)prevState.route.Clone(); 
 this.route.Add(city); 

 }
Exemplo n.º 3
0
	class RMatrix {
		public double[,] matrix;


		public RMatrix(RMatrix m, int citiesSize){
			matrix = new double[citiesSize, citiesSize];
  			Array.Copy(m.matrix, matrix, m.matrix.Length);
		}
		public RMatrix(City[] cities){
			matrix = new double[cities.Length, cities.Length];