Ejemplo n.º 1
0
        public void Draw123()
        {
            //DanePlik temp = danePliks[0];
            int t_czas;

            int[,] temp_czasy;
            string numery  = string.Empty;
            string numery1 = string.Empty;

            xd.Text    = "0";
            temp_czasy = null;
            switch (co)
            {
            case 0:
            {
                temp_czasy = (temp.czasy);
                xd.Text    = temp.Czas(temp.czasy).ToString();


                break;
            }

            case 1:
            {
                /*
                 *
                 */
                double x = 1000.00;

                //temp_czasy =( temp.Annealing(x));
                temp_czasy = temp.AnnealingTakingList(x, temp.NehReturningList());

                numery  = temp.bestOptA;
                numery1 = temp.bestOptA1;

                xd.Text   = temp.Czas(temp_czasy).ToString();
                kupa.Text = numery1;
                break;
            }

            case 2:
            {
                temp_czasy = (temp.prez_wy);
                numery     = temp.bestOpt;
                xd.Text    = temp.Czas(temp_czasy).ToString();

                break;
            }

            case 3:
            {
                temp_czasy = (temp.JohnsonNaSztywno());
                numery     = temp.bestOptJ;
                numery1    = temp.bestOptJ1;
                xd.Text    = temp.Czas(temp_czasy).ToString();
                kupa.Text  = numery1;

                break;
            }

            case 4:
            {
                temp_czasy = temp.Neh();

                numery = temp.bestOptJ;

                numery1 = temp.bestOptN1;

                xd.Text   = temp.Czas(temp_czasy).ToString();
                kupa.Text = numery1;


                break;
            }

            case 5:
            {
                temp_czasy = temp.Schrage();
                xd.Text    = "Schrage: " + temp.ShrageCmax(temp_czasy).ToString() + "\nSchragePtmn: " + temp.SchragePtmn().ToString();
                //xd.Text =
                //kupa.Text = numery1;
                break;
            }

            case 6:
            {
                temp_czasy = (temp.czasy);
                Obiekt obiekt = new Obiekt();
                obiekt.orderFromSchrage = temp.czasy;
                xd.Text = "Calier: " + temp.Calier(obiekt).ToString();

                break;
            }

            default:
            {
                temp_czasy = (temp.czasy);
                xd.Text    = temp.Czas(temp.czasy).ToString();
                break;
            }
            }



            int[] t_zwolnienia = new int[temp.maszyny];
            byte  r, g, b;

            Array.Clear(t_zwolnienia, 0, t_zwolnienia.Length);

            Random rnd = new Random();


            for (int z = 0; z < temp.zadania; z++)
            {
                t_czas = 0;
                int    mv = 0;
                string numer;
                if (numery != string.Empty)
                {
                    numer = (numery[z] - 48).ToString();
                }
                else
                {
                    numer = (z + 1).ToString();
                }


                r = (byte)rnd.Next(255);
                g = (byte)rnd.Next(255);
                b = (byte)rnd.Next(255);



                for (int i = 0; i < temp.maszyny; i++)
                {
                    t_czas = temp_czasy[z, i];

                    int t_czas2 = t_czas * sekunda;

                    Rectangle rec = new Rectangle()
                    {
                        Width  = t_czas2,
                        Height = 40,
                        Fill   = new SolidColorBrush(Color.FromRgb(r, g, b)),
                        Stroke = Brushes.Black,
                    };


                    canvas.Children.Add(rec);
                    Canvas.SetTop(rec, 20 + mv);
                    if (i == 0)
                    {
                        Canvas.SetLeft(rec, sekunda + t_zwolnienia[i]);
                    }
                    else
                    {
                        if (t_zwolnienia[i] >= t_zwolnienia[i - 1])
                        {
                            Canvas.SetLeft(rec, sekunda + t_zwolnienia[i]);
                        }
                        else
                        {
                            Canvas.SetLeft(rec, sekunda + t_zwolnienia[i - 1]);
                        }
                    }



                    Label lab = new Label()
                    {
                        Content = numer,

                        FontSize   = 20,
                        Foreground = new SolidColorBrush(Color.FromRgb((byte)(255 - r), (byte)(255 - g), (byte)(255 - b))),
                    };
                    canvas.Children.Add(lab);
                    Canvas.SetTop(lab, 10 + mv);
                    if (i == 0)
                    {
                        Canvas.SetLeft(lab, sekunda / 2 + t_czas2 / 2 + t_zwolnienia[i]);
                    }
                    else
                    {
                        if (t_zwolnienia[i] >= t_zwolnienia[i - 1])
                        {
                            Canvas.SetLeft(lab, sekunda / 2 + t_czas2 / 2 + t_zwolnienia[i]);
                        }
                        else
                        {
                            Canvas.SetLeft(lab, sekunda / 2 + t_czas2 / 2 + t_zwolnienia[i - 1]);
                        }
                    }


                    if (i == 0)
                    {
                        t_zwolnienia[i] += t_czas2;
                    }
                    else
                    {
                        if (t_zwolnienia[i] >= t_zwolnienia[i - 1])
                        {
                            t_zwolnienia[i] += (t_czas2);
                        }
                        else
                        {
                            t_zwolnienia[i] = t_zwolnienia[i - 1] + (t_czas2);
                        }
                    }


                    mv += 60;
                }
            }
            //xd.Text = (t_zwolnienia[temp.maszyny - 1]/sekunda).ToString();
        }
Ejemplo n.º 2
0
        public void Draw123()
        {
            //DanePlik temp = danePliks[0];
            int t_czas;

            int[,] temp_czasy;
            string numery = string.Empty;

            switch (co)
            {
            case 0:
            {
                temp_czasy = (temp.czasy);
                xd.Text    = temp.Czas(temp.czasy).ToString();
                break;
            }

            case 1:
            {
                temp_czasy = temp.Neh();
                //temp_czasy = (temp.JohnsonNaSztywno());
                // numery = temp.bestOptJ;
                numery = temp.bestOptJ;
                //xd.Text = temp.Czas(temp.JohnsonNaSztywno()).ToString();
                xd.Text = temp.Czas(temp.Neh()).ToString();
                //  kupa.Text += temp.permutacje[i] + " : " + temp.czasy_permutacje[i].ToString() + " \n";
                break;
            }

            case 2:
            {
                temp_czasy = (temp.prez_wy);
                numery     = temp.bestOpt;
                xd.Text    = temp.Czas(temp.prez_wy).ToString();
                break;
            }

            default:
            {
                temp_czasy = (temp.czasy);
                xd.Text    = temp.Czas(temp.czasy).ToString();
                break;
            }
            }



            int[] t_zwolnienia = new int[temp.maszyny];
            byte  r, g, b;

            Array.Clear(t_zwolnienia, 0, t_zwolnienia.Length);

            Random rnd = new Random();


            for (int z = 0; z < temp.zadania; z++)
            {
                t_czas = 0;
                int    mv = 0;
                string numer;
                if (numery != string.Empty)
                {
                    numer = (numery[z] - 48).ToString();
                }
                else
                {
                    numer = (z + 1).ToString();
                }


                r = (byte)rnd.Next(255);
                g = (byte)rnd.Next(255);
                b = (byte)rnd.Next(255);



                for (int i = 0; i < temp.maszyny; i++)
                {
                    t_czas = temp_czasy[z, i];

                    int t_czas2 = t_czas * sekunda;

                    Rectangle rec = new Rectangle()
                    {
                        Width  = t_czas2,
                        Height = 40,
                        Fill   = new SolidColorBrush(Color.FromRgb(r, g, b)),
                        Stroke = Brushes.Black,
                    };


                    canvas.Children.Add(rec);
                    Canvas.SetTop(rec, 20 + mv);
                    if (i == 0)
                    {
                        Canvas.SetLeft(rec, sekunda + t_zwolnienia[i]);
                    }
                    else
                    {
                        if (t_zwolnienia[i] >= t_zwolnienia[i - 1])
                        {
                            Canvas.SetLeft(rec, sekunda + t_zwolnienia[i]);
                        }
                        else
                        {
                            Canvas.SetLeft(rec, sekunda + t_zwolnienia[i - 1]);
                        }
                    }



                    Label lab = new Label()
                    {
                        Content = numer,

                        FontSize   = 20,
                        Foreground = new SolidColorBrush(Color.FromRgb((byte)(255 - r), (byte)(255 - g), (byte)(255 - b))),
                    };
                    canvas.Children.Add(lab);
                    Canvas.SetTop(lab, 10 + mv);
                    if (i == 0)
                    {
                        Canvas.SetLeft(lab, sekunda / 2 + t_czas2 / 2 + t_zwolnienia[i]);
                    }
                    else
                    {
                        if (t_zwolnienia[i] >= t_zwolnienia[i - 1])
                        {
                            Canvas.SetLeft(lab, sekunda / 2 + t_czas2 / 2 + t_zwolnienia[i]);
                        }
                        else
                        {
                            Canvas.SetLeft(lab, sekunda / 2 + t_czas2 / 2 + t_zwolnienia[i - 1]);
                        }
                    }


                    if (i == 0)
                    {
                        t_zwolnienia[i] += t_czas2;
                    }
                    else
                    {
                        if (t_zwolnienia[i] >= t_zwolnienia[i - 1])
                        {
                            t_zwolnienia[i] += (t_czas2);
                        }
                        else
                        {
                            t_zwolnienia[i] = t_zwolnienia[i - 1] + (t_czas2);
                        }
                    }


                    mv += 60;
                }
            }
            //xd.Text = (t_zwolnienia[temp.maszyny - 1]/sekunda).ToString();
        }