当前位置:编程学习 > C#/ASP.NET >>

请大家帮我想想

  public void Test1()
        {
            ArrayList list = new ArrayList();
            //primary configuration of cities
            Init();

            int[] next = new int[ClassUnit.WeekDay * ClassUnit.CourseCount];
            int iteration = -1;
            //the probability
            double proba;
            double alpha = 0.999;
            double temperature = 400.0;
            double epsilon = 0.002;
            double delta;
            int i;
            int cc = 0;

            double Value = 0;
            for (i = 0; i < ClassList.Count; i++)
            {
                Value += ComputeValue(ClassList[0].XuLie);
            }
            Value += ComputeChongtuValue();
            Value += 20000;
            Console.WriteLine("-----------当前最优值:{0}-------------", Value);
            //PrintDetail(ClassList[0]);
            PrntList();
            //while the temperature didnt reach epsilon
            while (temperature > epsilon)
            {
                iteration++;
                cc = cc % ClassList.Count;
                //get the next random permutation of distances 
                CreateNext(ClassList[cc].XuLie, next);
                //compute the distance of the new permuted configuration
                delta = ComputeValue(next);
                for (i = 0; i < ClassList.Count; i++)
                {
                    if (i == cc) { continue; }
                    delta += ComputeValue(ClassList[i].XuLie); ;
                }
                delta += ComputeChongtuValue(next, cc);
                delta = delta - Value;
                //if the new distance is better accept it and assign it
                if (delta < 0)
                {
                    assign(ClassList[cc].XuLie, next);
                    Value = delta + Value;
                    Console.WriteLine("-----------当前最优值:{0}-------------", Value);
                    PrntList();
                    //ComputeValue(ClassList[0].XuLie);
                }
                else
                {
                    proba = rnd.Next();
                    //if the new distance is worse accept it but with a probability level
                    // if the probability is less than E to the power -delta/temperature.
                    //otherwise the old value is kept
                    if (proba < Math.Exp(-delta / temperature))
                    {
                        assign(ClassList[cc].XuLie, next);
                        Value = delta + Value;
                    }
                }
                //cooling proces on every iteration
                temperature *= alpha;
                //print every 400 iterations
                if (iteration % 400 == 0)
                {
                    // Console.WriteLine(Value);
                }
                cc++;
            }
        }

        
    }
}
请问这段代码所要实现的功能?

--------------------编程问答-------------------- 估計這樣的問題不會有人回答你的了樓主。。
還是來個無滿意答案結貼吧。嘿嘿。
补充:.NET技术 ,  VB.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,