Skip to content

Commit 8bb4067

Browse files
committed
Açı değerleri hesaplandı ve Sql'e dahil edildi
Müşteri Listesi Açıya göre sıralaması yapıldı
1 parent e1f241c commit 8bb4067

29 files changed

+3313
-124
lines changed

.vs/GA-ARP-3/v16/.suo

-14 KB
Binary file not shown.
24 KB
Binary file not shown.
0 Bytes
Binary file not shown.
3.98 MB
Binary file not shown.

GA-ARP-3/Form1.Designer.cs

+96-63
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

GA-ARP-3/Form1.cs

+25-37
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ public Form1()
3030
private void Form1_Load(object sender, EventArgs e)
3131

3232
{
33-
// TODO: This line of code loads data into the '_GA_ARP_3DataSet8.Müsteriler' table. You can move, or remove it, as needed.
34-
this.aracTableAdapter.Fill(this._GA_ARP_3DataSet6.Arac);
35-
// this.müsterilerTableAdapter.Fill(this._GA_ARP_3DataSet4.Müsteriler);
33+
// TODO: This line of code loads data into the '_GA_ARP_3DataSet10.Müsteriler' table. You can move, or remove it, as needed.
34+
this.müsterilerTableAdapter2.Fill(this._GA_ARP_3DataSet10.Müsteriler);
35+
3636
baglanti = new SqlConnection("Data Source = BASRI\\BASRI; Initial Catalog = GA-ARP-3; Integrated Security = True");
3737
da = new SqlDataAdapter("Select *From Müsteriler", baglanti);
3838
ds = new DataSet();
@@ -41,19 +41,16 @@ private void Form1_Load(object sender, EventArgs e)
4141
da.Fill(dt);
4242
MusteriGridWiew.DataSource = dt;
4343
baglanti.Close();
44-
4544
listBox1.Items.Clear();
46-
SqlCommand komut = new SqlCommand("Select*From Müsteriler", baglanti);
45+
SqlCommand komut = new SqlCommand("Select*From Müsteriler order by Acılar", baglanti);
4746
try
4847
{
4948
baglanti.Open();
5049
SqlDataReader dr = komut.ExecuteReader();
5150

5251
while (dr.Read())
5352
{
54-
Musteri depo = new Musteri(dr);
55-
MusteriListesi.Add(depo);
56-
53+
MusteriListesi.Add(new Musteri(dr));
5754
}
5855
}
5956
catch { /* error */ }
@@ -76,45 +73,36 @@ private void Form1_Load(object sender, EventArgs e)
7673
Uzaklık[i, j] += Math.Pow(Convert.ToDouble(MusteriGridWiew.Rows[i].Cells[2].Value) - Convert.ToDouble(MusteriGridWiew.Rows[j].Cells[2].Value), 2);
7774
Uzaklık[i, j] = Math.Sqrt(Uzaklık[i, j]);
7875
Uzaklık[i, j] = Math.Ceiling(Uzaklık[i, j]);
79-
listBox1.Items.Add(Uzaklık[i, j]);
76+
// listBox1.Items.Add(Uzaklık[i, j]);
8077
}
81-
for (i = 1; i < MüşteriSayısı; i++)
78+
/* for (i = 1; i < MüşteriSayısı; i++)
8279
{
8380
8481
PolarKoordinat[i] = Geography.AciHesapla(Convert.ToDouble(MusteriGridWiew.Rows[i].Cells[1].Value), Convert.ToDouble(MusteriGridWiew.Rows[i].Cells[2].Value));
85-
// listBox1.Items.Add(PolarKoordinat[i]);
86-
}
82+
MusteriGridWiew.Rows[i].Cells[4].Value = PolarKoordinat[i];
83+
SqlCommand cmd = new SqlCommand("INSERT INTO Müsteriler (ID,X,Y,Talep,Acılar) VALUES (@ID,@X,@Y,@Talep,@Acılar)", baglanti);
84+
baglanti.Open();
85+
cmd.Parameters.AddWithValue("@Talep", Convert.ToDouble(MusteriGridWiew.Rows[i].Cells[4].Value));
86+
baglanti.Close();
87+
}*/
8788
}
8889

89-
public int SıradakiMüsteriID;
9090
private void button1_Click(object sender, EventArgs e)
9191
{
92-
int MüsteriSayisi = MusteriGridWiew.RowCount;
93-
94-
int i = 0;
95-
int MusteriID = i;
96-
for (i = 0; i < MüsteriSayisi; i++)
92+
int MüsteriSayisi = MusteriListesi.Count;
93+
int[] Çözüm = new int[MüsteriSayisi];
94+
int[] EnİyiÇözüm = new int[MüsteriSayisi];
95+
double[,] Uzaklık = new double[MüsteriSayisi, MüsteriSayisi];
96+
double Sonuç, EnİyiSonuç;
97+
for (int i = 0; i < MüsteriSayisi; i++)
9798
{
98-
int MusteriTalep = Convert.ToInt32(MusteriGridWiew.Rows[i].Cells[3].Value);
99-
100-
for (int j = 0; j < AracGridWiew.RowCount; j++)
101-
{
102-
int AracKapasitesi = Convert.ToInt32(AracGridWiew.Rows[j].Cells[2].Value);
103-
104-
if (MusteriTalep < AracKapasitesi)
105-
{
106-
107-
MusteriID = i;
108-
SıradakiMüsteriID = i + 1;
109-
AracKapasitesi = AracKapasitesi - MusteriTalep;
110-
MüsteriSayisi = MüsteriSayisi - 1;
111-
}
112-
else
113-
{
114-
SıradakiMüsteriID = 0;
115-
}
116-
}
99+
Çözüm[i] = i;
117100
}
101+
Sonuç = Geography.AmaçFonkHesapla(MüsteriSayisi, Çözüm, Uzaklık);
102+
Array.Copy(Çözüm, EnİyiÇözüm, Çözüm.Length);
103+
EnİyiSonuç = Sonuç;
104+
listBox1.Items.Add(EnİyiSonuç);
105+
118106
}
119107
}
120108
}

0 commit comments

Comments
 (0)