예제 #1
0
파일: State.cs 프로젝트: 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); 

 }
예제 #2
0
파일: State.cs 프로젝트: 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); 

 }
예제 #3
0
파일: RMatrix.cs 프로젝트: tlyon3/TSP
	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];