Exemplo n.º 1
0
        private async Task SeleccionMenu(IDialogContext context, IAwaitable <string> response)
        {
            var seleccion = await response;
            var reply     = context.MakeMessage();

            if (!seleccion.Equals(MenuInicial[1]))
            {
                await context.PostAsync($"Disculpa, estoy aprendiendo y por el momento no tengo la funcionalidad de {seleccion}.");

                PromptDialog.Choice(context, EndDialog, MenuInicial, "¿Te puedo ayudar en algo más?");
            }
            else
            {
                List <string> recomendacion = new List <string>();
                try
                {
                    using (Recomendador recomendador = new Recomendador())
                    {
                        recomendacion = await recomendador.InvokeRequestResponseService(_calificacion.UserID, _calificacion.MovieID, _calificacion.Rating.ToString());
                    }
                } catch (Exception ex)
                {
                    Debug.WriteLine($"Error: {ex.Message}");
                }
                try
                {
                    if (recomendacion.Count > 1)
                    {
                        await context.PostAsync("Te voy a hacer una oferta que no podrás rechazar.");

                        reply.Attachments.Add(new Microsoft.Bot.Connector.Attachment()
                        {
                            ContentUrl  = "https://media.giphy.com/media/26h0pkvcgnFIpvU1a/giphy.gif",
                            ContentType = "image/gif",
                            Name        = "El Padrino"
                        });
                        await context.PostAsync(reply);

                        reply.AttachmentLayout = AttachmentLayoutTypes.Carousel;
                        reply.Attachments      = await GetCarousel(recomendacion);

                        await context.PostAsync(reply);
                    }
                    else
                    {
                        await context.PostAsync("Mmmm, has visto pocas películas. ¡Te recomiendo ver muchas más!, de esta forma me ayudas a conocerte mejor y poder ofrecerte películas que seguramente te encantarán.");

                        context.Wait(MessageReceivedAsync);
                    }
                } catch (Exception ex)
                {
                    Debug.WriteLine("Error: " + ex.Message);
                }
                MenuInicial.Add("Salir");
                PromptDialog.Choice(context, EndDialog, MenuInicial, "¿Te puedo ayudar en algo más?");
            }
        }
Exemplo n.º 2
0
 public RSVD(Recomendador rEnColdStart = null)
 {
     db        = SVDDB.Instance;
     coldStart = rEnColdStart;
 }
Exemplo n.º 3
0
        private void realizaSimulacion()
        {
            if (simulador != null)
            {
                MessageBox.Show("Actualmente esta corriendo una simulacion");
                return;
            }

            simulador = new Simulador();
            simulador.iniciaModelo();
            Recomendador coldStart = null;

            if (cmbColdStart.Text == "Random")
            {
                coldStart = new RRandom(ListaDeProblemas());
            }
            else if (cmbColdStart.Text == "Experto")
            {
                coldStart = new RExperto();
            }
            Recomendador recomendador = null;

            if (cmbAlgoritmo.Text == "Random")
            {
                //Random
                recomendador = new RRandom(ListaDeProblemas());
            }
            else if (cmbAlgoritmo.Text == "Experto")
            {
                //Experto
                recomendador = new RExperto();
            }
            else if (cmbAlgoritmo.Text == "Inversion")
            {
                //Inversion
                recomendador = new RInversion(rEnColdStart: coldStart);
            }
            else if (cmbAlgoritmo.Text == "Usuario")
            {
                //Usuario
                recomendador = new RUser(rEnColdStart: coldStart);
            }
            else if (cmbAlgoritmo.Text == "Problema")
            {
                //Problema
                recomendador = new RProblema(rEnColdStart: coldStart);
            }
            else if (cmbAlgoritmo.Text == "SVD")
            {
                //SVD
                recomendador = new RSVD(rEnColdStart: coldStart);
            }
            else
            {
                MessageBox.Show("No hay Algoritmo Seleccionado");
                simulador = null;
                return;
            }

            int nUsuarios = int.Parse(txtUsuariosSimulacion.Text);
            int nCiclos   = int.Parse(txtNCiclos.Text);

            simulador.recomendador = recomendador;
            simulador.nUsuarios    = nUsuarios;
            simulador.nCiclos      = nCiclos;

            simulador.aPositiva = actual;

            oThread = new Thread(new ThreadStart(simulador.Simula));
            oThread.Start();
            cont                = 0;
            timer1.Enabled      = true;
            progressBar.Visible = true;
        }
Exemplo n.º 4
0
 public RUser(Recomendador rEnColdStart = null)
 {
     db        = UserDB.Instance;
     coldStart = rEnColdStart;
 }
Exemplo n.º 5
0
 public RProblema(Recomendador rEnColdStart = null)
 {
     db        = ProblemDB.Instance;
     coldStart = rEnColdStart;
 }
Exemplo n.º 6
0
 public RInversion(Recomendador rEnColdStart = null)
 {
     db        = InversionDB.Instance;
     coldStart = rEnColdStart;
 }