Example #1
0
        public double calculateOptimalManhattan(double zvaigzdutes, double atstumas, double kaina, double maitinimas, double ivertinimas, double balkonas, double wifi,
                                                double kondicionierius, double neigaliems, double augintinis, double minibaras, double parkingas, double kacialka, double virtuvele, Viesbutis V)
        {
            double zvaigzdutesModulated = zvaigzdutes - V.Zvaigzdutes;

            if (zvaigzdutesModulated < 0)
            {
                zvaigzdutesModulated *= -1;
            }

            double atstumasModulated = atstumas - V.Atstumas_iki_centro;

            if (atstumasModulated < 0)
            {
                atstumasModulated *= -1;
            }

            double kainaModulated = kaina - V.Vidutine_kaina;

            if (kainaModulated < 0)
            {
                kainaModulated *= -1;
            }

            double maitinimasModulated = maitinimas - V.maitinimas;

            if (maitinimasModulated < 0)
            {
                maitinimasModulated *= -1;
            }

            double ivertinimasModulated = ivertinimas - V.lankytoju_balas;

            if (ivertinimasModulated < 0)
            {
                ivertinimasModulated *= -1;
            }

            double balkonasModulated = balkonas - V.balkonas;

            if (balkonasModulated < 0)
            {
                balkonasModulated *= -1;
            }

            double wifiModulated = wifi - V.wifi;

            if (wifiModulated < 0)
            {
                wifiModulated *= -1;
            }

            double kondicionieriusModulated = kondicionierius - V.kondicionierius;

            if (kondicionieriusModulated < 0)
            {
                kondicionieriusModulated *= -1;
            }

            double neigaliemsModulated = neigaliems - V.pritaikymas_neigaliems;

            if (neigaliemsModulated < 0)
            {
                neigaliemsModulated *= -1;
            }

            double augintinisModulated = augintinis - V.leidziamas_augintinis;

            if (augintinisModulated < 0)
            {
                augintinisModulated *= -1;
            }

            double minibarasModulated = minibaras - V.minibaras;

            if (minibarasModulated < 0)
            {
                minibarasModulated *= -1;
            }

            double parkingasModulated = parkingas - V.parkingo_vieta;

            if (parkingasModulated < 0)
            {
                parkingasModulated *= -1;
            }

            double kacialkaModulated = kacialka - V.kacialka;

            if (kacialkaModulated < 0)
            {
                kacialkaModulated *= -1;
            }

            double virtuveModulated = virtuvele - V.virtuvele;

            if (virtuveModulated < 0)
            {
                virtuveModulated *= -1;
            }


            double d = zvaigzdutesModulated + atstumasModulated + kainaModulated + maitinimasModulated + ivertinimasModulated + balkonasModulated + wifiModulated +
                       kondicionieriusModulated + neigaliemsModulated + augintinisModulated + minibarasModulated + parkingasModulated + kacialkaModulated + virtuveModulated;

            return(d);
        }
Example #2
0
        private void DBhotelValuesZeroOne()
        {
            viesbuciaiZeroOne.Clear();
            // pakeicia DUOMENU BAZES viesbuciu reiksmes tarp 0 ir 1
            foreach (Viesbutis h in viesbuciaiAll)
            {
                int    starsIndex = Convert.ToInt32(h.Zvaigzdutes);
                double starsValue;
                if (starsIndex == 0)
                {
                    starsValue = 1;
                }
                else if (starsIndex == 1)
                {
                    starsValue = 0.8;
                }
                else if (starsIndex == 2)
                {
                    starsValue = 0.6;
                }
                else if (starsIndex == 3)
                {
                    starsValue = 0.4;
                }
                else if (starsIndex == 4)
                {
                    starsValue = 0.2;
                }
                else
                {
                    starsValue = 0;
                }


                int    distanceIndex = Convert.ToInt32(h.Atstumas_iki_centro);
                double distanceValue;
                if (distanceIndex == 0)
                {
                    distanceValue = 1;
                }
                else if (distanceIndex == 1)
                {
                    distanceValue = 0.8;
                }
                else if (distanceIndex == 2)
                {
                    distanceValue = 0.6;
                }
                else if (distanceIndex == 3)
                {
                    distanceValue = 0.4;
                }
                else if (distanceIndex == 4)
                {
                    distanceValue = 0.2;
                }
                else
                {
                    distanceValue = 0;
                }


                int    priceIndex = Convert.ToInt32(h.Vidutine_kaina);
                double priceValue;
                if (priceIndex == 0)
                {
                    priceValue = 1;
                }
                else if (priceIndex == 1)
                {
                    priceValue = 0.8;
                }
                else if (priceIndex == 2)
                {
                    priceValue = 0.6;
                }
                else if (priceIndex == 3)
                {
                    priceValue = 0.4;
                }
                else if (priceIndex == 4)
                {
                    priceValue = 0.2;
                }
                else
                {
                    priceValue = 0;
                }


                int    mealsIndex = Convert.ToInt32(h.maitinimas);
                double mealsValue;
                if (mealsIndex == 0)
                {
                    mealsValue = 1;
                }
                else if (mealsIndex == 1)
                {
                    mealsValue = 0.8;
                }
                else if (mealsIndex == 2)
                {
                    mealsValue = 0.6;
                }
                else if (mealsIndex == 3)
                {
                    mealsValue = 0.4;
                }
                else if (mealsIndex == 4)
                {
                    mealsValue = 0.2;
                }
                else
                {
                    mealsValue = 0;
                }

                int    guestRatingIndex = Convert.ToInt32(h.lankytoju_balas);
                double guestRatingValue;
                if (guestRatingIndex == 0)
                {
                    guestRatingValue = 1;
                }
                else if (guestRatingIndex == 1)
                {
                    guestRatingValue = 0.8;
                }
                else if (guestRatingIndex == 2)
                {
                    guestRatingValue = 0.6;
                }
                else if (guestRatingIndex == 3)
                {
                    guestRatingValue = 0.4;
                }
                else if (guestRatingIndex == 4)
                {
                    guestRatingValue = 0.2;
                }
                else
                {
                    guestRatingValue = 0;
                }

                double balconyValue;
                if (h.balkonas == 1)
                {
                    balconyValue = 1;
                }
                else
                {
                    balconyValue = 0;
                }

                double wifiValue;
                if (h.wifi == 1)
                {
                    wifiValue = 1;
                }
                else
                {
                    wifiValue = 0;
                }

                double conditionerValue;
                if (h.kondicionierius == 1)
                {
                    conditionerValue = 1;
                }
                else
                {
                    conditionerValue = 0;
                }

                double disabledPersonsValue;
                if (h.pritaikymas_neigaliems == 1)
                {
                    disabledPersonsValue = 1;
                }
                else
                {
                    disabledPersonsValue = 0;
                }

                double petValue;
                if (h.leidziamas_augintinis == 1)
                {
                    petValue = 1;
                }
                else
                {
                    petValue = 0;
                }

                double minibarValue;
                if (h.minibaras == 1)
                {
                    minibarValue = 1;
                }
                else
                {
                    minibarValue = 0;
                }

                double parkingValue;
                if (h.parkingo_vieta == 1)
                {
                    parkingValue = 1;
                }
                else
                {
                    parkingValue = 0;
                }

                double gymValue;
                if (h.kacialka == 1)
                {
                    gymValue = 1;
                }
                else
                {
                    gymValue = 0;
                }

                double kitchenValue;
                if (h.virtuvele == 1)
                {
                    kitchenValue = 1;
                }
                else
                {
                    kitchenValue = 0;
                }
                Viesbutis ho = new Viesbutis(h.Pavadinimas, starsValue, distanceValue, priceValue, mealsValue, guestRatingValue, balconyValue, wifiValue, conditionerValue,
                                             disabledPersonsValue, petValue, minibarValue, parkingValue, gymValue, kitchenValue);
                viesbuciaiZeroOne.Add(ho);
            }
        }
Example #3
0
        public double calculateOptimalEuclidean(double zvaigzdutes, double atstumas, double kaina, double maitinimas, double ivertinimas, double balkonas, double wifi,
                                                double kondicionierius, double neigaliems, double augintinis, double minibaras, double parkingas, double kacialka, double virtuvele, Viesbutis V)
        {
            double d = Math.Sqrt(
                Math.Pow((zvaigzdutes - V.Zvaigzdutes), 2) +
                Math.Pow((atstumas - V.Atstumas_iki_centro), 2) +
                Math.Pow((kaina - V.Vidutine_kaina), 2) +
                Math.Pow((maitinimas - V.maitinimas), 2) +
                Math.Pow((ivertinimas - V.lankytoju_balas), 2) +
                Math.Pow((balkonas - V.balkonas), 2) +
                Math.Pow((wifi - V.wifi), 2) +
                Math.Pow((kondicionierius - V.kondicionierius), 2) +
                Math.Pow((neigaliems - V.pritaikymas_neigaliems), 2) +
                Math.Pow((augintinis - V.leidziamas_augintinis), 2) +
                Math.Pow((minibaras - V.minibaras), 2) +
                Math.Pow((parkingas - V.parkingo_vieta), 2) +
                Math.Pow((kacialka - V.kacialka), 2) +
                Math.Pow((virtuvele - V.virtuvele), 2)
                );

            return(d);
        }