public MINOUTPUT(MINOUTPUT a)
 {
     this.Y1 = new List <string>(a.Y1);
     this.Y2 = new List <string>(a.Y2);
     this.C  = new List <string>(a.C);
     this.tc = a.tc;
 }
        private List <MINOUTPUT> COSTUTILITY(List <List <string> > a, List <List <string> > b, List <List <string> > c)
        {
            List <MINOUTPUT> answer = new List <MINOUTPUT>();
            MINOUTPUT        temp   = new MINOUTPUT();
            List <string>    empty  = new List <string>();

            if (c.Count == 0)
            {
                for (int i = 0; i < a.Count; i++)
                {
                    for (int j = 0; j < b.Count; j++)
                    {
                        temp.Y1 = new List <string>(a[i]);
                        temp.Y2 = new List <string>(b[j]);
                        temp.C  = new List <string>(empty);
                        temp.tc = 0;
                        temp    = COST(temp);
                        answer.Add(new MINOUTPUT(temp));
                    }
                }
                return(answer);
            }

            for (int i = 0; i < a.Count; i++)
            {
                for (int j = 0; j < b.Count; j++)
                {
                    for (int k = 0; k < c.Count; k++)
                    {
                        temp.Y1 = new List <string>(a[i]);
                        temp.Y2 = new List <string>(b[j]);
                        temp.C  = new List <string>(c[k]);
                        temp.tc = 0;
                        temp    = COST(temp);
                        answer.Add(new MINOUTPUT(temp));
                    }
                }
            }
            return(answer);
        }
        MINOUTPUT COST(MINOUTPUT a)
        {
            int g = 0, ng = 0;

            for (int i = 0; i < a.Y1.Count; i++)
            {
                int term_length = 0;
                for (int j = 0; j < a.Y1[i].Length; j++)
                {
                    if (a.Y1[i][j] != '-')
                    {
                        term_length++;
                    }
                }
                if (term_length > 1)
                {
                    g += term_length;
                    ng++;
                }
            }
            for (int i = 0; i < a.Y2.Count; i++)
            {
                int term_length = 0;
                for (int j = 0; j < a.Y2[i].Length; j++)
                {
                    if (a.Y2[i][j] != '-')
                    {
                        term_length++;
                    }
                }
                if (term_length > 1)
                {
                    g += term_length;
                    ng++;
                }
            }
            for (int i = 0; i < a.C.Count; i++)
            {
                int term_length = 0;
                for (int j = 0; j < a.C[i].Length; j++)
                {
                    if (a.C[i][j] != '-')
                    {
                        term_length++;
                    }
                }
                if (term_length > 1)
                {
                    g += term_length;
                    ng++;
                }
            }

            if (a.Y1.Count + a.C.Count > 1)
            {
                g += a.Y1.Count + a.C.Count;
                ng++;
            }
            if (a.Y2.Count + a.C.Count > 1)
            {
                g += a.Y2.Count + a.C.Count;
                ng++;
            }
            a.tc = g + ng;
            //Console.WriteLine("Cost: " + a.tc.ToString());
            return(a);

            #region
            //int l1 = 0, t1 = 0;
            //for (int i = 0; i < a.C.Count; i++)
            //{
            //    int cnt = 0;
            //    for (int j = 0; j < a.C[i].Length; j++)
            //    {
            //        if (a.C[i][j] != '-')
            //        {
            //            ++cnt;
            //            ++l1;
            //        }
            //    }
            //    if (cnt > 1) t1 += 3;
            //}
            //for (int i = 0; i < a.Y1.Count; i++)
            //{
            //    int cnt = 0;
            //    for (int j = 0; j < a.Y1[i].Length; j++)
            //    {
            //        if (a.Y1[i][j] != '-')
            //        {
            //            ++cnt;
            //            ++l1;
            //        }
            //    }
            //    if (cnt > 1) t1 += 2;
            //}
            //for (int i = 0; i < a.Y2.Count; i++)
            //{
            //    int cnt = 0;
            //    for (int j = 0; j < a.Y2[i].Length; j++)
            //    {
            //        if (a.Y2[i][j] != '-')
            //        {
            //            ++cnt;
            //            ++l1;
            //        }
            //    }
            //    if (cnt > 1) t1 += 2;
            //}
            //a.tc = l1 + t1 + 2;
            //return a;
            #endregion
        }