Skip to content

Commit 2c19e6f

Browse files
committed
Rotalı
1 parent bfbcdfd commit 2c19e6f

21 files changed

+360
-145
lines changed

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

-1 KB
Binary file not shown.
4 KB
Binary file not shown.

GA-ARP-3/ARAÇ EKLE.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ private void rasgele_button_Click(object sender, EventArgs e)
7979
for (int i = 0; i < AracSayisi; i++)
8080
{
8181
bool Kullanıldımı = false;
82-
int Kapasite = rastgele.Next(500, 5000);
82+
int Kapasite = rastgele.Next(30000,50000);
8383
id_TextBox.Text = i.ToString();
8484
Kapasite_TextBoz.Text = Kapasite.ToString();
8585

GA-ARP-3/Form1.Designer.cs

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

GA-ARP-3/Form1.cs

+80-66
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ public Form1()
2929
private void Form1_Load(object sender, EventArgs e)
3030

3131
{
32-
// TODO: This line of code loads data into the '_GA_ARP_3DataSet10.Müsteriler' table. You can move, or remove it, as needed.
33-
this.müsterilerTableAdapter2.Fill(this._GA_ARP_3DataSet10.Müsteriler);
32+
// TODO: This line of code loads data into the '_GA_ARP_3DataSet2.Müsteriler' table. You can move, or remove it, as needed.
33+
this.müsterilerTableAdapter3.Fill(this._GA_ARP_3DataSet2.Müsteriler);
34+
3435

3536
baglanti = new SqlConnection("Data Source = BASRI\\BASRI; Initial Catalog = GA-ARP-3; Integrated Security = True");
3637
da = new SqlDataAdapter("Select *From Müsteriler order by Acılar", baglanti);
@@ -46,19 +47,20 @@ private void Form1_Load(object sender, EventArgs e)
4647
baglanti.Open();
4748
komut = new SqlCommand(sql, baglanti);
4849
SqlDataReader dr = komut.ExecuteReader();
49-
while(dr.Read())
50+
while (dr.Read())
5051
{
5152
Musteri depo = new Musteri();
5253
depo.ID = Convert.ToInt32(dr[0]);
5354
depo.X = Convert.ToDouble(dr[1]);
5455
depo.Y = Convert.ToDouble(dr[2]);
5556
depo.Talep = Convert.ToInt32(dr[3]);
5657
depo.Acılar = Convert.ToDouble(dr[4]);
58+
depo.Gidildimi = Convert.ToBoolean(dr[5]);
5759
MusteriListesi.Add(depo);
5860
}
5961
baglanti.Close();
6062

61-
string sql1 = "SELECT*FROM Arac";
63+
string sql1 = "SELECT*FROM Arac ";
6264
baglanti.Open();
6365
komut = new SqlCommand(sql1, baglanti);
6466
SqlDataReader dr1 = komut.ExecuteReader();
@@ -67,11 +69,11 @@ private void Form1_Load(object sender, EventArgs e)
6769
Araclar arac = new Araclar();
6870
arac.ID = Convert.ToInt32(dr1[0]);
6971
arac.Kapasite = Convert.ToInt32(dr1[1]);
70-
arac.Kullanildimi = Convert.ToBoolean(dr1[2]);;
72+
arac.Kullanildimi = Convert.ToBoolean(dr1[2]); ;
7173
Araclist.Add(arac);
7274
}
7375
baglanti.Close();
74-
// listBox1.Items.Add(Convert.ToString(Araclist));
76+
// listBox1.Items.Add(Convert.ToString(Araclist));
7577
/* SqlCommand komut = new SqlCommand("Select*From Müsteriler order by Acılar", baglanti);
7678
try
7779
{
@@ -100,23 +102,20 @@ private void Form1_Load(object sender, EventArgs e)
100102
finally { baglanti.Close(); }*/
101103

102104
int MüşteriSayısı = MusteriGridWiew.RowCount - 1;
103-
int[] Çözüm = new int[MüşteriSayısı];
104-
int[] EnİyiÇözüm = new int[MüşteriSayısı];
105+
105106
int i, j;
106107
double[,] Uzaklık = new double[MüşteriSayısı, MüşteriSayısı];
107-
double[] PolarKoordinat = new double[MüşteriSayısı];
108-
double[] X = new double[MüşteriSayısı - 1];
109-
double[] Y = new double[MüşteriSayısı - 1];
110108

111-
109+
110+
112111
for (i = 0; i < MüşteriSayısı; i++)
113112
for (j = 0; j < MüşteriSayısı; j++)
114113
{
115114
Uzaklık[i, j] = Math.Pow(Convert.ToDouble(MusteriGridWiew.Rows[i].Cells[1].Value) - Convert.ToDouble(MusteriGridWiew.Rows[j].Cells[1].Value), 2);
116115
Uzaklık[i, j] += Math.Pow(Convert.ToDouble(MusteriGridWiew.Rows[i].Cells[2].Value) - Convert.ToDouble(MusteriGridWiew.Rows[j].Cells[2].Value), 2);
117116
Uzaklık[i, j] = Math.Sqrt(Uzaklık[i, j]);
118117
Uzaklık[i, j] = Math.Ceiling(Uzaklık[i, j]);
119-
// listBox1.Items.Add(Uzaklık[i, j]);
118+
// listBox1.Items.Add(Uzaklık[i, j]);
120119
}
121120
/* for (i = 1; i < MüşteriSayısı; i++)
122121
{
@@ -131,77 +130,92 @@ private void Form1_Load(object sender, EventArgs e)
131130

132131
private void button1_Click(object sender, EventArgs e)
133132
{
134-
string Guzergah = Convert.ToString(MusteriListesi[0].ID);
133+
135134
int MüsteriSayisi = MusteriListesi.Count;
136135
int[] Çözüm = new int[MüsteriSayisi];
137136
int[] EnİyiÇözüm = new int[MüsteriSayisi];
138137
double[,] Uzaklık = new double[MüsteriSayisi, MüsteriSayisi];
139-
int i;
138+
int i, j;
140139
double Sonuç, EnİyiSonuç;
141-
for (i=0 ; i < MüsteriSayisi; i++)
140+
for (i = 0; i < MüsteriSayisi; i++)
141+
for (j = 0; j < MüsteriSayisi; j++)
142+
{
143+
Uzaklık[i, j] = Math.Pow(Convert.ToDouble(MusteriGridWiew.Rows[i].Cells[1].Value) - Convert.ToDouble(MusteriGridWiew.Rows[j].Cells[1].Value), 2);
144+
Uzaklık[i, j] += Math.Pow(Convert.ToDouble(MusteriGridWiew.Rows[i].Cells[2].Value) - Convert.ToDouble(MusteriGridWiew.Rows[j].Cells[2].Value), 2);
145+
Uzaklık[i, j] = Math.Sqrt(Uzaklık[i, j]);
146+
Uzaklık[i, j] = Math.Ceiling(Uzaklık[i, j]);
147+
// listBox1.Items.Add(Uzaklık[i, j]);
148+
}
149+
for (i = 0; i < MüsteriSayisi; i++)
142150
{
143151
Çözüm[i] = i;
144152
}
145153
Sonuç = Geography.AmaçFonkHesapla(MüsteriSayisi, Çözüm, Uzaklık);
146154
Array.Copy(Çözüm, EnİyiÇözüm, Çözüm.Length);
147155
EnİyiSonuç = Sonuç;
148-
for(i=0;i<MüsteriSayisi-1 ;i++)
149-
{
150-
List<Musteri> bireyinMusterileri = MusteriListesi.CloneList().ToList();
151-
List<Araclar> bireyinAraclari = Araclist.CloneList().ToList();
152-
int SuankiMusteri = Convert.ToInt32(bireyinMusterileri[i].ID);
153-
int SıradakiMüsteri = Convert.ToInt32(bireyinMusterileri[i+1].ID);
154-
for (int j =0; j <Araclist.Count;j++)
155-
{
156-
for (int a = 0; a < bireyinMusterileri.Count; a++)
157-
{
158-
if (bireyinMusterileri[a].Talep <= bireyinAraclari[j].Kapasite && bireyinAraclari[j].Kullanildimi == false)
159-
{
160-
int SuankiTalep = bireyinMusterileri[a].Talep;
161-
SuankiMusteri = bireyinMusterileri[a].ID;
162-
int Kapasite = bireyinAraclari[j].Kapasite - bireyinMusterileri[a].Talep;
163-
SıradakiMüsteri = bireyinMusterileri[a + 1].ID;
164-
Guzergah += "*" + Convert.ToString(SıradakiMüsteri);
165-
if (bireyinMusterileri[a].ID != 0)
166-
{
167-
bireyinMusterileri.RemoveAt(a);
168-
}
169-
170-
if (Kapasite < bireyinMusterileri[a + 1].Talep)
171-
{
172-
SıradakiMüsteri = bireyinMusterileri[0].ID;
173-
bireyinAraclari[j].Kullanildimi = true;
174-
Guzergah += "*" + Convert.ToString(SıradakiMüsteri) + "---";
175-
}
176-
else
177-
{
178-
SıradakiMüsteri = bireyinMusterileri[a + 1].ID;
179-
Guzergah += "*" + Convert.ToString(SıradakiMüsteri);
180-
}
156+
int itersay = 200;
157+
int Mus1;
158+
// for(i=0;i<itersay ;i++)
159+
// {
181160

182-
}
183161

184-
else
162+
163+
List<Araclar> bireyinAraclari = Araclist.CloneList().ToList();
164+
List<Musteri> bireyinMusterileri = MusteriListesi.CloneList().ToList();
165+
int a = 0;
166+
string Guzergah = " ";
167+
for (int b = 0; b < bireyinAraclari.Count; b++)
168+
{
169+
170+
for (a=a; a<MüsteriSayisi;a++)
171+
{
172+
173+
try
174+
{
175+
if (bireyinAraclari[b].Kullanildimi == false && bireyinMusterileri[a].Talep <= bireyinAraclari[b].Kapasite && bireyinMusterileri[a].Gidildimi == false)
176+
{
177+
Mus1 = bireyinMusterileri[a].ID;
178+
// Mus2 = bireyinMusterileri[a + 1].ID;
179+
bireyinAraclari[b].Kapasite = bireyinAraclari[b].Kapasite - bireyinMusterileri[a].Talep;
180+
Guzergah += "*" + Convert.ToString(Mus1);
181+
bireyinMusterileri[a].Gidildimi = true;
182+
183+
}
184+
else
185185
{
186-
SıradakiMüsteri = bireyinMusterileri[0].ID;
187-
bireyinAraclari[j].Kullanildimi = true;
186+
187+
Mus1 = bireyinMusterileri[a].ID;
188+
bireyinAraclari[b].Kullanildimi = true;
189+
bireyinAraclari[b].Kapasite = bireyinAraclari[b].Kapasite - bireyinMusterileri[a].Talep;
190+
Guzergah += "*" + Convert.ToString(Mus1);
191+
Guzergah += "*0 *0";
192+
listBox1.Items.Add(String.Format("{0}", Guzergah));
193+
break;
194+
188195
}
196+
189197
}
198+
catch (Exception)
199+
{
200+
201+
}
202+
203+
190204
}
191-
int Tmp = Çözüm[SuankiMusteri];
192-
Çözüm[SuankiMusteri] = Çözüm[SıradakiMüsteri];
193-
Çözüm[SıradakiMüsteri] = Tmp;
194-
Sonuç = Geography.AmaçFonkHesapla(MüsteriSayisi, Çözüm, Uzaklık);
195-
if (Sonuç < EnİyiSonuç)
196-
{
197-
Array.Copy(Çözüm, EnİyiÇözüm, Çözüm.Length);
198-
EnİyiSonuç = Sonuç;
199-
}
200-
}
201-
for (i = 0; i < EnİyiÇözüm.Length; i++)
202-
{
203-
listBox1.Items.Add(String.Format ("{0}\t",Guzergah));
205+
206+
/* Sonuç = Geography.AmaçFonkHesapla(MüsteriSayisi, Çözüm, Uzaklık);
207+
if (Sonuç < EnİyiSonuç)
208+
{
209+
Array.Copy(Çözüm, EnİyiÇözüm, Çözüm.Length);
210+
EnİyiSonuç = Sonuç;
211+
}
212+
for (i = 0; i < EnİyiÇözüm.Length; i++)
213+
{
214+
215+
}*/
204216
}
217+
218+
205219
}
206220
}
207221
internal static class Extensions

GA-ARP-3/Form1.resx

+9
Original file line numberDiff line numberDiff line change
@@ -147,4 +147,13 @@
147147
<metadata name="müsterilerTableAdapter2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
148148
<value>917, 56</value>
149149
</metadata>
150+
<metadata name="müsterilerBindingSource3.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
151+
<value>17, 95</value>
152+
</metadata>
153+
<metadata name="_GA_ARP_3DataSet2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
154+
<value>1103, 56</value>
155+
</metadata>
156+
<metadata name="müsterilerTableAdapter3.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
157+
<value>209, 95</value>
158+
</metadata>
150159
</root>

GA-ARP-3/GA-ARP-3.csproj

+32
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@
107107
<Compile Include="Program.cs" />
108108
<Compile Include="Properties\AssemblyInfo.cs" />
109109
<Compile Include="Veriişlemleri.cs" />
110+
<Compile Include="_GA_ARP_3DataSet.Designer.cs">
111+
<AutoGen>True</AutoGen>
112+
<DesignTime>True</DesignTime>
113+
<DependentUpon>_GA_ARP_3DataSet.xsd</DependentUpon>
114+
</Compile>
110115
<Compile Include="_GA_ARP_3DataSet1.Designer.cs">
111116
<AutoGen>True</AutoGen>
112117
<DesignTime>True</DesignTime>
@@ -122,6 +127,11 @@
122127
<DesignTime>True</DesignTime>
123128
<DependentUpon>_GA_ARP_3DataSet11.xsd</DependentUpon>
124129
</Compile>
130+
<Compile Include="_GA_ARP_3DataSet2.Designer.cs">
131+
<AutoGen>True</AutoGen>
132+
<DesignTime>True</DesignTime>
133+
<DependentUpon>_GA_ARP_3DataSet2.xsd</DependentUpon>
134+
</Compile>
125135
<Compile Include="_GA_ARP_3DataSet3.Designer.cs">
126136
<AutoGen>True</AutoGen>
127137
<DesignTime>True</DesignTime>
@@ -189,6 +199,17 @@
189199
<DependentUpon>Settings.settings</DependentUpon>
190200
<DesignTimeSharedInput>True</DesignTimeSharedInput>
191201
</Compile>
202+
<None Include="_GA_ARP_3DataSet.xsc">
203+
<DependentUpon>_GA_ARP_3DataSet.xsd</DependentUpon>
204+
</None>
205+
<None Include="_GA_ARP_3DataSet.xsd">
206+
<Generator>MSDataSetGenerator</Generator>
207+
<LastGenOutput>_GA_ARP_3DataSet.Designer.cs</LastGenOutput>
208+
<SubType>Designer</SubType>
209+
</None>
210+
<None Include="_GA_ARP_3DataSet.xss">
211+
<DependentUpon>_GA_ARP_3DataSet.xsd</DependentUpon>
212+
</None>
192213
<None Include="_GA_ARP_3DataSet1.xsc">
193214
<DependentUpon>_GA_ARP_3DataSet1.xsd</DependentUpon>
194215
</None>
@@ -222,6 +243,17 @@
222243
<None Include="_GA_ARP_3DataSet11.xss">
223244
<DependentUpon>_GA_ARP_3DataSet11.xsd</DependentUpon>
224245
</None>
246+
<None Include="_GA_ARP_3DataSet2.xsc">
247+
<DependentUpon>_GA_ARP_3DataSet2.xsd</DependentUpon>
248+
</None>
249+
<None Include="_GA_ARP_3DataSet2.xsd">
250+
<Generator>MSDataSetGenerator</Generator>
251+
<LastGenOutput>_GA_ARP_3DataSet2.Designer.cs</LastGenOutput>
252+
<SubType>Designer</SubType>
253+
</None>
254+
<None Include="_GA_ARP_3DataSet2.xss">
255+
<DependentUpon>_GA_ARP_3DataSet2.xsd</DependentUpon>
256+
</None>
225257
<None Include="_GA_ARP_3DataSet3.xsc">
226258
<DependentUpon>_GA_ARP_3DataSet3.xsd</DependentUpon>
227259
</None>

GA-ARP-3/Musteri.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,22 @@ public Musteri()
2424
{
2525

2626
}
27-
public Musteri(int ID, double X, double Y, int Talep,double Acılar)
27+
public Musteri(int ID, double X, double Y, int Talep,double Acılar,Boolean Gidildimi)
2828
{
2929
this.ID = ID;
3030
this.X = X;
3131
this.Y = Y;
3232
this.Talep = Talep;
3333
this.Acılar = Acılar;
34+
this.Gidildimi = Gidildimi;
3435
}
3536

3637
public int ID { get; set; }
3738
public double X { get; set; }
3839
public double Y { get; set; }
3940
public int Talep { get; set; }
4041
public double Acılar { get; set; }
42+
public Boolean Gidildimi { get; set; }
4143

4244
/* int _ID;
4345
double _X;

0 commit comments

Comments
 (0)