Example #1
0
        void MainFormLoad(object sender, EventArgs e)
        {
            tslTiempo.Text = " Ninguna";
            if (!loaded)
            {
                // Definimos los tipos de algoritmos de entrada
                Algoritmo[] algoritmoEntrada = new Algoritmo[5];
                algoritmoEntrada[0] = new Algoritmo("Primero en entrar, primero en salir", 1);
                algoritmoEntrada[1] = new Algoritmo("Turno rotatorio", 2);
                algoritmoEntrada[2] = new Algoritmo("Primero el más corto", 3);
                algoritmoEntrada[3] = new Algoritmo("Menor tiempo restante", 4);
                algoritmoEntrada[4] = new Algoritmo("Mayor tasa de respuesta", 5);
                // Definimos los tipos de algoritmos de salida
                Algoritmo[] algoritmoSalida = new Algoritmo[2];
                algoritmoSalida[0] = new Algoritmo("Primero en entrar, primero en salir", 1);
                algoritmoSalida[1] = new Algoritmo("Usado hace más tiempo", 6);

                // Llenamos los combobox con los valores que correspondan
                cbEntrada.Items.AddRange(algoritmoEntrada);
                cbEntrada.DataSource    = algoritmoEntrada;
                cbEntrada.DisplayMember = "Nombre";
                cbEntrada.ValueMember   = "Valor";
                cbSalida.Items.AddRange(algoritmoSalida);
                cbSalida.DataSource    = algoritmoSalida;
                cbSalida.DisplayMember = "Nombre";
                cbSalida.ValueMember   = "Valor";

                loaded = true;
            }

            lbPQuantum.Text = Quantum.ToString();
            lbTMemoria.Text = mTamano.ToString();
        }
        public ActionResult  GerarRota()
        {
            Algoritmo algoritmo = new Algoritmo();

            algoritmo.VerificarDestino();
            return(RedirectToAction("Index"));
        }
Example #3
0
        private void LoadClassificacao()
        {
            var modelo  = Application.ResultadoXOR.Melhor.W;
            var classes = new List <MVector>(Algoritmo.classesXorSeq);
            var dados   = new List <Algoritmo.Par>(Algoritmo.dadosXorSeq);

            var cores = new Dictionary <MVector, Color>
            {
                { classes[0], Color.Red },
                { classes[1], Color.Blue },
            };

            //Algoritmo.resultado(
            var pixelsFundo = Enumerable
                              .Range(0, 100)
                              .Select(x =>
                                      Enumerable
                                      .Range(0, 100)
                                      .Select(y => new Point(x, y)))
                              .SelectMany(e => e)
                              .ToList();

            CoresFundo = pixelsFundo
                         .Select(p => new PointColor
            {
                Point = p,
                Color = cores.TryGetValue(Algoritmo.resultadoSigmoide(modelo, MVector.Build.Dense(new[] { p.X / 100.0d, p.Y / 100.0d })), out var v) ? v : Color.White
            })
        // GET: Endereco
        public ActionResult Index()
        {
            EnderecoRepository e         = new EnderecoRepository();
            Algoritmo          algoritmo = new Algoritmo();

            algoritmo.VerificarDestino();
            return(View(repository.GetAll()));
        }
Example #5
0
 public void GenerarDigitoVerificador(string Serie, Algoritmo algoritmo)
 {
     if (string.IsNullOrWhiteSpace(Serie))
     {
         throw new Exception(Vacia);
     }
     this._Serie = Serie;
     GenerarDigitoVerificador(algoritmo);
 }
Example #6
0
 private void BtnSolucionar_Click(object sender, EventArgs e)
 {
     progreso.Visible = true;;
     Algoritmo.PrepararSolucion(origen, auxiliar, destino, cmbCantidadDeDiscos.SelectedIndex + 1,
                                lblMovimientosDelJugador, progreso);
     solucion = new Thread(Algoritmo.Solucionar);
     solucion.Start();
     btnReiniciar.Enabled  = true;
     btnSolucionar.Enabled = false;
     btnPlay.Visible       = true;
     btnAcelerar.Visible   = true;
 }
Example #7
0
        private void bt_tratamiento_Click(object sender, EventArgs e)
        {
            Algoritmo alg = new Algoritmo();
            Bitmap    bit = new Bitmap(pictureBox_Color.Image);

            this.pictureBox_Gris.SizeMode = PictureBoxSizeMode.StretchImage;
            pictureBox_Gris.Image         = alg.EscalaDeGrises(bit, 60);
            list_proceso.Items.Add(" - Escala de Grises");
            BitImg = alg.Binarizacion(bit, 60, list_binarizacion);
            list_proceso.Items.Add(" - Binarización de la imagen cargada");
            bt_Alg_Evo.Enabled = true;
        }
Example #8
0
        static void Main()
        {
#if !DISABLE_XOR
            Application.ResultadoXOR = Algoritmo.algoritmoXor();
            Console.WriteLine(Application.ResultadoXOR);
#endif
            Application.ResultadoRegressao = Algoritmo.algoritmoRegressao();
            Console.WriteLine(Application.ResultadoRegressao);

            using (var game = new Game1())
                game.Run();
        }
Example #9
0
 public void GenerarDigitoVerificador(Algoritmo algoritmo)
 {
     if (string.IsNullOrWhiteSpace(Serie))
     {
         throw new Exception(Vacia);
     }
     else if (algoritmo == Algoritmo.Modulo10)
     {
         GenerarDigitoVerificadorM10();
     }
     else
     {
         GenerarDigitoVerificadorM11();
     }
 }
Example #10
0
        public FormShakespeare(FormHome formHome)
        {
            this.formHome = formHome;
            InitializeComponent();
            progressBar1.Minimum = 0;
            progressBar1.Maximum = 100;
            textBox1.Text        = "Insira sua frase aqui!";
            textBox2.Text        = "200";
            textBox3.Text        = "5";
            textBox4.Text        = "1";

            random         = new System.Random();
            populacaoTexto = new Populacao();
            ag             = new Algoritmo(populacaoTexto, random);
        }
Example #11
0
 public bool ValidarDigitoVerificador(int codigoverificador, Algoritmo algoritmo)
 {
     if (string.IsNullOrWhiteSpace(_Serie))
     {
         throw new Exception(Vacia);
     }
     else
     {
         if (algoritmo == Algoritmo.Modulo10)
         {
             GenerarDigitoVerificadorM10();
         }
         else
         {
             GenerarDigitoVerificadorM11();
         }
         return(int.Equals(this.DigitoVerificador, codigoverificador));
     }
 }
 /// <summary>
 /// Guarda las estadisticas de tiempo de ejecucion de los algoritmos
 /// </summary>
 /// <param name="id_algoritmo">Id del algoritmo que se ejecuto</param>
 /// <param name="id_rango">cantidad de registros que seleyeron</param>
 /// <param name="tiempo_real_cpu">Tiempo en segundos que tardo en ejecutarce el algoritmo</param>
 /// <param name="tiempo_cpu">Tiempo de CPU que gasto el algoritmo en su ejecucion</param>
 /// <param name="tiempo_e_s">Tiempo de escritura y lectura del disco duro</param>
 /// <param name="porcentaje_cpu_wall">Tiempo de CPU del algoritmo en ejecucion divido entre 100</param>
 public static void insertarRegistros(Algoritmo idAlgoritmo, int id_rango, double tiempo_real_cpu, double tiempo_cpu, double tiempo_e_s, double porcentaje_cpu_wall)
 {
     try
     {
         Conexion c = new Conexion();
         c.NombreStoredProcedure = "sp_insertRegistro";
         c.AddLista("@id_algoritmo", (int)idAlgoritmo);
         c.AddLista("@id_rango", id_rango);
         c.AddLista("@tiempo_cpu_real", tiempo_real_cpu);
         c.AddLista("@tiempo_cpu", tiempo_cpu);
         c.AddLista("@tiempo_e_s", tiempo_e_s);
         c.AddLista("@porcentaje_cpu_wall", porcentaje_cpu_wall);
         c.ejecutarStoredProcedure();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #13
0
        private void LoadRegressao()
        {
            var w = Application.ResultadoRegressao.Melhor.W;

            PontosRegressao = Enumerable
                              .Range(0, 100)
                              .Select(n => new PointColor
            {
                Point = new Point(n, (int)(Algoritmo.resultadoLinear(w, MVector.Build.Dense(new[] { n / 100.0 }))[0] * 10)),
                Color = Color.Red
            });

            PontosFuncao = Enumerable
                           .Range(0, 100)
                           .Select(n => new PointColor
            {
                Point = new Point(n, (int)(Algoritmo.funcaoRegessao(n / 10.0) * 10)),
                Color = Color.Blue
            });
        }
Example #14
0
        static void Main(string[] args)
        {
            inicializaConeccion();
            TimeSpan       stop;
            TimeSpan       start = new TimeSpan(DateTime.Now.Ticks);
            Algoritmo      alg;
            ChecaEmpalmes  emp;
            PreAsignacion  pre;
            ListaVariables grupos  = new ListaVariables(c.Grupos("2016-2017/II"));
            ListaSalones   salones = new ListaSalones(c, c.Salones());
            ListaVariables gruposActuales;

            for (int i = 7; i < 22; i++)
            {
                gruposActuales = new ListaVariables(grupos.EnHoras(i, i + 1));

                emp = new ChecaEmpalmes(grupos, salones);
                emp.ejecuta();
                grupos.Actualiza(emp.Grupos);

                pre = new PreAsignacion(grupos, salones);
                pre.preferencial();
                pre.semestres_anteriores();
                grupos.Actualiza(pre.Grupos);

                alg = new Algoritmo(grupos, salones, i, 5, 50);
                alg.AsignaSalones();
                grupos.Actualiza(alg.GruposAsignados);

                c.Grupos_Carga(gruposActuales);
            }
            stop = new TimeSpan(DateTime.Now.Ticks);
            Console.Write("***Pulsa una tecla para continuar****\n");
            Console.WriteLine("Tiempo del proceso: " + (stop.Subtract(start).TotalMilliseconds / 1000) + " segundos");

            while (Console.ReadKey().Key != ConsoleKey.Enter)
            {
                ;
            }
        }
        public ActionResult Index(CentroPobladoViewModel model)
        {
            var vm = new CentroPobladoViewModel();
            TPComplejidadEntities BD = new TPComplejidadEntities();

            vm.tipo = model.tipo;

            try
            {
                var       lstCentroPoblado = BD.Centro_Poblado.Where(x => x.CAPITAL == model.tipo).ToList();
                Algoritmo alg = new Algoritmo(lstCentroPoblado);
                alg.RutaOptima();
                var lstIndices = alg.DevolverRutaOptima();

                vm.Fill(BD, lstIndices, lstCentroPoblado);
            }
            catch (Exception ex)
            {
            }

            return(View(vm));
        }
Example #16
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            spriteBatch.Begin();

            //spriteBatch.Draw()
            // TODO: Add your drawing code here
            int w = GraphicsDevice.Viewport.Width, h = GraphicsDevice.Viewport.Height;
            int y0 = (int)(h * margem), yn = h - y0;

            int tamanhoEfetivo = Math.Abs(y0 - yn);

            float escala = tamanhoEfetivo / tamanho;

            int x0 = w / 2 - tamanhoEfetivo / 2, xn = x0 + tamanhoEfetivo;

            int espacamento = tamanhoEfetivo / tamanho;

            spriteBatch.Draw(tex, new Rectangle(x0, y0, tamanhoEfetivo, tamanhoEfetivo), Color.White);

            for (int x = x0; x < xn; x += espacamento)
            {
                spriteBatch.Draw(tex, new Rectangle(x, y0, tamanhoEfetivo, 1), null, Color.LightGray, MathHelper.Pi / 2, Vector2.Zero, SpriteEffects.None, 1.0f);
            }

            for (int y = y0; y < yn; y += espacamento)
            {
                spriteBatch.Draw(tex, new Rectangle(x0, y, tamanhoEfetivo, 1), null, Color.Gray, 0f, Vector2.Zero, SpriteEffects.None, 1.0f);
            }

            for (int x = 0; x < tamanhoEfetivo; x++)
            {
                for (int y = 0; y < tamanhoEfetivo; y++)
                {
                    var vx = Algoritmo.matrizLinha(new[] { 1.0, x / escala, y / escala });
                    var vy = Algoritmo.saida(realizacao.W, vx);

                    if (cores.ContainsKey(vy))
                    {
                        var cor = new Color(cores[vy], 0.2f);

                        spriteBatch.Draw(tex, new Rectangle(x0 + x, y0 + y, 1, 1), cor);
                    }
                }
            }

            foreach (var dado in Algoritmo.algoritmoCustom.Dados)
            {
                var row = dado.X.Row(0);
                int x = (int)(row[1] * escala), y = (int)(row[2] * escala);
                var rect   = new Rectangle(x + x0 - 3, y + y0 - 3, 7, 7);
                var border = new Rectangle(rect.X - 1, rect.Y - 1, rect.Width + 2, rect.Height + 2);

                var cor = new Color(cores[dado.Y], 0.8f);

                spriteBatch.Draw(tex, border, Color.Black);
                spriteBatch.Draw(tex, rect, cor);
            }

            spriteBatch.End();

            base.Draw(gameTime);
        }
Example #17
0
 private void BtnAcelerar_Click(object sender, EventArgs e)
 {
     Algoritmo.Acelerar();
 }