Exemplo n.º 1
0
        //have formular here
        public List <Recommendation_Meta_Item> GetRecommendationR3(Predict_DAO_MCol a)
        {
            List <Recommendation_Meta_Item> list1 = new List <Recommendation_Meta_Item>();
            Recommendation_Meta_Item        recommendationMetaItem1 = new Recommendation_Meta_Item();
            List <CONF>   list2 = new List <CONF>();
            List <DIST>   list3 = new List <DIST>();
            List <string> list4 = new List <string>();
            List <string> list5 = new List <string>();
            List <string> list6 = new List <string>();
            List <U_I_Q>  list7 = new List <U_I_Q>();

            foreach (string cluster in a.GetListClusterID())
            {
                List <CONF>   confOfCluster        = a.GetCONF_OfCluster(cluster);
                List <DIST>   distOfCluster        = a.GetDIST_OfCluster(cluster);
                List <string> listUserOfCluster    = a.GetListUser_OfCluster(cluster);
                List <U_I_Q>  traditionalUsersMore = a.GetQuantityTraditionalUsers_More(cluster);
                foreach (string user in listUserOfCluster)
                {
                    List <string> notPurchasedOfUser = a.GetListMetaItemNotPurchased_OfUser(user, cluster);
                    List <string> listMetaItemOfUser = a.GetListMetaItem_OfUser(user);
                    string        str  = "";
                    double        num1 = 0.0;
                    for (int index1 = 0; index1 < notPurchasedOfUser.Count; ++index1)
                    {
                        double num2 = 0.0;
                        double num3 = 0.0;
                        double num4 = 1.0;
                        for (int index2 = 0; index2 < listMetaItemOfUser.Count; ++index2)
                        {
                            for (int index3 = 0; index3 < confOfCluster.Count; ++index3)
                            {
                                if (confOfCluster[index3].MetaItemSource.Equals(listMetaItemOfUser[index2]) && confOfCluster[index3].MetaItemDestination.Equals(notPurchasedOfUser[index1]))
                                {
                                    num3 = confOfCluster[index3].Confident;
                                    break;
                                }
                            }
                            for (int index3 = 0; index3 < distOfCluster.Count; ++index3)
                            {
                                if (distOfCluster[index3].MetaItemDestination.Equals(listMetaItemOfUser[index2]) && distOfCluster[index3].MetaItemDestination.Equals(notPurchasedOfUser[index1]))
                                {
                                    num4 = distOfCluster[index3].Distance;
                                    break;
                                }
                            }
                            if (num4 != 0.0)
                            {
                                num2 += num3 / num4;
                            }
                        }
                        if (num1 < num2 / (double)listMetaItemOfUser.Count)
                        {
                            num1 = num2;
                            str  = notPurchasedOfUser[index1];
                        }
                    }
                    if (num1 != 0.0)
                    {
                        Recommendation_Meta_Item recommendationMetaItem2 = new Recommendation_Meta_Item();
                        recommendationMetaItem2.UserID        = user;
                        recommendationMetaItem2.MetaItemID    = str;
                        recommendationMetaItem2.RecommendType = ConstantValues.RC_TYPE_LRS03;
                        recommendationMetaItem2.Quantity      = 0.0;
                        for (int index = 0; index < traditionalUsersMore.Count; ++index)
                        {
                            if (traditionalUsersMore[index].MetaItemID.Equals(str))
                            {
                                recommendationMetaItem2.Quantity = traditionalUsersMore[index].QTY;
                                break;
                            }
                        }
                        recommendationMetaItem2.Score = num1;
                        list1.Add(recommendationMetaItem2);
                    }
                }
            }
            return(list1);
        }