public void fill_initial_matrix(Kemeni_Snella obj) { this.paretto = new int[count_attributes]; //communication value if (this.communication_index < obj.communication_index) { this.paretto[0] = 1; } else if (this.communication_index > obj.communication_index) { this.paretto[0] = -1; } else { this.paretto[0] = 0; } //infrastucture value if (this.infrastructure_index < obj.infrastructure_index) { this.paretto[1] = 1; } else if (this.infrastructure_index > obj.infrastructure_index) { this.paretto[1] = -1; } else { this.paretto[1] = 0; } //distance value if (this.distance < obj.distance) { this.paretto[2] = 1; } else if (this.distance > obj.distance) { this.paretto[2] = -1; } else { this.paretto[2] = 0; } //cost value if (this.cost < obj.cost) { this.paretto[3] = 1; } else if (this.cost > obj.cost) { this.paretto[3] = -1; } else { this.paretto[3] = 0; } }
static void Main(string[] args) { bool[] test = new bool[5]; Kemeni_Snella[] all_lands = new Kemeni_Snella[5]; Kemeni_Snella kemeni_snella_1 = new Kemeni_Snella(true, "good", 300, 50000); //kemeni_snella_1.fill_elements_of_matrix_comparison(); Kemeni_Snella kemeni_snella_2 = new Kemeni_Snella(false, "medium", 100, 40000); Kemeni_Snella kemeni_snella_3 = new Kemeni_Snella(true, "bad", 200, 35000); Kemeni_Snella kemeni_snella_4 = new Kemeni_Snella(true, "good", 250, 45000); Kemeni_Snella kemeni_snella_5 = new Kemeni_Snella(false, "good", 50, 40000); all_lands[0] = kemeni_snella_1; all_lands[1] = kemeni_snella_2; all_lands[2] = kemeni_snella_3; all_lands[3] = kemeni_snella_4; all_lands[4] = kemeni_snella_5; for (int i = 0; i < all_lands.Length; i++) { for (int j = 0; j < all_lands.Length; j++) { test[i] = all_lands[i].exclude_variant(all_lands[j]); if (!test[i]) { test[i] = false; all_lands[i] = null; break; } } } all_lands = Array.FindAll(all_lands, x => x != null); for (int i = 0; i < test.Length; i++) { Console.WriteLine(test[i]); } Saati cost_varint = new Saati(); cost_varint.all_methods(); Matrix matrix = new Matrix(); matrix.fill_martrix_comparison_pairs(cost_varint.get_count_attribute(), all_lands.Length, all_lands); matrix.fill_matrix_loss(cost_varint.get_count_attribute(), all_lands.Length, cost_varint); matrix.final_ranking(); matrix.show_preliminary_ranking(); }
public int fill_elements_of_matrix_comparison(int index, Kemeni_Snella obj) { fill_initial_matrix(obj); if (this.paretto[index] == 0) { return(0); } else if (this.paretto[index] == 1) { return(1); } else { return(-1); } }
public bool exclude_variant(Kemeni_Snella obj) { bool[] medium_check = new bool[count_attributes]; if (obj == null) { //Object doesn't exist return(true); } fill_initial_matrix(obj); if (Array.Exists(this.paretto, x => x == 1) && Array.Exists(this.paretto, x => x == -1)) { return(true); } else if (!Array.Exists(this.paretto, x => x == -1)) { return(true); } else { return(false); } }