none
C#程式debug RRS feed

  • 問題

  • 你好,我是C#很菜的新手,麻煩各位幫幫我解決一個小問題,非常感謝。

            struct Node                      // 顧客點
            {
                public int NodeNumber;       // 顧客編號
                public int X;                // X座標
                public int Y;                // Y座標
                public int demand;          // 顧客需求量
                public float sectime; 
                public int check;          // 檢查顧客點是否被指派
                public double ServiceTime;   // 服務時間
                public double md;            //餐點需求1:正常2:素3:特殊
                public double ct;            //顧客類型1:固定2:臨時
                public int behind;
                public int bestbehind;
                public int before;
                public int bestbefore;
                public double leavetime;
                public double angle;
                public double asin;
                public double q;
                public int NewNodeNumber;    //排序後新的顧客編號
                public float Matrix;
            }

           private void button2_Click(object sender, EventArgs e)
            {
                Application.Exit();
            }
            float[,] CityCoordinates;
            float[,] DisMatrix;
            float[,] Matrix;
            float[,] Dissec;
            string[] F;
            int L;
            int Car;
            int x0;
            int y0;
            int demand;             //一車需求量不可超過13
            float sectime;
            double angle;
            int forward;
            int forward1;
            public void GatherProblemInfo(string Problem_txt)
            {

                //距離矩陣m
                DisMatrix = new float[y.Length, y.Length];
                string[] Matrix = new string[252];
                for (int i = 2 + Car; i < y.Length+2; i++)
                {
                    for (int j = 2 + Car; j < y.Length+2; j++)
                    {
                        DisMatrix[i - Car - 2, j - Car - 2] = (float)Math.Pow((Math.Pow(Customer[i - Car - 2].X - Customer[j - Car - 2].X, 2) + Math.Pow((Customer[i - Car - 2].Y - Customer[j - Car - 2].Y), 2)), 0.5);
                        Matrix[i - Car - 2] = Matrix[i - Car - 2] + DisMatrix[i - Car - 2, j - Car - 2] + "\t\t";
                    }
                }
                richTextBox10.Lines = Matrix;

                   int c1;         //ci-1,ci
                    int c2;         //ci,ci+1
                    int c3;         //cj+1,cj
                    int c4;         //ci,cj+1
                    int c5;         //ci,cj
                    int c6;         //ci-1,ci+1
                    int beexchang;  //交換前
                    int afexchang;  //交換後
                    int savecost;   //交換前-交換後>0
                    for (int i = 0; i < R; i++)
                    {
                        for (int j = 0; j < R; j++)
                        {
                            c1 = DisMatrix[i - 1, i].Matrix;
                            c2 = DisMatrix[i, i + 1].Matrix;
                            c3 = DisMatrix[j, j + 1].Matrix;
                            c4 = DisMatrix[i, j + 1].Matrix;
                            c5 = DisMatrix[j, i].Matrix;
                            c6 = DisMatrix[i - 1, i + 1].Matrix;
                            beexchang = c1 + c2 + c3;
                            afexchang = c4 + c5 + c6;
                            savecost = beexchang - afexchang;
                            if (savecost > 0)
                            {
     
                            }

                        }
                    }
                    richTextBox4.Lines = soluation7;

    錯誤 訊息為 'float' 不包含 'Matrix' 的定義 

    請問要如何修正??

    謝謝各位

    2010年11月3日 下午 01:25

所有回覆