Exemple #1
0
 public void create_ffd_cutting_map()
 {
     while (!dl.check_empty_wl())
     {
         Cutting_Pattern cp             = new Cutting_Pattern(M, L);
         int             current_detail = 0;
         bool            next           = false;
         while (!next)
         {
             if (cp.add_detail(dl.work_list[current_detail])) //Если можно добавить текущую деталь
             {
                 dl.work_list[current_detail].cb--;
                 continue;
             }
             else
             {
                 if (cp.h == 0 || cp.h < dl.work_list[dl.work_list.Count - 1].l)
                 {
                     next = true;
                 }
                 else
                 {
                     if (current_detail < dl.work_list.Count - 1)
                     {
                         current_detail++;
                     }
                     else
                     {
                         next = true;
                     }
                 }
             }
         }
         cp_list.Add(cp);
     }
 }
Exemple #2
0
        public void S_task()
        {
            dl.reset_cb();
            dl.update_work_list();
            calc_y_first();
            cp_list.Clear();
            while (!dl.check_empty_wl())
            {
                dl.sort_by__y();
                calc_barier();
                Cutting_Pattern cp = new Cutting_Pattern(M, L);
                double          _f;
                double          fi;
                double          old_barier  = 0;
                int             place_count = 1;
                int             prev        = 0;
                dl.current_detail = 0;
                bool was_step_back = false;
                while (cp.h >= dl.calc_min() && !dl.check_empty_wl())
                {
                    if (cp.h < dl.work_list[dl.current_detail].l && !was_step_back)
                    {
                        dl.next();
                        continue;
                    }
                    _f = dl.work_list[dl.current_detail]._y * cp.h;
                    if (_f >= barier) // step forward //запатчтил остаток
                    {
                        if (dl.work_list[dl.current_detail].cb >= place_count)
                        {
                            for (int i = 0; i < place_count; ++i)
                            {
                                cp.add_detail(dl.work_list[dl.current_detail]);
                            }
                            dl.work_list[dl.current_detail].cb -= place_count;
                        }
                        else
                        {
                            for (int i = 0; i < dl.work_list[dl.current_detail].cb; ++i)
                            {
                                cp.add_detail(dl.work_list[dl.current_detail]);
                            }
                            dl.work_list[dl.current_detail].cb = 0;
                        }
                        fi         = dl.work_list[dl.current_detail].y * cp.map[dl.work_list[dl.current_detail].i];
                        old_barier = barier;
                        prev       = dl.current_detail;
                        barier    -= fi;
                        dl.next();
                        was_step_back = false;
                        place_count   = 1;
                    }
                    else // step back
                    {
                        if (was_step_back)
                        {
                            barier *= 0.8;
                            continue;
                        }
                        dl.current_detail = prev;
                        cp.remove_detail(dl.work_list[dl.current_detail]);
                        dl.work_list[dl.current_detail].cb += place_count;
                        barier = old_barier;
                        place_count++;
                        was_step_back = true;
                    }
                }
                cp_list.Add(cp);

                if (!dl.check_empty_wl())
                {
                    calc_y();
                }
                //else
            }
        }