Could somebody help me?
This function should call to make_schedule(temp_lim) until the returned value "gap" satisfies me.
I know for sure (same function in c++), that "gap < 1" takes up to 10k-15k runs, ... ,"gap < 5" takes ~fifty runs. But here in C# it goes to "not responding" immediately (endless loop?) !!
public void make_weighted_schedule(Limitation lim)
{
Limitation temp_lim = new Limitation(lim);
int attempts = 1;
double gap = double.NaN;
while (true)
{
gap = make_schedule(temp_lim);
if (gap < 1)
{
MessageBox.Show(gap.ToString());
break;
}
else
{
temp_lim = lim;
attempts++;
}
}
output_string = output_string + temp_lim.print_limitations();
output_string = output_string + print_schedule();
output_string = output_string + Environment.NewLine + "The maximum gap is " + gap + " weighted shift! It took " + attempts + " attempts." + Environment.NewLine;
}
Though, if i change line 6 to: while (attempts < 1000000)
the whole thing runs 1000000 times.
It never reaches line 11 at all!!
i thing the problem is, that in C# the program doesn't wait for make_schedule(temp_lim) to complete, and goes on with the old value of "gap" to endless loop.