Witam,
Zwracam się z dość zapewne dziwną prośbą, ale niestety program, który muszę jutro oddać na zaliczenie nie działa. W związku z tym, że wcześniej działał domyślam się, że problem polega na zapętleniu w tej funkcji (główna funkcja algorytmu, generowanie instancji problemu działa bez zarzutów). Algorytm (przynajmniej w zamyśle :P) tabu search.
Z góry dzięki za wszelką pomoc.
public void run()
{
Result Res = new Result();
TabuElem elem = new TabuElem();
List<long> instantResult = new List<long>();
List<long> taboo = new List<long>();
this.readInstance();
Res.mark = 0;
int steper = 0;
while (Res.mark < 90 || steper < 10)
{
instantResult = this.losuj();
elem = this.Rate(instantResult);
int steps = 0;
while (steps < 10)
{
if (Res.mark > 90)
break;
if (elem.mark < Res.mark)
{
this.tabuList.Add(elem);
}
else
{
Res.result = elem.result;
Res.mark = elem.mark;
}
foreach (int ind in elem.toImprove)
{
taboo.Add(instantResult[ind]);
bool changer = false;
while (changer)
{
Random rand = new Random();
int index = rand.Next(0, this.odcinki.Count() - 1);
if (!instantResult.Contains(this.odcinki[index]) &&
!taboo.Contains(this.odcinki[index]))
{
instantResult[ind] = this.odcinki[index];
changer = true;
}
}
}
elem = this.Rate(instantResult);
steps++;
}
steper++;
}
}