public void Solve(string filename)
        {
            _agirlikLimiti = ReadInput(filename);

            YedekCozum candidate = new YedekCozum(_items, -1, null);
            YedekCozum best      = candidate;

            OncelikSirasi <int, YedekCozum> queue = new OncelikSirasi <int, YedekCozum>();

            queue.Add(candidate, ComputeBounds(candidate, ref best));

            while (queue.Count > 0 && queue.YuksekOncelik >= best.Deger)
            {
                YedekCozum root = queue.RemoveYuksekOncelik();
                int        k    = root.Index + 1;

                for (int j = k; j < _items.Count; j++)
                {
                    YedekCozum child = new YedekCozum(_items, j, root);

                    if (child.Agirlik <= _agirlikLimiti)
                    {
                        int childBounds = ComputeBounds(child, ref best);

                        if (childBounds > best.Deger)
                        {
                            queue.Add(child, childBounds);
                        }
                    }
                }
            }

            _toplamDeger   = best.Deger;
            _toplamAgirlik = best.Agirlik;

            while (best.Onceki != null)
            {
                SirtCantasiEsyasi tmp = _items[best.Index];

                tmp.SelectionText  = "X";
                _items[best.Index] = tmp;
                best = best.Onceki;
            }
        }
        public int ReadInput(string filename)
        {
            int bound;
            List <SirtCantasiEsyasi> tmpList = new List <SirtCantasiEsyasi>();

            using (StreamReader sr = new StreamReader(filename))
            {
                Int32.TryParse(sr.ReadLine(), out bound);

                while (!sr.EndOfStream)
                {
                    string[]          pieces  = sr.ReadLine().Split(',');
                    SirtCantasiEsyasi newItem = new SirtCantasiEsyasi(Convert.ToInt32(pieces[0]), Convert.ToInt32(pieces[1]), Convert.ToInt32(pieces[2]));
                    tmpList.Add(newItem);
                }

                tmpList.Sort();
            }

            _items = tmpList;
            return(bound);
        }