Ejemplo n.º 1
0
 public Cut Clone()
 {
     Cut retCut = new Cut(billet, mainDetail, sectThick, left);
       foreach (OrderPair pair in Pairs)
     retCut.Pairs.Add(new OrderPair(pair.Detail, pair.Num));
       return retCut;
 }
Ejemplo n.º 2
0
        public override Cut Fill(Detail det, double sect)
        {
            int count = (int)(Volume / (det.Volume + sect));
              int countSect = count;
              double fillSize = count * (det.Volume + sect);
              if (Volume - fillSize >= det.Volume) {
            count++;
            fillSize += det.Volume;
              }

              Cut retCut = new Cut(this, det, countSect * sect, Volume - fillSize);
              retCut.Pairs.Add(new OrderPair(det, count));

              return retCut;
        }
Ejemplo n.º 3
0
        private List<src.Cut> greedyAlgorithm()
        {
            List<src.Cut> allCuts = new List<Cut>();

              for (int i = order.Count - 1; i >= 0; i--)
            if (order[i].Num == 0) order.RemoveAt(i);
              if (order.Count == 0) return allCuts;

              order.OrderByDescending(x => x.Detail.Volume);

              Cut cut = new Cut((Detail1D)pgrdTest.SelectedObject, order.First().Detail, cutThick, ((Detail1D)pgrdTest.SelectedObject).Length);

              int index = 0;
              while (order.Count != 0) {
            if (index == order.Count) {
              allCuts.Add(cut);
              cut = new Cut((Detail1D)pgrdTest.SelectedObject, order.First().Detail, cutThick, ((Detail1D)pgrdTest.SelectedObject).Length);
              index = 0;
            }

            if (cut.Add(order[index].Detail)) {
              order[index].Num--;
              if (order[index].Num == 0) order.RemoveAt(index);
            }
            else index++;
              }
              if (cut.Left != ((Detail1D)pgrdTest.SelectedObject).Length) allCuts.Add(cut);
              return allCuts;
        }