Exemplo n.º 1
0
        /// <summary>
        /// Populate the "mat" matrix with values according to the properties
        /// </summary>
        /// <param name="mat">the matrix to manipulate</param>
        private void PopulateMatrix(ref float[][] mat)
        {
            ConnectionMongoDB      db       = ConnectionMongoDB.GetInstance();
            IList <BasketItemsDTO> products = this.m_basket.basketItems;

            for (int i = 0; i < mat.Length; i++)
            {
                // TODO: DB access
                ProductDTO productItem = db.GetProductDTONotFromDBByProductId(products[i].id);
                //ProductDTO productItem = Program.Prodcuts[products[i].id];

                FillProduct(ref mat, i, productItem, db);
            }
        }
Exemplo n.º 2
0
        private BasketListGenome MutateBasket(BasketListGenome BasketToMutate)
        {
            BasketListGenome  MutatedBasket = BasketToMutate;
            ConnectionMongoDB db            = ConnectionMongoDB.GetInstance();

            if (this.GetRandomNumber(0, 1) <= this.m_mutationFreq)
            {
                for (int i = 0; i < MutatedBasket.BasketObject.basketItems.Count; i++)
                {
                    if (this.GetRandomNumber(0, 1) <= this.m_mutationFreq)
                    {
                        // TODO: DB access
                        MutatedBasket.BasketObject.basketItems[i] = db.GetRandomProduct();
                        //MutatedBasket.BasketObject.basketItems[i] = Program.GetRandomProduct();
                    }
                }
            }

            return(MutatedBasket);
        }
Exemplo n.º 3
0
 public MainController()
 {
     this.db = ConnectionMongoDB.GetInstance();
     this.db.InitMongoClient(ConnectionMongoDB.URL);
 }