示例#1
0
        private void InsertEstimate(Estimate estimate)
        {
            var estimates = new Estimates();

            estimates.EstimateList.Add(estimate);
            _cacheManager.Add(estimate.ProjectId, estimates);
        }
        private KeyPerformanceIndicator(int franchiseId, Job[] jobs, JobTask[] tasks)
        {
            FranchiseId = franchiseId;
            Jobs        = jobs;
            Tasks       = tasks;

            InconsistentRecords = Jobs.Where(j => !Estimates.Any(e => e.Id == j.Id) && !CompletedJobs.Any(c => c.Id == j.Id) && !RecallJobs.Any(r => r.Id == j.Id)).ToArray();
        }
        internal KeyPerformanceIndicator(int franchiseId, vRpt_Job[] jobs, vRpt_JobDetail[] tasks)
        {
            FranchiseId = franchiseId;
            Jobs        = jobs.Select(Job.MapFromModel).ToArray();
            Tasks       = tasks.Select(JobTask.MapFromModel).ToArray();

            InconsistentRecords = Jobs.Where(j => !Estimates.Any(e => e.Id == j.Id) && !CompletedJobs.Any(c => c.Id == j.Id) && !RecallJobs.Any(r => r.Id == j.Id)).ToArray();
        }
示例#4
0
        private void RegisterEstimate(object sender, EstimatedArgs args)
        {
            if (AllParticipantsHaveEstimated)
                throw new CannotEstimateWhenAllEstimatesAreGivenException();

            _estimates = _estimates.Register(args.Estimate);
            
            if (AllParticipantsHaveEstimated)
                Completed(this, new RoundCompletedArgs(Status));
        }
        public SearchSaleOrder(UserControlSalesOrder window)
        {
            InitializeComponent();

            dao         = new SaleOrders();
            dao2        = new Estimates();
            dao3        = new Services();
            this.window = window;
            RefreshGrid();
        }
 public UserControlSalesOrder()
 {
     InitializeComponent();
     aux         = null;
     dao         = new SaleOrders();
     dao2        = new Estimates();
     dao3        = new Services();
     logs        = new Logs();
     _employe    = new Employe();
     _employe.id = MainWindow.currentId;
 }
示例#7
0
        public UserControlEstimate()
        {
            // Inicializando componentes
            InitializeComponent();

            // Inicializando path's
            imgDirectoryPath = "C:\\ProERP\\Config\\Internal-Data\\";
            logoPath         = string.Empty;

            // Inicializando objetos
            aux         = null;
            dao         = new Estimates();
            services    = new Services();
            logs        = new Logs();
            _employe    = new Employe();
            _employe.id = MainWindow.currentId;
        }
示例#8
0
        private void Run()
        {
            List <(double, double)> spoints = Measurements.Select(_ => ((double)(_.Key - odt).TotalSeconds, _.Value)).ToList();

            var outgps = gpmm.AddTrainingPoints(spoints.Select(_ => _.Item1).ToArray(), spoints.Select(_ => _.Item2).ToArray());

            var xx = outgps.Select(_ => _.mu
                                   .Zip(_.sd95, (a, b) => new { Mu = a, Sigma = b })
                                   .Zip(_.X, (c, d) =>
                                        new Estimate(odt + TimeSpan.FromSeconds(d), c.Mu, c.Sigma)));

            Estimates.Clear();
            foreach (var __ in xx)
            {
                foreach (var ___ in __)
                {
                    Estimates.Add(___);
                }
            }
        }
示例#9
0
        public void Run()
        {
            var filter = new UKF(1, 1);

            n = 1;
            q = 0.05;
            r = 0.3;
            N = 100;

            Q = Matrix.Build.Diagonal(n, n, q * q); //covariance of process
            NotifyChanged("Q");
            R = Matrix.Build.Dense(1, 1, r * r);    //covariance of measurement
            f = new FEquation();                    //nonlinear state equations
            h = new HEquation();                    //measurement equation
            x = q * Matrix.Build.Random(1, 1);      //s + q * Matrix.Build.Random(1, 1); //initial state with noise
            P = Matrix.Build.Diagonal(n, n, 1);     //initial state covariance


            var xV = Matrix.Build.Dense(n, N, 0); //Estimate
            var zV = Matrix.Build.Dense(1, N, 0); //measurement


            for (int k = 1; k < N; k++)
            {
                Matrix <double> z = ProcessBuilder.SineWave(k, r);
                //measurments

                Matrix <double>[] x_and_P = filter.Update(f, x, P, h, z, Q, R);                //ukf
                x = x_and_P[0];
                P = x_and_P[1];

                Measurements.Add(new Measurement()
                {
                    Value = z[0, 0], Time = TimeSpan.FromSeconds(k)
                });
                Estimates.Add(new Measurement()
                {
                    Value = x_and_P[0][0, 0], Time = TimeSpan.FromSeconds(k), Variance = x_and_P[1][0, 0]
                });
            }
        }
示例#10
0
        public override IDistribution Fit(string variableName)
        {
            /* **** */

            orderedExpertNames = new string[Experts.Count()];
            int j = 0;

            foreach (var e in Experts)
            {
                orderedExpertNames [j] = e.Name;
                j++;
            }

            /* ---- */

            Buildz();
            BuildZ();
            BuildS();
            BuildPr();

            /* **** */

            var variable = Variables.Single(x => x.Name == variableName);

            var bounds = GetBounds(variable);
            var min    = bounds.Item1;
            var max    = bounds.Item2;

            var xx = Estimates.Get(variable);
            // var xx = expertEstimates.SelectMany(t => t);

            var xlist = new List <double> (xx);

            xlist.Add(min);
            xlist.Add(max);
            xlist.Sort();

            var probabilities = new double[xlist.Count - 1];

            for (int i = 0; i < xlist.Count - 1; i++)
            {
                var v = xlist[i];
                probabilities[i] = 1;
                var h = 0;

                // for getting the correct h, we need to compute it in the opposite
                // direction; as h = ((...) * (m + 1) + j ) * (m + 1) + k for [...,j,k]
                for (int l = Experts.Count() - 1; l >= 0; l--)
                {
                    var currentExpert = Experts.Single(x => x.Name == orderedExpertNames [l]);
                    var ll            = Estimates [currentExpert, variable].ToList();
                    // expertEstimates[l].ToList();
                    var index = ll.FindIndex(y => y > v);
                    if (index < 0)
                    {
                        index = NbQuantiles;
                    }

                    h = (h * (NbQuantiles + 1)) + index;
                }
                probabilities[i] *= Pr[h];
            }

            var sum = probabilities.Sum();

            probabilities = probabilities.Select(t => t / sum).ToArray();
            var stops = xlist.ToArray();

            var quantiles = new double [probabilities.Length + 1];

            quantiles [0] = 0;
            int ij;

            for (ij = 1; ij < probabilities.Length; ij++)
            {
                quantiles [ij] = quantiles[ij - 1] + probabilities[ij - 1];
            }

            quantiles [ij] = 1;

            var dist = new QuantileDistribution(quantiles, stops);

            return(dist);
        }
示例#11
0
 public void Sample()
 {
     Estimates.Clear();
     gpw.Sample().ForEach(_ => Estimates.Add(_));
 }
示例#12
0
        Estimates estimate;      // сылка на объект класса оценок

        private void Form1_Load(object sender, EventArgs e)
        {
            estimate = new Estimates();
            gen      = new Random(); // генератор случайных чисел
        }
示例#13
0
        public async Task <IActionResult> NewOffer(OfferViewModel model)
        {
            if (ModelState.IsValid)
            {
                Users user = UserRepository.FindUserByEmail(User.Identity.Name);
                //var customer = wefactconnector.GetCustomerInfo(model.DebtorNumber);
                var settingdocument = SettingsRepository.getSpecificSetting("DocumentCode");
                int documentcode    = int.Parse(settingdocument.Value);
                var code            = documentcode.ToString("000");

                var offerte = new Offers
                {
                    IndexContent = model.IndexContent,
                    ProjectName  = model.ProjectName,
                    //DebtorNumber = model.DebtorNumber,
                    CreatedBy       = user,
                    CreatedAt       = DateTime.Now,
                    LastUpdatedAt   = DateTime.Now,
                    UpdatedBy       = user,
                    DocumentCode    = "PV" + code,
                    DocumentVersion = 1
                };

                await OfferRepository.AddAsync(offerte);

                documentcode++;
                settingdocument.Value = documentcode.ToString();
                await SettingsRepository.SaveChangesAsync();

                var est = new Estimates
                {
                };

                await EstimateRepository.AddAsync(est);

                foreach (var line in model.EstimateLines)
                {
                    var lin = new EstimateLines
                    {
                        HourCost      = line.HourCost,
                        Hours         = line.Hours,
                        Specification = line.Specification,
                        TotalCost     = line.TotalCost
                    };

                    var connect = new EstimateConnects
                    {
                        Estimate      = est,
                        EstimateLines = lin
                    };

                    await EstimateLinesRepository.AddAsync(lin);

                    await EstimateConnectsRepository.AddAsync(connect);
                }

                offerte.Estimate = est;
                await OfferRepository.UpdateAsync(offerte);

                return(Ok());
            }
            else
            {
                return(BadRequest(ModelState));
            }
        }