コード例 #1
0
 public ClassPasajero(string nombres, string apellidos, int edad, int asiento, ClassVuelo vueloDelPasajero)
 {
     this.nombres          = nombres;
     this.apellidos        = apellidos;
     this.edad             = edad;
     this.asiento          = asiento;
     this.vueloDelPasajero = vueloDelPasajero;
 }
コード例 #2
0
        public FormGraficoDelAvion(ClassVuelo vuelo)
        {
            aSeleccionado = 0;
            this.vuelo    = vuelo;

            InitializeComponent();
            InicializaAsiento();
            labelVuelo.Text += vuelo.getRuta();
        }
コード例 #3
0
        public FormRegistoPasajero(ClassVuelo vuelo, int asiento)
        {
            this.asiento = asiento;
            this.vuelo   = vuelo;


            InitializeComponent();
            InicializaTextos();

            bandera = false;



            //textBoxAsiento.Text =                   //NUMERO DE ASIENTO SELECCIONADO
        }
コード例 #4
0
ファイル: FormGrafo.cs プロジェクト: OBaruch/Al-Qaeda-Fying
        private void buttonTiemposPrim_Click(object sender, EventArgs e)
        {
            panel1.Refresh();
            listBoxRutasOptimas.Items.Clear();
            listBoxTOTAL.Items.Clear();
            listBoxCostos.Items.Clear();
            ////////////////////////////
            //Comprobar que el grafo sea conexo


            //Crear un grafo igual al oficial PARA TRABJAR CON EL Y PODERLO MODIFICAR
            Grafo grafoDirigidoP = new Grafo(lv);


            ListaAristas ARM        = new ListaAristas(); //ARM
            ListaVuelos  listaPrim  = new ListaVuelos();  //Lista de vuelos igual  ARM para grafo
            ListaAristas candidatos = new ListaAristas();

            foreach (Nodo n in grafoDirigidoP.getListaNodos())
            {
                foreach (Ady a in n.getListaAdyacencia())
                {
                    Arista arist = new Arista(n, a.getNodo(), a.getPonderacionCosto(), a.getPonderacionTiempo());
                    candidatos.Add(arist);
                }
            }
            candidatos.quicksortTiempo(candidatos, 0, candidatos.Count - 1);

            //INICILAIZA LISTA DE NODOS
            List <Nodo> S = new List <Nodo>();

            ////Seleccionar un origen y agregarlo s

            foreach (Nodo n in grafoDirigidoP.getListaNodos())
            {
                if (n.getCiudad().getNom() == (string)listBoxSeleccionaCiudad.SelectedItem)
                {
                    S.Add(n);
                    break;
                }
            }



            //Algoritmo
            while (ARM.Count < grafoDirigidoP.getListaNodos().Count() - 1)
            {
                Arista ar = candidatos.seleccionFactibel(candidatos, S);

                ARM.Add(ar);
                if (S.Contains(ar.getNodoOrigen()))
                {
                    S.Add(ar.getNodoDestinon());
                }
                else
                {
                    S.Add(ar.getNodoOrigen());
                }
            }

            //llenar lista de vuelos priam en base a las lista optenida de aristas del ARM para construir grafo(ARM)

            foreach (Arista a in ARM)
            {
                ClassVuelo v = new ClassVuelo(a.getNodoOrigen().getCiudad().getNom(), a.getNodoDestinon().getCiudad().getNom(), a.getPonderacionCosto(), a.getPonderacionTimepo());
                listaPrim.Add(v);
            }

            Grafo ARMG = new Grafo(listaPrim);

            //establecer coordeadas
            foreach (Nodo n in ARMG.getListaNodos())
            {
                foreach (Nodo n2 in g.getListaNodos())
                {
                    if (n.getCiudad().getNom() == n2.getCiudad().getNom())
                    {
                        n.getCiudad().setX(n2.getCiudad().getX());
                        n.getCiudad().setY(n2.getCiudad().getY());
                    }
                }
            }

            //LLENAR LISTAS DE TIEMPO Y TOTAL
            int suma = 0;

            foreach (ClassVuelo vs in listaPrim)
            {
                listBoxRutasOptimas.Items.Add(vs.getRuta());
            }
            foreach (ClassVuelo vs in listaPrim)
            {
                listBoxCostos.Items.Add(vs.getTiempo() + " Min");
                suma += vs.getTiempo();
            }

            listBoxTOTAL.Items.Add(suma + " Min");


            //DIBUJAR ADYACENCIAS Y NODOS

            DibujarAdyacencias(2, ARMG);
            // DibujarNodos(2, ARM);

            DibujarAdyacencias(1, g);
            DibujarNodos(1, g);
        }
コード例 #5
0
ファイル: FormGrafo.cs プロジェクト: OBaruch/Al-Qaeda-Fying
        private void buttonCostosKruskal_Click(object sender, EventArgs e)
        {
            panel1.Refresh();
            listBoxRutasOptimas.Items.Clear();
            listBoxTOTAL.Items.Clear();
            listBoxCostos.Items.Clear();
            buttonTiemposPrim.Enabled = false;
            listBoxSeleccionaCiudad.ClearSelected();

            ListaVuelos listaKruskal = new ListaVuelos();

            //Crear un grafo igual al anterior
            Grafo grafoDirigido = new Grafo(lv);

            grafoDirigido = g;

            //Conbertir el grafo en NO dirigido (NO NESESARIO)

            //Crear lista de Prioridad(Aristas)
            ListaAristas candidatos = new ListaAristas();


            foreach (Nodo n in grafoDirigido.getListaNodos())
            {
                foreach (Ady nA in n.getListaAdyacencia())
                {
                    Arista arista = new Arista(n, nA.getNodo(), nA.getPonderacionCosto(), nA.getPonderacionTiempo());
                    candidatos.Add(arista);
                }
            }


            //Ordenar candidatos de menor a mayor
            ListaAristas CandidatosOrdenados = new ListaAristas();

            CandidatosOrdenados = candidatos.quicksortCosto(candidatos, 0, candidatos.Count() - 1);



            //CREAR COMPONENTES CONEXSOS
            List <List <string> > CC = new List <List <string> >();

            for (int w = 0; w < g.getListaNodos().Count(); w++)
            {
                List <string> P = new List <string>();
                CC.Add(P);

                CC[w].Add(g.getListaNodos()[w].getCiudad().getNom());
            }



            //ALGROTIMO KRUSKAL

            for (int z = 0; z < CandidatosOrdenados.Count(); z++)
            {
                Arista V = CandidatosOrdenados[z];

                while (CC.Count() > 1)
                {
                    //BUSCA EN QUE CADENA SE ENCUENTRA EL ORIGEN
                    int i;
                    int j;

                    for (i = 0; i < CC.Count(); i++)
                    {
                        for (j = 0; j < CC[i].Count(); j++)
                        {
                            if (V.getNodoOrigen().getCiudad().getNom() == CC[i][j])
                            {
                                u1 = i;
                                goto End1;
                            }
                        }
                    }
End1:

                    //BUSCA EN QUE CADENA SE ENCUENTRA EL DESTINO
                    int q = 0;
                    int j2;

                    while (q < CC.Count())
                    {
                        for (j2 = 0; j2 < CC[q].Count(); j2++)
                        {
                            if (V.getNodoDestinon().getCiudad().getNom() == CC[q][j2])
                            {
                                u2 = q;

                                goto End;
                            }
                        }
                        q++;
                    }
End:



                    if (u1 != u2)
                    {
                        for (int o = 0; o < CC[u2].Count(); o++)
                        {
                            CC[u1].Add(CC[u2][o]);
                        }

                        CC.Remove(CC[u2]);

                        ClassVuelo vue = new ClassVuelo(V.getNodoOrigen().getCiudad().getNom(), V.getNodoDestinon().getCiudad().getNom(), V.getPonderacionCosto(), V.getPonderacionTimepo());
                        listaKruskal.Add(vue);
                    }



                    break;
                }
            }
            Grafo ARM = new Grafo(listaKruskal);

            //ESTALECERLE LAS CORDENADAS AL ARM
            for (int a = 0; a < g.getListaNodos().Count(); a++)
            {
                for (int k = 0; k < ARM.getListaNodos().Count(); k++)
                {
                    if (ARM.getListaNodos()[k].getCiudad().getNom() == g.getListaNodos()[a].getCiudad().getNom())
                    {
                        ARM.getListaNodos()[k].getCiudad().setX(g.getListaNodos()[a].getCiudad().getX());
                        ARM.getListaNodos()[k].getCiudad().setY(g.getListaNodos()[a].getCiudad().getY());
                    }
                }
            }


            int suma = 0;

            foreach (ClassVuelo vs in listaKruskal)
            {
                listBoxRutasOptimas.Items.Add(vs.getRuta());
            }
            foreach (ClassVuelo vs in listaKruskal)
            {
                listBoxCostos.Items.Add("$ " + vs.getCosto());
                suma += vs.getCosto();
            }

            listBoxTOTAL.Items.Add("$ " + suma);



            DibujarAdyacencias(2, ARM);
            // DibujarNodos(2, ARM);

            DibujarAdyacencias(1, g);
            DibujarNodos(1, g);
        }