none
拜託幫我看看哪兒出錯,run出結果是錯的 RRS feed

  • 問題

  • //掃描法將排序好的角度依序排入路線中
                int R = 1;
                Route[] route = new Route[252];
                route[R].DD = 0;
                route[R].ST = 0;
                for (int i = 1; i < y.Length; i++)
                {

                    //route[R].StartNode=forward;
                    forward = Customer[i].NodeNumber;
                    forward1 = 0;
                    if (route[R].DD <= 13)
                    {
                        route[R].StartNode = Customer[forward].NodeNumber;
                        Customer[Customer[forward].NodeNumber].behind = forward1;
                        route[R].DD += Customer[forward].demand;
                        route[R].ST += Dissec[0, Customer[forward].NodeNumber];
                    }
                    else
                    {
                        R = R + 1;
                        route[R].StartNode = Customer[Customer[forward1].NodeNumber].behind;
                        route[R].DD += Customer[forward].demand;
                        route[R].ST += Dissec[0, Customer[forward].NodeNumber];
                    }
                   
                }
                for (int b = 0; b<=R;b++)
                {
                    soluation4[b] = "路線" + R + "=" + 0 + "-" + forward + "-" + 0 + "\t";
                    soluation4[b] += "需求=" + route[R].DD + "\t";
                    soluation4[b] += "行駛時間=" + route[R].ST + "\t";
                }
            richTextBox7.Lines = soluation4; 
            }

     

     

    首先將已排序好的顧客點排入路線中,如果車容量滿;就新增路線。

    出現的答案應為:路線1:0-34-22-15-17-46-50-20-48-16-19-49 需求=13; 行駛時間=3663.11

    2010年9月15日 下午 01:46