Exemple #1
0
        public void PelletPredict2()
        {
            PelletServer server  = new PelletServer(PelletTestServer);
            Type         svcType = typeof(PredictService);

            foreach (KnowledgeBase kb in server.KnowledgeBases)
            {
                if (kb.SupportsService(svcType))
                {
                    Console.WriteLine(kb.Name + " supports Prediction");
                    PredictService svc = (PredictService)kb.GetService(svcType);

                    List <INode> predictions = svc.Predict("wine:DAnjou", "wine:locatedIn");
                    Console.WriteLine(predictions.Count + " Predictions");
                    foreach (INode obj in predictions)
                    {
                        Console.WriteLine(obj.ToString());
                    }
                }
                else
                {
                    Console.WriteLine(kb.Name + " does not support the Prediction Service");
                }
                Console.WriteLine();
            }
        }
        // Request a Batch Prediction from Azure
        protected void BatchPredictBtn_Click(object sender, EventArgs e)
        {
            int batchId = Int32.Parse(Security.GetQueryString());

            if (PredictService.Batch(batchId))
            {
                Response.Redirect("Default.aspx?message=BatchPredictionSuccess");
            }
            else
            {
                Response.Redirect("BatchDetail.aspx?id=" + batchId + "&message=BatchPredictionError");
            }
        }
        // Predict the remaining lifetime for a Battery in the gridview
        protected void PredictLB_Command(object sender, CommandEventArgs e)
        {
            int batchId = Int32.Parse(Security.GetQueryString());

            // Get batteryId
            int batteryId = 0;

            try
            {
                batteryId = Int32.Parse(e.CommandArgument.ToString());
            }
            catch
            {
                Response.Redirect("BatchDetail.aspx?id=" + batchId + "&message=IdError");
            }

            // Get prediction
            double prediction = 0;

            try
            {
                prediction = Double.Parse(PredictService.Single(batteryId).ToString());
            }
            catch
            {
                Response.Redirect("BatchDetail.aspx?id=" + batchId + "&message=PredictionError");
            }

            // Update battery in database
            BatteryDto battery = BatteryService.GetBattery(batteryId);

            battery.Lifetime = prediction;

            if (BatteryService.UpdateBattery(battery))
            {
                Response.Redirect("BatchDetail.aspx?id=" + batchId + "&message=PredictionSuccess");
            }
            else
            {
                Response.Redirect("BatchDetail.aspx?id=" + batchId + "&message=UpdateError");
            }
        }
Exemple #4
0
        public void PelletPredict()
        {
            PelletServer server  = new PelletServer(PelletTestServer);
            Type         svcType = typeof(PredictService);

            foreach (KnowledgeBase kb in server.KnowledgeBases)
            {
                if (kb.SupportsService(svcType))
                {
                    Console.WriteLine(kb.Name + " supports Prediction");
                    PredictService svc = (PredictService)kb.GetService(svcType);

                    IGraph g = svc.PredictRaw("wine:DAnjou", "wine:locatedIn");
                    TestTools.ShowGraph(g);
                }
                else
                {
                    Console.WriteLine(kb.Name + " does not support the Prediction Service");
                }
                Console.WriteLine();
            }
        }
Exemple #5
0
        static void Main(string[] args)
        {
            do
            {
                //defined variables
                LicensePlateEntitie licensePlate = new LicensePlateEntitie();

                //head of program
                Console.WriteLine("Consultor de Pico y Placa");
                Console.WriteLine("Por favor ingrese los datos a continuación");

                //principal form
                Console.WriteLine("Placa: ");
                licensePlate.LicensePlateNumber = Console.ReadLine();
                Console.WriteLine("Fecha de salida (dd/mm/yyyy) : ");
                var dateGoOutString = Console.ReadLine();
                licensePlate.DateGoOut = Convert.ToDateTime(dateGoOutString.ToString());

                //result
                var havePicoYPlaca = PredictService.ProcessPicoYPlaca(licensePlate);
                if (havePicoYPlaca)
                {
                    Console.WriteLine("El automóvil con placa " + licensePlate.LicensePlateNumber + " tiene pico y placa la fecha " + dateGoOutString);
                }
                else
                {
                    Console.WriteLine("El automóvil con placa " + licensePlate.LicensePlateNumber + " esta autorizado para circular la fecha " + dateGoOutString);
                }


                Console.WriteLine("Para salir del programa presione Y, caso contrario presione cualquier tecla");
                var endApp = Console.ReadLine();
                if (endApp.ToUpper().Equals("Y"))
                {
                    break;
                }
            } while (true);
        }